HomeFreeBSD

linker: Make it easier to find the VNET section layout

Description

linker: Make it easier to find the VNET section layout

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.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D52730

Details

Provenance
markjAuthored on Oct 3 2025, 2:25 PM
Reviewer
kib
Differential Revision
D52730: linker: Make it easier to find the VNET section layout
Parents
rG0952943a680d: netstat: Fix -ia missing multicast addresses on some interfaces
Branches
Unknown
Tags
Unknown