summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-10-14 22:20:57 +0000
committerRui Ueyama <ruiu@google.com>2015-10-14 22:20:57 +0000
commit2b675074feda2e8d643909c5fa9ab2bcb67c8581 (patch)
treec439f573e4bbf0caf20c0366bbb61197883d653f /lld/ELF/Driver.cpp
parentf9e0b253ad605a429526b54ffdfcf121deaf082c (diff)
downloadbcm5719-llvm-2b675074feda2e8d643909c5fa9ab2bcb67c8581.tar.gz
bcm5719-llvm-2b675074feda2e8d643909c5fa9ab2bcb67c8581.zip
ELF2: Support --entry=<addr>.
If an argument for --entry is a number, that's not a symbol name but an absolute address. If that's the case, the address is directly set to ELF header's e_entry. llvm-svn: 250334
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 53be66c55f1..2d7d75ce39a 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -201,7 +201,11 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
// Add entry symbol.
if (Config->Entry.empty())
Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
- Config->EntrySym = Symtab.addUndefined(Config->Entry);
+
+ // Set either EntryAddr (if S is a number) or EntrySym (otherwise).
+ StringRef S = Config->Entry;
+ if (S.getAsInteger(0, Config->EntryAddr))
+ Config->EntrySym = Symtab.addUndefined(S);
// In the assembly for 32 bit x86 the _GLOBAL_OFFSET_TABLE_ symbol
// is magical and is used to produce a R_386_GOTPC relocation.
OpenPOWER on IntegriCloud