forked from OSchip/llvm-project
ELF: Drop 'Sym' suffix from member function names for consistency.
Since the functions are members of SymbolTable class, it is obvious that they are adding symbols. llvm-svn: 255832
This commit is contained in:
parent
b94ab5ffbd
commit
dd7d998919
|
@ -260,7 +260,7 @@ template <class ELFT> 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 <class ELFT> 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<ELFT>::MipsGp);
|
||||
Symtab.addAbsolute("_gp", DefinedAbsolute<ELFT>::MipsGp);
|
||||
}
|
||||
|
||||
for (std::unique_ptr<InputFile> &F : Files)
|
||||
|
|
|
@ -71,15 +71,15 @@ SymbolBody *SymbolTable<ELFT>::addUndefinedOpt(StringRef Name) {
|
|||
}
|
||||
|
||||
template <class ELFT>
|
||||
void SymbolTable<ELFT>::addAbsoluteSym(StringRef Name,
|
||||
typename ELFFile<ELFT>::Elf_Sym &ESym) {
|
||||
void SymbolTable<ELFT>::addAbsolute(StringRef Name,
|
||||
typename ELFFile<ELFT>::Elf_Sym &ESym) {
|
||||
resolve(new (Alloc) DefinedAbsolute<ELFT>(Name, ESym));
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
void SymbolTable<ELFT>::addSyntheticSym(StringRef Name,
|
||||
OutputSectionBase<ELFT> &Section,
|
||||
typename ELFFile<ELFT>::uintX_t Value) {
|
||||
void SymbolTable<ELFT>::addSynthetic(StringRef Name,
|
||||
OutputSectionBase<ELFT> &Section,
|
||||
typename ELFFile<ELFT>::uintX_t Value) {
|
||||
typedef typename DefinedSynthetic<ELFT>::Elf_Sym Elf_Sym;
|
||||
auto ESym = new (Alloc) Elf_Sym;
|
||||
memset(ESym, 0, sizeof(Elf_Sym));
|
||||
|
@ -89,7 +89,7 @@ void SymbolTable<ELFT>::addSyntheticSym(StringRef Name,
|
|||
}
|
||||
|
||||
template <class ELFT>
|
||||
SymbolBody *SymbolTable<ELFT>::addIgnoredSym(StringRef Name) {
|
||||
SymbolBody *SymbolTable<ELFT>::addIgnored(StringRef Name) {
|
||||
auto Sym = new (Alloc)
|
||||
DefinedAbsolute<ELFT>(Name, DefinedAbsolute<ELFT>::IgnoreUndef);
|
||||
resolve(Sym);
|
||||
|
|
|
@ -50,11 +50,11 @@ public:
|
|||
|
||||
SymbolBody *addUndefined(StringRef Name);
|
||||
SymbolBody *addUndefinedOpt(StringRef Name);
|
||||
void addAbsoluteSym(StringRef Name,
|
||||
typename llvm::object::ELFFile<ELFT>::Elf_Sym &ESym);
|
||||
void addSyntheticSym(StringRef Name, OutputSectionBase<ELFT> &Section,
|
||||
typename llvm::object::ELFFile<ELFT>::uintX_t Value);
|
||||
SymbolBody *addIgnoredSym(StringRef Name);
|
||||
void addAbsolute(StringRef Name,
|
||||
typename llvm::object::ELFFile<ELFT>::Elf_Sym &ESym);
|
||||
void addSynthetic(StringRef Name, OutputSectionBase<ELFT> &Section,
|
||||
typename llvm::object::ELFFile<ELFT>::uintX_t Value);
|
||||
SymbolBody *addIgnored(StringRef Name);
|
||||
bool isUndefined(StringRef Name);
|
||||
void scanShlibUndefined();
|
||||
SymbolBody *find(StringRef Name);
|
||||
|
|
|
@ -640,11 +640,11 @@ template <class ELFT> void Writer<ELFT>::createSections() {
|
|||
auto AddStartEnd = [&](StringRef Start, StringRef End,
|
||||
OutputSectionBase<ELFT> *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 <class ELFT> void Writer<ELFT>::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 <class ELFT> void Writer<ELFT>::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<ELFT>::End);
|
||||
Symtab.addAbsolute("_end", DefinedAbsolute<ELFT>::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<ELFT>::End);
|
||||
Symtab.addAbsolute("end", DefinedAbsolute<ELFT>::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<ELFT>::addStartStopSymbols(OutputSectionBase<ELFT> *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 <class ELFT> static bool needsPhdr(OutputSectionBase<ELFT> *Sec) {
|
||||
|
|
Loading…
Reference in New Issue