Page MenuHomeFreeBSD

linker: Make it easier to find the VNET section layout
ClosedPublic

Authored by markj on Sep 25 2025, 1:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 30, 5:22 AM
Unknown Object (File)
Mon, Oct 27, 3:24 AM
Unknown Object (File)
Sun, Oct 26, 10:02 AM
Unknown Object (File)
Fri, Oct 17, 2:30 AM
Unknown Object (File)
Sun, Oct 12, 10:06 AM
Unknown Object (File)
Sun, Oct 12, 10:06 AM
Unknown Object (File)
Sun, Oct 12, 10:06 AM
Unknown Object (File)
Sat, Oct 11, 11:13 PM
Subscribers

Details

Summary

When trying to find the address of a VNET variable from a debugger, it
helps to have the original address of the VNET section. In particular,
given the address of a vnet_entry_foo symbol, one wants to easily find
the linker file that the symbol belongs to.

In link_elf_obj.c, the section address for VNET and DPCPU sections is
overwritten in link_elf_link_preload() and link_elf_load_file(). Add an
"origaddr" field to store the original absolute address of the section
base.

In link_elf.c the elf_file_t already has the fields we want, but they
were not getting filled out for the kernel itself. Fix that too, since
that simplifies things for debuggers and improves consistency.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Sep 25 2025, 1:31 PM
This revision is now accepted and ready to land.Sep 25 2025, 7:47 PM