tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

link-set



This is what I've learned about link-set.

TL;DR - link-set is fine except already unused sections are exposed
after final link

*

- link-set is a set of macros __link_set_*` defined in sys/cdefs.h
(actually sys/cdefs_*.h).

- link-set provides format-neutral way to generate linker sections.

- link-set relys on the feature of ld(1) that ld(1) automatically
generates __start_XXX and__stop_xxx symbols for sections not starting
. (xxx matches).

- Those two symbols are only generated at final link. Not generated at
relocatable output (ld -r).

- link-set collects read-only pointers of specified objects.

- link-set is meant to collect those pointers and digest them within kernel.

- The most typical use-case is to iterate pointers from __start_xxx to
__end_xxx(__link_set_foreach(xxx)).

- link-set sections don't need to be exposed in "netbsd" kernek,
because no external linker/loader refer to link-set sections.

- Kernel module (modular(9)) loader looks for the link_set_modules
section in kernel modules (*.kmod). Which means that kernel modules
should expose the link_set_modules section.


Home | Main Index | Thread Index | Old Index