mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-06 00:31:14 +01:00
b62f36f305
With linker sections GC enabled, we get a test failure in `nlist.c`: ``` nlist: nlist.c:72: main: Assertion `rc == 0' failed. ``` This turns out to be because several sections used by the test can be discarded: ``` ld: removing unused section '.text.func_pub' in file 'nlist.o' ld: removing unused section '.bss.data_pub_uninit' in file 'nlist.o' ld: removing unused section '.data.data_pub_init' in file 'nlist.o' ``` Reproduced with `CFLAGS="-Og -fdata-sections -ffunction-sections"` and `LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--gc-sections -Wl,-z,start-stop-gc"`. Additionally, `LDFLAGS="... -Wl,--print-gc-sections"` can help with diagnosing which sections get removed. We already mark these symbols as `used`, but we need `retain` [0] for them to survive linker GC too. [0] https://releases.llvm.org/18.1.0/tools/lld/docs/ELF/start-stop-gc.html#annotate-c-identifier-name-sections Closes: !29 Signed-off-by: Sam James <sam@gentoo.org> Signed-off-by: Guillem Jover <guillem@hadrons.org> |
||
---|---|---|
.. | ||
.gitignore | ||
arc4random.c | ||
bzero.c | ||
closefrom.c | ||
endian.c | ||
explicit_bzero.c | ||
fgetln.c | ||
fparseln.c | ||
fpurge.c | ||
funopen.c | ||
headers-overlay.sh | ||
headers-system.sh | ||
humanize.c | ||
Makefile.am | ||
md5.c | ||
nlist.c | ||
overlay.c | ||
proctitle.c | ||
progname.c | ||
pwcache.c | ||
setmode.c | ||
strl.c | ||
strmode.c | ||
strnstr.c | ||
strtonum.c | ||
test-stream.c | ||
test-stream.h | ||
timeconv32.c | ||
timeconv64.c | ||
vis-openbsd.c | ||
vis.c |