amd64 kernel modules: mapping sections to addresses

Andriy Gapon avg at
Mon Jun 21 21:34:54 UTC 2010

on 21/06/2010 23:44 Navdeep Parhar said the following:
> On Mon, Jun 21, 2010 at 04:10:45PM -0400, John Baldwin wrote:
>> On Monday 21 June 2010 11:57:17 am Andriy Gapon wrote:
>>> on 21/06/2010 18:43 John Baldwin said the following:
>>>> np@ has a patch to gdb to fix this for kgdb.  I haven't committed it as it 
>>>> patched gdb internals and wasn't in a kgdb-specific place, but I'm not 
>> sure of 
>>>> a better way to fix kgdb.
>>> Oh, yes, section mapping is done in common gdb code.
>>> Perhaps kld.c shouldn't call build_section_table, but directly call
>>> bfd_map_over_sections with a custom variant of add_to_section_table?
>>> Can you please share the patch?
>> It was deeper level than that, I'd have to dig it up.
> I'm using this patch these days:
> The changes to the kernel linker were not required originally.  See this
> for why they had to be made:
> The patch is quite crude and I have no idea how it behaves on other
> platforms.

Thanks a lot!  These are exact issues that I hit and the patches are what I
think they should be, take or give.  I don't think they are really crude.
I will try to get them committed.

Kernel linker change is good as is, I'd just like to move the zero size check
before the switch statement.

gdb change - I'd rather do it via kld_current_sos,
kld_relocate_section_addresses.  I'd like to avoid changing common gdb code for
a variety of reasons.

Andriy Gapon

More information about the freebsd-amd64 mailing list