Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jun 2006 09:08:24 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        Konstantin Belousov <kostikbel@gmail.com>, Divacky Roman <xdivac02@stud.fit.vutbr.cz>
Subject:   Re: SoC: strange magic with objcopy and module builds
Message-ID:  <200606130908.25380.jhb@freebsd.org>
In-Reply-To: <20060613090111.GS54415@deviant.kiev.zoral.com.ua>
References:  <20060606144455.GA502@stud.fit.vutbr.cz> <20060613090111.GS54415@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 13 June 2006 05:01, Konstantin Belousov wrote:
> On Tue, Jun 06, 2006 at 04:44:55PM +0200, Divacky Roman wrote:
> > Hi,
> >=20
> > I am working on SoC linuxolator and I found strange thing I dont know h=
ow to
> > cope with:
> >=20
> > I made a patch which enables module build of linuxolator on amd64 but it
> > refuses to kldload because of missing symbol. I tracked the problem dow=
n to
> > the fact that i386 module build works in a way that it builds .kld and =
then
> > turns this into .ko:
> >=20
> > ld -Bshareable  -d -warn-common -o linux.ko linux.kld
> >=20
> > this line makes transition from U symbol to A symbol.
> >=20
> > Amd64 version uses only .ko, so this step doesnt exist there so those s=
ymbols
> > remain U.
> >=20
> > can someone explain me whats going on?
> >=20
> > thnx roman
> In private communication, Roman said that the problem symbols
> are __start* and __stop*. That symbols are generated by the static linker
> for the section start/end.
>=20
> Since AMD64 uses relocatable objects as kld instead of shared ones,
> that symbols are leaved undefined.
>=20
> Patch below will simulate behaviour of the static linker for the
> in-kernel elf_obj linker. The patch makes the linker_set.h
> machinery fully operatable on AMD64. Please test.

Alternatively you can not use the SET_* macros in kernel modules,
but ask the kernel linker to lookup the linker sets you need in
your mod_event handler.  The linker manually looks up linker sets
for things like sysinit and sysctl, so it is probably best if we
continue to just look them up manually.  You don't want to create
duplicate start/stop for existing sets which might confuse things.
I have an example of this for HEAD in my crash and crash2 modules
available in the smpng branch in p4 at
//depot/projects/smpng/src/sys/modules/crash/crash.c and
//depot/projects/smpng/src/sys/modules/crash2/crash2.c.

I'm not opposed to this fix either though, but peter@ should probably
review it.

=2D-=20
John Baldwin <jhb@FreeBSD.org> =A0<>< =A0http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606130908.25380.jhb>