CTF wierdness when built for kernel modules

Shrikanth Kamath shrikanth07 at gmail.com
Fri Jan 11 12:04:49 UTC 2013


I am seeing some wierdness with the ctf sections built for the kernel
modules, (this is in a proprietary toolchain env) but FreeBSD 10.

To build the context,  the module.kld is built, ctfmerge is run on the
OBJS  and the consolidated .SUNW_ctf is appended in module.kld. When I
inspect the ctfdump op of module.kld I have this for e.g
        ...
        (func_one) returns: 22 args: (1984, 1739, 1986)
        (func_two) returns: 22 args: (2537, 22, 2534, 297)
        ...
Now when the .ko.debug is built,
<toolchain>-ld -m elf_i386 -Bshareable  -o module.ko.debug module.kld
and the ctfdump for the .SUNW_ctf again inspected (from
module.ko.debug) here is the observation...
        ...
        (func_two) returns: 22 args: (1984, 1739, 1986)
        (func_one) returns: 22 args: (2537, 22, 2534, 297)
        ...

What has happened is the position of func_one and func_two are
exchanged, and the arguments of func_two are shown against func_one
and vice-versa.
This is not the case for all functions though...some are correct
intact across this move from .kld to .ko

Does ld -Bshareable do anything to mess this up?

To mention when a I do a (gdb)ptype func_one or (gdb)ptype func_two
from both module.kld and module.ko.debug they are correct. It is only
in the CTF section that they are messed up...

--
Shrikanth R K


More information about the freebsd-hackers mailing list