[ELF] - Make SymbolTable::addDefined return Defined.
Now it returns Symbol. This should be NFC that avoids doing cast at the caller's sides. Differential revision: https://reviews.llvm.org/D54627 llvm-svn: 347455
This commit is contained in:
parent
d9f59f8c80
commit
94a16cb611
|
@ -459,7 +459,7 @@ static void reportDuplicate(Symbol *Sym, InputFile *NewFile,
|
|||
error(Msg);
|
||||
}
|
||||
|
||||
Symbol *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type,
|
||||
Defined *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type,
|
||||
uint64_t Value, uint64_t Size, uint8_t Binding,
|
||||
SectionBase *Section, InputFile *File) {
|
||||
Symbol *S;
|
||||
|
@ -474,7 +474,7 @@ Symbol *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type,
|
|||
else if (Cmp == 0)
|
||||
reportDuplicate(S, File, dyn_cast_or_null<InputSectionBase>(Section),
|
||||
Value);
|
||||
return S;
|
||||
return cast<Defined>(S);
|
||||
}
|
||||
|
||||
template <typename ELFT>
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
Symbol *addUndefined(StringRef Name, uint8_t Binding, uint8_t StOther,
|
||||
uint8_t Type, bool CanOmitFromDynSym, InputFile *File);
|
||||
|
||||
Symbol *addDefined(StringRef Name, uint8_t StOther, uint8_t Type,
|
||||
Defined *addDefined(StringRef Name, uint8_t StOther, uint8_t Type,
|
||||
uint64_t Value, uint64_t Size, uint8_t Binding,
|
||||
SectionBase *Section, InputFile *File);
|
||||
|
||||
|
|
|
@ -172,15 +172,14 @@ static Defined *addOptionalRegular(StringRef Name, SectionBase *Sec,
|
|||
Symbol *S = Symtab->find(Name);
|
||||
if (!S || S->isDefined())
|
||||
return nullptr;
|
||||
Symbol *Sym = Symtab->addDefined(Name, StOther, STT_NOTYPE, Val,
|
||||
return Symtab->addDefined(Name, StOther, STT_NOTYPE, Val,
|
||||
/*Size=*/0, Binding, Sec,
|
||||
/*File=*/nullptr);
|
||||
return cast<Defined>(Sym);
|
||||
}
|
||||
|
||||
static Defined *addAbsolute(StringRef Name) {
|
||||
return cast<Defined>(Symtab->addDefined(Name, STV_HIDDEN, STT_NOTYPE, 0, 0,
|
||||
STB_GLOBAL, nullptr, nullptr));
|
||||
return Symtab->addDefined(Name, STV_HIDDEN, STT_NOTYPE, 0, 0, STB_GLOBAL,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
|
||||
// The linker is expected to define some symbols depending on
|
||||
|
|
Loading…
Reference in New Issue