[lld] r266432 - Store a Symbol for EntrySym.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 15 07:41:57 PDT 2016
Author: rafael
Date: Fri Apr 15 09:41:56 2016
New Revision: 266432
URL: http://llvm.org/viewvc/llvm-project?rev=266432&view=rev
Log:
Store a Symbol for EntrySym.
This makes it impossible to forget to call repl on the SymbolBody.
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/InputSection.h
lld/trunk/ELF/MarkLive.cpp
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=266432&r1=266431&r2=266432&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Fri Apr 15 09:41:56 2016
@@ -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
// 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;
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=266432&r1=266431&r2=266432&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Fri Apr 15 09:41:56 2016
@@ -428,7 +428,7 @@ template <class ELFT> void LinkerDriver:
// 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)
Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=266432&r1=266431&r2=266432&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Fri Apr 15 09:41:56 2016
@@ -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;
Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=266432&r1=266431&r2=266432&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Fri Apr 15 09:41:56 2016
@@ -99,12 +99,13 @@ template <class ELFT> void elf::markLive
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)
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=266432&r1=266431&r2=266432&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Apr 15 09:41:56 2016
@@ -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;
More information about the llvm-commits
mailing list