summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-04-15 14:41:56 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-04-15 14:41:56 +0000
commit38c67a27fe811074d39aaba6d4e9fbcc8f0640fc (patch)
tree70cf11ae2fcfa208cdd4e7e397ced9dd04b4d348
parent917fc9d7cb401f2de332738e4929e053f305e468 (diff)
downloadbcm5719-llvm-38c67a27fe811074d39aaba6d4e9fbcc8f0640fc.tar.gz
bcm5719-llvm-38c67a27fe811074d39aaba6d4e9fbcc8f0640fc.zip
Store a Symbol for EntrySym.
This makes it impossible to forget to call repl on the SymbolBody. llvm-svn: 266432
-rw-r--r--lld/ELF/Config.h4
-rw-r--r--lld/ELF/Driver.cpp2
-rw-r--r--lld/ELF/InputSection.h2
-rw-r--r--lld/ELF/MarkLive.cpp5
-rw-r--r--lld/ELF/Writer.cpp4
5 files changed, 10 insertions, 7 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 656ae33d259..fbd19a3f11f 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -20,7 +20,7 @@ namespace lld {
namespace elf {
class InputFile;
-class SymbolBody;
+struct Symbol;
enum ELFKind {
ELFNoneKind,
@@ -37,7 +37,7 @@ enum class BuildIdKind { None, Fnv1, Md5, Sha1 };
// and such fields have the same name as the corresponding options.
// Most fields are initialized by the driver.
struct Configuration {
- SymbolBody *EntrySym = nullptr;
+ Symbol *EntrySym = nullptr;
InputFile *FirstElf = nullptr;
llvm::StringRef DynamicLinker;
llvm::StringRef Entry;
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 4eb00bddc33..f8d5b10bed6 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -428,7 +428,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
// 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);
+ Config->EntrySym = Symtab.addUndefined(S)->getSymbol();
}
for (std::unique_ptr<InputFile> &F : Files)
diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h
index c50ce60a05b..3a3035f9e6a 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -18,6 +18,8 @@
namespace lld {
namespace elf {
+class SymbolBody;
+
template <class ELFT> class ICF;
template <class ELFT> class DefinedRegular;
template <class ELFT> class ObjectFile;
diff --git a/lld/ELF/MarkLive.cpp b/lld/ELF/MarkLive.cpp
index 4d0b08dc76d..ade0dceeb2c 100644
--- a/lld/ELF/MarkLive.cpp
+++ b/lld/ELF/MarkLive.cpp
@@ -99,12 +99,13 @@ template <class ELFT> void elf::markLive(SymbolTable<ELFT> *Symtab) {
auto MarkSymbol = [&](SymbolBody *Sym) {
if (Sym)
- if (auto *D = dyn_cast<DefinedRegular<ELFT>>(&Sym->repl()))
+ if (auto *D = dyn_cast<DefinedRegular<ELFT>>(Sym))
Enqueue(D->Section);
};
// Add GC root symbols.
- MarkSymbol(Config->EntrySym);
+ if (Config->EntrySym)
+ MarkSymbol(Config->EntrySym->Body);
MarkSymbol(Symtab->find(Config->Init));
MarkSymbol(Symtab->find(Config->Fini));
for (StringRef S : Config->Undefined)
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c942b5d856e..ee1d32bc1b6 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1634,8 +1634,8 @@ static uint32_t getMipsEFlags() {
}
template <class ELFT> static typename ELFT::uint getEntryAddr() {
- if (SymbolBody *B = Config->EntrySym)
- return B->repl().getVA<ELFT>();
+ if (Symbol *S = Config->EntrySym)
+ return S->Body->getVA<ELFT>();
if (Config->EntryAddr != uint64_t(-1))
return Config->EntryAddr;
return 0;
OpenPOWER on IntegriCloud