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");
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) {

View File

@ -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

View File

@ -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.
@ -420,14 +422,6 @@ Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t StOther,
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>
Symbol *SymbolTable<ELFT>::addSynthetic(StringRef N, OutputSectionBase *Section,
uintX_t Value, uint8_t StOther) {

View File

@ -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);