summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-10-11 22:15:41 +0000
committerRui Ueyama <ruiu@google.com>2018-10-11 22:15:41 +0000
commitb0d8502049cb32f22c7cc0f311a717e785d021d5 (patch)
tree9d213f6388d40b7544aa08abcde2b0839f4e127b
parent6323fb3d7f9aa7a79cc9f3a4f57fc6622da8f457 (diff)
downloadbcm5719-llvm-b0d8502049cb32f22c7cc0f311a717e785d021d5.tar.gz
bcm5719-llvm-b0d8502049cb32f22c7cc0f311a717e785d021d5.zip
Remove SymbolTable::addAbsolute().
addAbsolute() could be implemented as a non-member function. llvm-svn: 344305
-rw-r--r--lld/ELF/SymbolTable.cpp7
-rw-r--r--lld/ELF/SymbolTable.h2
-rw-r--r--lld/ELF/Writer.cpp13
3 files changed, 8 insertions, 14 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 9bf0ad36b8f..38d0edcbdd6 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -139,13 +139,6 @@ template <class ELFT> void SymbolTable::addCombinedLTOObject() {
}
}
-Defined *SymbolTable::addAbsolute(StringRef Name, uint8_t Visibility,
- uint8_t Binding) {
- Symbol *Sym =
- addDefined(Name, Visibility, STT_NOTYPE, 0, 0, Binding, nullptr, nullptr);
- return cast<Defined>(Sym);
-}
-
// Set a flag for --trace-symbol so that we can print out a log message
// if a new symbol with the same name is inserted into the symbol table.
void SymbolTable::trace(StringRef Name) {
diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index 69d923ecc0d..fbf2fd8f345 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -41,8 +41,6 @@ public:
ArrayRef<Symbol *> getSymbols() const { return SymVector; }
- Defined *addAbsolute(StringRef Name, uint8_t Visibility, uint8_t Binding);
-
template <class ELFT>
Symbol *addUndefined(StringRef Name, uint8_t Binding, uint8_t StOther,
uint8_t Type, bool CanOmitFromDynSym, InputFile *File);
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index ac3497045d8..b240088c4f3 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -180,26 +180,29 @@ static Defined *addOptionalRegular(StringRef Name, SectionBase *Sec,
// the linking result. This function defines such symbols.
void elf::addReservedSymbols() {
if (Config->EMachine == EM_MIPS) {
+ auto Add = [](StringRef Name) {
+ return cast<Defined>(Symtab->addDefined(Name, STV_HIDDEN, STT_NOTYPE, 0,
+ 0, STB_GLOBAL, nullptr, nullptr));
+ };
+
// Define _gp for MIPS. st_value of _gp symbol will be updated by Writer
// so that it points to an absolute address which by default is relative
// to GOT. Default offset is 0x7ff0.
// See "Global Data Symbols" in Chapter 6 in the following document:
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
- ElfSym::MipsGp = Symtab->addAbsolute("_gp", STV_HIDDEN, STB_GLOBAL);
+ ElfSym::MipsGp = Add("_gp");
// On MIPS O32 ABI, _gp_disp is a magic symbol designates offset between
// start of function and 'gp' pointer into GOT.
if (Symtab->find("_gp_disp"))
- ElfSym::MipsGpDisp =
- Symtab->addAbsolute("_gp_disp", STV_HIDDEN, STB_GLOBAL);
+ ElfSym::MipsGpDisp = Add("_gp_disp");
// The __gnu_local_gp is a magic symbol equal to the current value of 'gp'
// pointer. This symbol is used in the code generated by .cpload pseudo-op
// in case of using -mno-shared option.
// https://sourceware.org/ml/binutils/2004-12/msg00094.html
if (Symtab->find("__gnu_local_gp"))
- ElfSym::MipsLocalGp =
- Symtab->addAbsolute("__gnu_local_gp", STV_HIDDEN, STB_GLOBAL);
+ ElfSym::MipsLocalGp = Add("__gnu_local_gp");
}
// The Power Architecture 64-bit v2 ABI defines a TableOfContents (TOC) which
OpenPOWER on IntegriCloud