diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index a109320f8258..8ac35d66934e 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -260,7 +260,7 @@ template void LinkerDriver::link(opt::InputArgList &Args) { // an undefined symbol in the .o files. // Given that the symbol is effectively unused, we just create a dummy // hidden one to avoid the undefined symbol error. - Symtab.addIgnoredSym("_GLOBAL_OFFSET_TABLE_"); + Symtab.addIgnored("_GLOBAL_OFFSET_TABLE_"); } if (!Config->Entry.empty()) { @@ -273,13 +273,13 @@ template void LinkerDriver::link(opt::InputArgList &Args) { if (Config->EMachine == EM_MIPS) { // On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between // start of function and gp pointer into GOT. - Config->MipsGpDisp = Symtab.addIgnoredSym("_gp_disp"); + Config->MipsGpDisp = Symtab.addIgnored("_gp_disp"); // Define _gp for MIPS. st_value of _gp symbol will be updated by Writer // so that it points to an absolute address which is relative to GOT. // See "Global Data Symbols" in Chapter 6 in the following document: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf - Symtab.addAbsoluteSym("_gp", DefinedAbsolute::MipsGp); + Symtab.addAbsolute("_gp", DefinedAbsolute::MipsGp); } for (std::unique_ptr &F : Files) diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index f69aaa5460ba..526f8e39db7f 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -71,15 +71,15 @@ SymbolBody *SymbolTable::addUndefinedOpt(StringRef Name) { } template -void SymbolTable::addAbsoluteSym(StringRef Name, - typename ELFFile::Elf_Sym &ESym) { +void SymbolTable::addAbsolute(StringRef Name, + typename ELFFile::Elf_Sym &ESym) { resolve(new (Alloc) DefinedAbsolute(Name, ESym)); } template -void SymbolTable::addSyntheticSym(StringRef Name, - OutputSectionBase &Section, - typename ELFFile::uintX_t Value) { +void SymbolTable::addSynthetic(StringRef Name, + OutputSectionBase &Section, + typename ELFFile::uintX_t Value) { typedef typename DefinedSynthetic::Elf_Sym Elf_Sym; auto ESym = new (Alloc) Elf_Sym; memset(ESym, 0, sizeof(Elf_Sym)); @@ -89,7 +89,7 @@ void SymbolTable::addSyntheticSym(StringRef Name, } template -SymbolBody *SymbolTable::addIgnoredSym(StringRef Name) { +SymbolBody *SymbolTable::addIgnored(StringRef Name) { auto Sym = new (Alloc) DefinedAbsolute(Name, DefinedAbsolute::IgnoreUndef); resolve(Sym); diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index e36ed4e8fbba..fbc1d27072d1 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -50,11 +50,11 @@ public: SymbolBody *addUndefined(StringRef Name); SymbolBody *addUndefinedOpt(StringRef Name); - void addAbsoluteSym(StringRef Name, - typename llvm::object::ELFFile::Elf_Sym &ESym); - void addSyntheticSym(StringRef Name, OutputSectionBase &Section, - typename llvm::object::ELFFile::uintX_t Value); - SymbolBody *addIgnoredSym(StringRef Name); + void addAbsolute(StringRef Name, + typename llvm::object::ELFFile::Elf_Sym &ESym); + void addSynthetic(StringRef Name, OutputSectionBase &Section, + typename llvm::object::ELFFile::uintX_t Value); + SymbolBody *addIgnored(StringRef Name); bool isUndefined(StringRef Name); void scanShlibUndefined(); SymbolBody *find(StringRef Name); diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 27553a322064..42c5e779384b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -640,11 +640,11 @@ template void Writer::createSections() { auto AddStartEnd = [&](StringRef Start, StringRef End, OutputSectionBase *OS) { if (OS) { - Symtab.addSyntheticSym(Start, *OS, 0); - Symtab.addSyntheticSym(End, *OS, OS->getSize()); + Symtab.addSynthetic(Start, *OS, 0); + Symtab.addSynthetic(End, *OS, OS->getSize()); } else { - Symtab.addIgnoredSym(Start); - Symtab.addIgnoredSym(End); + Symtab.addIgnored(Start); + Symtab.addIgnored(End); } }; @@ -663,7 +663,7 @@ template void Writer::createSections() { // __tls_get_addr, so it's not defined anywhere. Create a hidden definition // to avoid the undefined symbol error. if (!isOutputDynamic()) - Symtab.addIgnoredSym("__tls_get_addr"); + Symtab.addIgnored("__tls_get_addr"); // If the "_end" symbol is referenced, it is expected to point to the address // right after the data segment. Usually, this symbol points to the end @@ -673,14 +673,14 @@ template void Writer::createSections() { // So, if this symbol is referenced, we just add the placeholder here // and update its value later. if (Symtab.find("_end")) - Symtab.addAbsoluteSym("_end", DefinedAbsolute::End); + Symtab.addAbsolute("_end", DefinedAbsolute::End); // If there is an undefined symbol "end", we should initialize it // with the same value as "_end". In any other case it should stay intact, // because it is an allowable name for a user symbol. if (SymbolBody *B = Symtab.find("end")) if (B->isUndefined()) - Symtab.addAbsoluteSym("end", DefinedAbsolute::End); + Symtab.addAbsolute("end", DefinedAbsolute::End); // Scan relocations. This must be done after every symbol is declared so that // we can correctly decide if a dynamic relocation is needed. @@ -819,9 +819,9 @@ void Writer::addStartStopSymbols(OutputSectionBase *Sec) { StringRef Start = Saver.save("__start_" + S); StringRef Stop = Saver.save("__stop_" + S); if (Symtab.isUndefined(Start)) - Symtab.addSyntheticSym(Start, *Sec, 0); + Symtab.addSynthetic(Start, *Sec, 0); if (Symtab.isUndefined(Stop)) - Symtab.addSyntheticSym(Stop, *Sec, Sec->getSize()); + Symtab.addSynthetic(Stop, *Sec, Sec->getSize()); } template static bool needsPhdr(OutputSectionBase *Sec) {