Date: Tue, 22 Jun 2010 14:07:21 -0700 From: Ted Faber <faber@isi.edu> To: Ryan Stone <rysto32@gmail.com> Cc: Bruce Cran <bruce@cran.org.uk>, "Sergey V. Dyatko" <sergey.dyatko@gmail.com>, freebsd-hackers@freebsd.org, Hans Petter Selasky <hselasky@c2i.net>, Alexander Best <alexbestms@wwu.de>, freebsd-current@freebsd.org, Giorgos Keramidas <keramida@ceid.upatras.gr> Subject: Re: building world with debugging symbols [broken?] Message-ID: <20100622210721.GC18012@zod.isi.edu> In-Reply-To: <AANLkTimD3Hcjqpy2w9Q0tvVDJ01gCH1ClSQCj2c4MFBz@mail.gmail.com> References: <permail-20100305171533f7e55a9d0000225a-a_best01@message-id.uni-muenster.de> <201003301510.58203.jhb@freebsd.org> <87bpe4ps9m.fsf@kobe.laptop> <201006222208.23271.hselasky@c2i.net> <AANLkTimD3Hcjqpy2w9Q0tvVDJ01gCH1ClSQCj2c4MFBz@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--c3bfwLpm8qysLVxt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 22, 2010 at 04:39:17PM -0400, Ryan Stone wrote: > I saw similar behaviour a couple of years ago when I switched from > using gcc 4.0.2 to gcc 4.3.0 to compile some out-of-tree KLD modules. > The problem ended up being a change in the linker script used by GNU > ld for linking kernel modules. It used to always put some magic > symbols used by the linker to implement things like sysinits into the > module. It was changed to only provide those symbols, which > apparently means that the linker would discard those symbols if > nothing referenced them(and nothing did reference them). I had to > work around it by adding the following to my link line: >=20 > -u __start_set_sysinit_set -u __start_set_sysuninit_set \ > -u __start_set_sysctl_set -u __start_set_modmetadata_set \ > -u __stop_set_sysinit_set -u __stop_set_sysuninit_set \ > -u __stop_set_sysctl_set -u __stop_set_modmetadata_set HPS: I added those lines to the LDFLAGS in Makefile.kmod in the cuse4bsd port made the module and the result loads and creates the /dev/cuse file. Here's a diff relative to /usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1.11 just so it's clear what I did. --- Makefile.kmod.orig 2010-02-11 03:28:02.000000000 -0800 +++ Makefile.kmod 2010-06-22 14:02:52.000000000 -0700 @@ -30,4 +30,10 @@ KMOD=3D cuse4bsd SRCS=3D cuse4bsd_kmod.c device_if.h bus_if.h vnode_if.h =20 +LDFLAGS +=3D -u __start_set_sysinit_set -u __start_set_sysuninit_set \ + -u __start_set_sysctl_set -u __start_set_modmetadata_set \ + -u __stop_set_sysinit_set -u __stop_set_sysuninit_set \ + -u __stop_set_sysctl_set -u __stop_set_modmetadata_set + + .include <bsd.kmod.mk> Running nm -o on the two modules, the difference seems to be that the -u results in some additional absolute symbols being defined: Bad module: $ nm -o /boot/modules/cuse4bsd.ko| grep sys /boot/modules/cuse4bsd.ko:0000275c r __set_sysinit_set_sym_cuse_kern_init_sys_init /boot/modules/cuse4bsd.ko:00002758 r __set_sysuninit_set_sym_cuse_kern_unin= it_sys_uninit /boot/modules/cuse4bsd.ko:00003194 d cuse_kern_init_sys_init /boot/modules/cuse4bsd.ko:00003184 d cuse_kern_uninit_sys_uninit Good module: $ nm -o ./cuse4bsd.ko | grep sys =2E/cuse4bsd.ko:000028cc r __set_sysinit_set_sym_cuse_kern_init_sys_init =2E/cuse4bsd.ko:000028c8 r __set_sysuninit_set_sym_cuse_kern_uninit_sys_uni= nit =2E/cuse4bsd.ko: U __start_set_sysctl_set =2E/cuse4bsd.ko:000028cc A __start_set_sysinit_set =2E/cuse4bsd.ko:000028c8 A __start_set_sysuninit_set =2E/cuse4bsd.ko: U __stop_set_sysctl_set =2E/cuse4bsd.ko:000028d0 A __stop_set_sysinit_set =2E/cuse4bsd.ko:000028cc A __stop_set_sysuninit_set =2E/cuse4bsd.ko:00003194 d cuse_kern_init_sys_init =2E/cuse4bsd.ko:00003184 d cuse_kern_uninit_sys_uninit --=20 Ted Faber http://www.isi.edu/~faber PGP: http://www.isi.edu/~faber/pubkeys.= asc Unexpected attachment on this mail? See http://www.isi.edu/~faber/FAQ.html#= SIG --c3bfwLpm8qysLVxt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkwhJgkACgkQaUz3f+Zf+XsIHQCg01pjgmyQMtRhCxX5Vcecfmh6 oAEAoMjEQJnq4qzA5nrwpptyHFNnnJ+T =tM4z -----END PGP SIGNATURE----- --c3bfwLpm8qysLVxt--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100622210721.GC18012>