[PATCH] D69985: Keep symbols passed by -init and -fini

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 02:01:10 PST 2019


ruiu marked an inline comment as done.
ruiu added inline comments.


================
Comment at: lld/ELF/Driver.cpp:1790
+    sym->isUsedInRegularObj = true;
+
   // If any of our inputs are bitcode files, the LTO code generator may create
----------------
MaskRay wrote:
> grimar wrote:
> > Perhaps a stupid question, but still: can these symbols be lazy? i.e. should `handleUndefined` be used here, like for `config->entry`?
> Calling `handleUndefined` will fetch the lazy symbol. However, ld.bfd and gold do not fetch lazy `--init` or `--fini`.  I think this is a very minor edge case, being incompatible with GNU linkers should be fine.
> 
> Calling `handleUndefined` LGTM because it makes code prettier.
I don't worry too much about compatibility in this edge case, but I don't think there's a reason to intentionally diverge from GNU too in this case, so I prefer keeping this as is.


================
Comment at: lld/test/ELF/lto/init-fini.ll:12
+
+; RUN: ld.lld -o %t.exe -init=foo -fini=bar %t.o
+; RUN: llvm-objdump -t %t.exe | FileCheck -check-prefix=TEST2 %s
----------------
MaskRay wrote:
> Enhance the test to check `llvm-readelf -d` output for `DT_INIT` and `DT_FINI` as well? It will need -pie (or -shared or --export-dynamic).
Good suggestion. Done.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69985/new/

https://reviews.llvm.org/D69985





More information about the llvm-commits mailing list