[ELF2] Add DT_INIT and DT_FINI dynamic table entries
The entries are added if there are "_init" or "_fini" entries in
the symbol table respectively. According to the behavior of ld,
entries are inserted even for undefined symbols.
Symbol names can be overridden by using -init and -fini command
line switches. If used, these switches neither add new symbol table
entries nor require those symbols to be resolved.
Differential Revision: http://reviews.llvm.org/D13385
llvm-svn: 249297
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c7dbafe..4fadfd2 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -85,7 +85,7 @@
Writer(SymbolTable *T)
: SymTabSec(*T, StrTabSec, BssSec), DynSymSec(*T, DynStrSec, BssSec),
RelaDynSec(DynSymSec, GotSec, T->shouldUseRela()), PltSec(GotSec),
- HashSec(DynSymSec), DynamicSec(*T, HashSec, RelaDynSec),
+ HashSec(DynSymSec), DynamicSec(*T, HashSec, RelaDynSec, BssSec),
BssSec(PltSec, GotSec, BssSec, ".bss", SHT_NOBITS,
SHF_ALLOC | SHF_WRITE) {}
void run();