summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.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/Writer.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/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4307b48f034..4861dc1729d 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -648,9 +648,12 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
EHdr->e_type = Config->Shared ? ET_DYN : ET_EXEC;
EHdr->e_machine = FirstObj.getEMachine();
EHdr->e_version = EV_CURRENT;
- if (Config->EntrySym)
+ if (Config->EntrySym) {
if (auto *E = dyn_cast<ELFSymbolBody<ELFT>>(Config->EntrySym->repl()))
EHdr->e_entry = getSymVA<ELFT>(*E);
+ } else if (Config->EntryAddr != uint64_t(-1)) {
+ EHdr->e_entry = Config->EntryAddr;
+ }
EHdr->e_phoff = sizeof(Elf_Ehdr);
EHdr->e_shoff = SectionHeaderOff;
EHdr->e_ehsize = sizeof(Elf_Ehdr);
OpenPOWER on IntegriCloud