Keep symbols passed by -init and -fini
authorRui Ueyama <ruiu@google.com>
Fri, 8 Nov 2019 05:39:14 +0000 (14:39 +0900)
committerRui Ueyama <ruiu@google.com>
Fri, 8 Nov 2019 10:08:15 +0000 (19:08 +0900)
commitf95273f75aaa5db5493aea7902416ce3d5a09043
tree13a90d3352b7a7a731a0e6826cf3fe0d04bdadef
parent41449c58c58e466bcf9cdc4f7415950382bad8d7
Keep symbols passed by -init and -fini

Previously, symbols passed by -init and -fini look as if they are
not referenced by anyone, and the LTO might eliminate them.
This patch fixes the issue.

Fixes a bug reported in https://bugs.llvm.org/show_bug.cgi?id=43927

Differential Revision: https://reviews.llvm.org/D69985
lld/ELF/Driver.cpp
lld/test/ELF/lto/init-fini.ll [new file with mode: 0644]