search for: text_foo

Displaying 3 results from an estimated 3 matches for "text_foo".

2019 Dec 05
2
GC for defsym'd symbols in LLD
I have made some further investigation. My conclusion is that GNU ld does not do better than lld. Making the --defsym behavior ideal is difficult in the current framework. GNU ld has some unintended behaviors. ld.bfd a.o --defsym 'd=foo' --gc-sections -o a => GNU ld retains .text_foo ld.bfd a.o --defsym 'd=foo+3' --gc-sections -o a => GNU ld drops .text_foo ld.bfd a.o --defsym 'd=bar-bar+foo' --gc-sections -o a => GNU ld drops .text_foo I traced its logic under a debugger. Here is the stack trace: ld/ldlang.c:lang_gc_sections bfd/elflink.c:bfd_elf_gc_sec...
2019 Dec 04
2
GC for defsym'd symbols in LLD
...tions getting preserved regardless.) I want to change defsym targets specifically to not be considered as GC roots, so that they can be dead code eliminated. Does anyone foresee any issues with this? > > % cat a.s > .globl _start, foo, bar > .text; _start: movabs $d, %rax > .section .text_foo,"ax"; foo: ret > .section .text_bar,"ax"; bar: nop > % as a.s -o a.o > > % ld.bfd a.o --defsym d=foo --gc-sections -o a => .text_foo is retained > % ld.bfd a.o --defsym d=bar --gc-sections -o a => .text_bar is retained > % ld.bfd a.o --defsym d=1 --gc-sec...
2019 Dec 04
2
GC for defsym'd symbols in LLD
LLD treats any symbol referenced from a linker script as a GC root, which makes sense. Unfortunately, it also processes --defsym as a linker script fragment internally, so all target symbols of a --defsym also get treated as GC roots (i.e., if you have something like --defsym SRC=TGT, TGT will become a GC root). I believe this to be unnecessary for defsym specifically, since you're just