[HEADS UP] Kernel modules don't work properly in FreeBSD 8.1-RC1

Ryan Stone rysto32 at gmail.com
Wed Jun 23 15:03:47 UTC 2010

On Wed, Jun 23, 2010 at 3:10 AM, Andriy Gapon <avg at icyb.net.ua> wrote:
> Which also brings the question - what arch(s) is affected?
> I tested on amd64.

This should explain it.  It looks to me like i386 uses kern/link_elf.c
as its linker, while amd64 uses kern/link_elf_obj.c.  link_elf.c can
only find the sections containing the sysinits(and some related
things) via the magic symbols.  link_elf_obj.c seems to understand ELF
objects much better and doesn't need those symbols to be present.  It
just looks up the section that contains the sysinits directly via the
ELF metadata that is already present.

As far as I can tell, amd64 is the only arch in the tree that uses
link_elf_obj.c, so all other arches may be affected.

I have to admit that I'm more than a little surprised that this
problem does not affect modules that in src, but maybe that's because
I don't know all that much about FreeBSD's build infrastructure.  Are
the src modules being linked with a linker script that is not being
used for out-of-src modules?  Are the people affected by this not
using the base compiler to build ports?(I see that this affects PC-BSD
as well, and I'd be a little surprised to learn that it wasn't using
the base compiler).

The link line that I gave was a hack.  The proper solution is to use a
linker script that unconditionally puts the magic symbols in.

More information about the freebsd-current mailing list