ELF2: Inititalize other symbols only once as well.

llvm-svn: 249645
This commit is contained in:
Rui Ueyama 2015-10-08 00:44:28 +00:00
parent b7fca57493
commit aca48ffb41
2 changed files with 10 additions and 6 deletions

View File

@ -105,8 +105,6 @@ void SymbolTable::addSyntheticSym(StringRef Name, OutputSection<ELFT> &Section,
}
template <class ELFT> void SymbolTable::addIgnoredSym(StringRef Name) {
DefinedAbsolute<ELFT>::IgnoreUndef.setBinding(STB_WEAK);
DefinedAbsolute<ELFT>::IgnoreUndef.setVisibility(STV_HIDDEN);
auto Sym = new (Alloc)
DefinedAbsolute<ELFT>(Name, DefinedAbsolute<ELFT>::IgnoreUndef);
resolve<ELFT>(Sym);

View File

@ -86,11 +86,17 @@ std::unique_ptr<InputFile> Lazy::getMember() {
return createELFFile<ObjectFile>(MBRef);
}
template <class ELFT> static void doInitSymbols() {
DefinedAbsolute<ELFT>::IgnoreUndef.setBinding(STB_WEAK);
DefinedAbsolute<ELFT>::IgnoreUndef.setVisibility(STV_HIDDEN);
Undefined<ELFT>::Optional.setVisibility(STV_HIDDEN);
}
void lld::elf2::initSymbols() {
Undefined<ELF32LE>::Optional.setVisibility(STV_HIDDEN);
Undefined<ELF32BE>::Optional.setVisibility(STV_HIDDEN);
Undefined<ELF64LE>::Optional.setVisibility(STV_HIDDEN);
Undefined<ELF64BE>::Optional.setVisibility(STV_HIDDEN);
doInitSymbols<ELF32LE>();
doInitSymbols<ELF32BE>();
doInitSymbols<ELF64LE>();
doInitSymbols<ELF64BE>();
}
template int SymbolBody::compare<ELF32LE>(SymbolBody *Other);