diff options
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 12 | ||||
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 4 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.cpp | 14 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.h | 6 | 
4 files changed, 14 insertions, 22 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 75f683f518b..340c98e5792 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -795,12 +795,12 @@ template <class ELFT> void BinaryFile::parse() {        make<InputSection<ELFT>>(SHF_ALLOC, SHT_PROGBITS, 8, Data, ".data");    Sections.push_back(Section); -  elf::Symtab<ELFT>::X->addRegular(StartName, STV_DEFAULT, Section, STB_GLOBAL, -                                   STT_OBJECT, 0); -  elf::Symtab<ELFT>::X->addRegular(EndName, STV_DEFAULT, Section, STB_GLOBAL, -                                   STT_OBJECT, Data.size()); -  elf::Symtab<ELFT>::X->addRegular(SizeName, STV_DEFAULT, nullptr, STB_GLOBAL, -                                   STT_OBJECT, Data.size()); +  elf::Symtab<ELFT>::X->addRegular(StartName, STV_DEFAULT, STT_OBJECT, 0, 0, +                                   STB_GLOBAL, Section); +  elf::Symtab<ELFT>::X->addRegular(EndName, STV_DEFAULT, STT_OBJECT, +                                   Data.size(), 0, STB_GLOBAL, Section); +  elf::Symtab<ELFT>::X->addRegular(SizeName, STV_DEFAULT, STT_OBJECT, +                                   Data.size(), 0, STB_GLOBAL, nullptr);  }  static bool isBitcode(MemoryBufferRef MB) { diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index e911fa5996d..3e6b8851e9d 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -64,8 +64,8 @@ ScriptConfiguration *elf::ScriptConfig;  template <class ELFT> static void addRegular(SymbolAssignment *Cmd) {    uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT; -  Symbol *Sym = Symtab<ELFT>::X->addRegular(Cmd->Name, Visibility, nullptr, -                                            STB_GLOBAL, STT_NOTYPE, 0); +  Symbol *Sym = Symtab<ELFT>::X->addRegular(Cmd->Name, Visibility, STT_NOTYPE, +                                            0, 0, STB_GLOBAL, nullptr);    Cmd->Sym = Sym->body();    // If we have no SECTIONS then we don't have '.' and don't call diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 6d55bbb1b28..d929a8fd014 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -128,8 +128,9 @@ template <class ELFT> void SymbolTable<ELFT>::addCombinedLtoObject() {  template <class ELFT>  DefinedRegular<ELFT> *SymbolTable<ELFT>::addAbsolute(StringRef Name,                                                       uint8_t Visibility) { -  return cast<DefinedRegular<ELFT>>( -      addRegular(Name, Visibility, nullptr, STB_GLOBAL, STT_NOTYPE, 0)->body()); +  Symbol *Sym = +      addRegular(Name, Visibility, STT_NOTYPE, 0, 0, STB_GLOBAL, nullptr); +  return cast<DefinedRegular<ELFT>>(Sym->body());  }  // Add Name as an "ignored" symbol. An ignored symbol is a regular @@ -157,6 +158,7 @@ template <class ELFT> void SymbolTable<ELFT>::wrap(StringRef Name) {    Symbol *Sym = B->symbol();    Symbol *Real = addUndefined(Saver.save("__real_" + Name));    Symbol *Wrap = addUndefined(Saver.save("__wrap_" + Name)); +    // We rename symbols by replacing the old symbol's SymbolBody with the new    // symbol's SymbolBody. This causes all SymbolBody pointers referring to the    // old symbol to instead refer to the new symbol. @@ -421,14 +423,6 @@ Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t StOther,  }  template <typename ELFT> -Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t StOther, -                                      InputSectionBase<ELFT> *Section, -                                      uint8_t Binding, uint8_t Type, -                                      uintX_t Value) { -  return addRegular(Name, StOther, Type, Value, 0, Binding, Section); -} - -template <typename ELFT>  Symbol *SymbolTable<ELFT>::addSynthetic(StringRef N, OutputSectionBase *Section,                                          uintX_t Value, uint8_t StOther) {    Symbol *S; diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 7683706e2b0..08e1b4e290f 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -61,14 +61,12 @@ public:    Symbol *addRegular(StringRef Name, uint8_t StOther, uint8_t Type,                       uintX_t Value, uintX_t Size, uint8_t Binding,                       InputSectionBase<ELFT> *Section); -    Symbol *addRegular(StringRef Name, const Elf_Sym &Sym,                       InputSectionBase<ELFT> *Section); -  Symbol *addRegular(StringRef Name, uint8_t StOther, -                     InputSectionBase<ELFT> *Section, uint8_t Binding, -                     uint8_t Type, uintX_t Value); +    Symbol *addSynthetic(StringRef N, OutputSectionBase *Section, uintX_t Value,                         uint8_t StOther); +    void addShared(SharedFile<ELFT> *F, StringRef Name, const Elf_Sym &Sym,                   const typename ELFT::Verdef *Verdef);  | 

