[PATCH] D83549: [ELF] Do not force bringing out symbols passed by -init and -fini.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 16:22:29 PDT 2020
MaskRay added a comment.
OK, I think D69885 <https://reviews.llvm.org/D69885> (lto/init-fini.ll) still makes sense. A bitcode symbol can behave like a regular symbol or an archive symbol.
For the `-init` case, a bitcode definition should behave more like a regular definition and `-init` can cause the definition to be emitted.
This patch makes LLD similar to GNU ld: there is no symbol table entry for `-init`:
cat > a.s <<e
.globl _init, foo
_init:
foo:
ret
e
as a.s -o a.o
ar rc a.a a.o
as /dev/null -o b.o
ld.bfd -init=foo b.o a.a # a.a(a.o) not fetched & foo does not exist
ld.bfd b.o a.a # a.a(a.o) not fetched & foo does not exist
I think this patch makes sense.
================
Comment at: lld/test/ELF/archive-init-fini.s:3
+
+## This checks that LLD does not add "_init" and "_fini" symbols into
+## the symbol table of the output binary if the symbols are encountered in
----------------
If you delete _start from init-fini.s, you can add this test into init-fini.s
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83549/new/
https://reviews.llvm.org/D83549
More information about the llvm-commits
mailing list