aboutsummaryrefslogtreecommitdiff
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
authorIgor Kudrin <ikudrin.dev@gmail.com>2015-10-05 10:29:46 +0000
committerIgor Kudrin <ikudrin.dev@gmail.com>2015-10-05 10:29:46 +0000
commitb1f2b51a896e561397aa4ef2620b37ed02c03a58 (patch)
tree67a956eeee946c230793ce83f92e6fbae68a87cc /lld/ELF/Driver.cpp
parent9ed154f9213acaa34fd79aa4a274e9162bf3bf77 (diff)
downloadllvm-b1f2b51a896e561397aa4ef2620b37ed02c03a58.zip
llvm-b1f2b51a896e561397aa4ef2620b37ed02c03a58.tar.gz
llvm-b1f2b51a896e561397aa4ef2620b37ed02c03a58.tar.bz2
[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
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 078382c..7921764 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -117,6 +117,12 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
if (auto *Arg = Args.getLastArg(OPT_entry))
Config->Entry = Arg->getValue();
+ if (auto *Arg = Args.getLastArg(OPT_fini))
+ Config->Fini = Arg->getValue();
+
+ if (auto *Arg = Args.getLastArg(OPT_init))
+ Config->Init = Arg->getValue();
+
if (auto *Arg = Args.getLastArg(OPT_soname))
Config->SoName = Arg->getValue();