Remove an overloaded function to simplify.

This version of addRegular is almost identical to the other except
it lacked "size" parameter.

llvm-svn: 286416
This commit is contained in:
Rui Ueyama 2016-11-09 23:37:40 +00:00
parent 38a666d6e5
commit 1bdaf3e30c
4 changed files with 14 additions and 22 deletions

View File

@ -795,12 +795,12 @@ template <class ELFT> void BinaryFile::parse() {
make<InputSection<ELFT>>(SHF_ALLOC, SHT_PROGBITS, 8, Data, ".data"); make<InputSection<ELFT>>(SHF_ALLOC, SHT_PROGBITS, 8, Data, ".data");
Sections.push_back(Section); Sections.push_back(Section);
elf::Symtab<ELFT>::X->addRegular(StartName, STV_DEFAULT, Section, STB_GLOBAL, elf::Symtab<ELFT>::X->addRegular(StartName, STV_DEFAULT, STT_OBJECT, 0, 0,
STT_OBJECT, 0); STB_GLOBAL, Section);
elf::Symtab<ELFT>::X->addRegular(EndName, STV_DEFAULT, Section, STB_GLOBAL, elf::Symtab<ELFT>::X->addRegular(EndName, STV_DEFAULT, STT_OBJECT,
STT_OBJECT, Data.size()); Data.size(), 0, STB_GLOBAL, Section);
elf::Symtab<ELFT>::X->addRegular(SizeName, STV_DEFAULT, nullptr, STB_GLOBAL, elf::Symtab<ELFT>::X->addRegular(SizeName, STV_DEFAULT, STT_OBJECT,
STT_OBJECT, Data.size()); Data.size(), 0, STB_GLOBAL, nullptr);
} }
static bool isBitcode(MemoryBufferRef MB) { static bool isBitcode(MemoryBufferRef MB) {

View File

@ -64,8 +64,8 @@ ScriptConfiguration *elf::ScriptConfig;
template <class ELFT> static void addRegular(SymbolAssignment *Cmd) { template <class ELFT> static void addRegular(SymbolAssignment *Cmd) {
uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT; uint8_t Visibility = Cmd->Hidden ? STV_HIDDEN : STV_DEFAULT;
Symbol *Sym = Symtab<ELFT>::X->addRegular(Cmd->Name, Visibility, nullptr, Symbol *Sym = Symtab<ELFT>::X->addRegular(Cmd->Name, Visibility, STT_NOTYPE,
STB_GLOBAL, STT_NOTYPE, 0); 0, 0, STB_GLOBAL, nullptr);
Cmd->Sym = Sym->body(); Cmd->Sym = Sym->body();
// If we have no SECTIONS then we don't have '.' and don't call // If we have no SECTIONS then we don't have '.' and don't call

View File

@ -128,8 +128,9 @@ template <class ELFT> void SymbolTable<ELFT>::addCombinedLtoObject() {
template <class ELFT> template <class ELFT>
DefinedRegular<ELFT> *SymbolTable<ELFT>::addAbsolute(StringRef Name, DefinedRegular<ELFT> *SymbolTable<ELFT>::addAbsolute(StringRef Name,
uint8_t Visibility) { uint8_t Visibility) {
return cast<DefinedRegular<ELFT>>( Symbol *Sym =
addRegular(Name, Visibility, nullptr, STB_GLOBAL, STT_NOTYPE, 0)->body()); 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 // 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 *Sym = B->symbol();
Symbol *Real = addUndefined(Saver.save("__real_" + Name)); Symbol *Real = addUndefined(Saver.save("__real_" + Name));
Symbol *Wrap = addUndefined(Saver.save("__wrap_" + Name)); Symbol *Wrap = addUndefined(Saver.save("__wrap_" + Name));
// We rename symbols by replacing the old symbol's SymbolBody with the new // We rename symbols by replacing the old symbol's SymbolBody with the new
// symbol's SymbolBody. This causes all SymbolBody pointers referring to the // symbol's SymbolBody. This causes all SymbolBody pointers referring to the
// old symbol to instead refer to the new symbol. // old symbol to instead refer to the new symbol.
@ -420,14 +422,6 @@ Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t StOther,
return S; return S;
} }
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> template <typename ELFT>
Symbol *SymbolTable<ELFT>::addSynthetic(StringRef N, OutputSectionBase *Section, Symbol *SymbolTable<ELFT>::addSynthetic(StringRef N, OutputSectionBase *Section,
uintX_t Value, uint8_t StOther) { uintX_t Value, uint8_t StOther) {

View File

@ -61,14 +61,12 @@ public:
Symbol *addRegular(StringRef Name, uint8_t StOther, uint8_t Type, Symbol *addRegular(StringRef Name, uint8_t StOther, uint8_t Type,
uintX_t Value, uintX_t Size, uint8_t Binding, uintX_t Value, uintX_t Size, uint8_t Binding,
InputSectionBase<ELFT> *Section); InputSectionBase<ELFT> *Section);
Symbol *addRegular(StringRef Name, const Elf_Sym &Sym, Symbol *addRegular(StringRef Name, const Elf_Sym &Sym,
InputSectionBase<ELFT> *Section); 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, Symbol *addSynthetic(StringRef N, OutputSectionBase *Section, uintX_t Value,
uint8_t StOther); uint8_t StOther);
void addShared(SharedFile<ELFT> *F, StringRef Name, const Elf_Sym &Sym, void addShared(SharedFile<ELFT> *F, StringRef Name, const Elf_Sym &Sym,
const typename ELFT::Verdef *Verdef); const typename ELFT::Verdef *Verdef);