[lld] r285241 - Have on addRegular forward to another. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 13:57:15 PDT 2016
Author: rafael
Date: Wed Oct 26 15:57:14 2016
New Revision: 285241
URL: http://llvm.org/viewvc/llvm-project?rev=285241&view=rev
Log:
Have on addRegular forward to another. NFC.
Another step in making it easier to create symbols without an ELf_Sym.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=285241&r1=285240&r2=285241&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Oct 26 15:57:14 2016
@@ -374,14 +374,24 @@ void SymbolTable<ELFT>::reportDuplicate(
template <typename ELFT>
Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, const Elf_Sym &Sym,
InputSectionBase<ELFT> *Section) {
+ return addRegular(Name, Sym.st_other, Sym.getType(), Sym.st_value,
+ Sym.st_size, Sym.getBinding(), Section);
+}
+
+template <typename ELFT>
+Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t StOther,
+ uint8_t Type, uintX_t Value, uintX_t Size,
+ uint8_t Binding,
+ InputSectionBase<ELFT> *Section) {
Symbol *S;
bool WasInserted;
- std::tie(S, WasInserted) = insert(Name, Sym.getType(), Sym.getVisibility(),
+ std::tie(S, WasInserted) = insert(Name, Type, StOther & 3,
/*CanOmitFromDynSym*/ false,
Section ? Section->getFile() : nullptr);
- int Cmp = compareDefinedNonCommon(S, WasInserted, Sym.getBinding());
+ int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
if (Cmp > 0)
- replaceBody<DefinedRegular<ELFT>>(S, Name, Sym, Section);
+ replaceBody<DefinedRegular<ELFT>>(S, Name, StOther, Type, Value, Size,
+ Section);
else if (Cmp == 0)
reportDuplicate(S->body(), Section->getFile());
return S;
@@ -390,16 +400,7 @@ Symbol *SymbolTable<ELFT>::addRegular(St
template <typename ELFT>
Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t Binding,
uint8_t StOther) {
- Symbol *S;
- bool WasInserted;
- std::tie(S, WasInserted) = insert(Name, STT_NOTYPE, StOther & 3,
- /*CanOmitFromDynSym*/ false, nullptr);
- int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
- if (Cmp > 0)
- replaceBody<DefinedRegular<ELFT>>(S, Name, StOther);
- else if (Cmp == 0)
- reportDuplicate(S->body(), nullptr);
- return S;
+ return addRegular(Name, StOther, STT_NOTYPE, 0, 0, Binding, nullptr);
}
template <typename ELFT>
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=285241&r1=285240&r2=285241&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Wed Oct 26 15:57:14 2016
@@ -63,6 +63,10 @@ public:
Symbol *addUndefined(StringRef Name, uint8_t Binding, uint8_t StOther,
uint8_t Type, bool CanOmitFromDynSym, InputFile *File);
+ 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 Binding, uint8_t StOther);
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=285241&r1=285240&r2=285241&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed Oct 26 15:57:14 2016
@@ -194,16 +194,11 @@ public:
this->File = File;
}
- DefinedRegular(StringRef Name, const Elf_Sym &Sym,
- InputSectionBase<ELFT> *Section)
- : DefinedRegular(Name, Sym.st_other, Sym.getType(), Sym.st_value,
- Sym.st_size, Section,
+ DefinedRegular(StringRef Name, uint8_t StOther, uint8_t Type, uintX_t Value,
+ uintX_t Size, InputSectionBase<ELFT> *Section)
+ : DefinedRegular(Name, StOther, Type, Value, Size, Section,
Section ? Section->getFile() : nullptr) {}
- DefinedRegular(StringRef Name, uint8_t StOther)
- : DefinedRegular(Name, StOther, llvm::ELF::STT_NOTYPE, 0, 0,
- NullInputSection, nullptr) {}
-
DefinedRegular(StringRef Name, uint8_t StOther, uint8_t Type, BitcodeFile *F)
: DefinedRegular(Name, StOther, Type, 0, 0, NullInputSection, F) {}
More information about the llvm-commits
mailing list