https://sourceware.org/bugzilla/show_bug.cgi?id=22677
--- Comment #1 from David Leonard <d+sourcew...@adaptive-enterprises.com> --- Submitted too early, sorry. I mean --gc-section not --gc-collect. Example $ cat L.c int L4var = 4; int L5var; int L5init() { L5var = 5; } __attribute__((constructor)) static void Lconstructor() { L5init(); } $ gcc -ffunction-sections -fdata-sections -c -o L.o L.c $ ld -r --gc-section L.o -u L4var -o libL.o $ nm libL.o 0000000000000000 D L4var With workaround: $ ld -r --gc-section L.o -u L4var -o libL.o fixup.ldscript ld: warning: fixup.ldscript contains output sections; did you forget -T? $ nm libL.o 0000000000000000 D L4var 0000000000000000 T L5init 0000000000000004 C L5var 0000000000000000 t Lconstructor -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils