summaryrefslogtreecommitdiffstats
path: root/lld/ELF/OutputSections.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2016-04-02 18:06:18 +0000
committerRui Ueyama <ruiu@google.com>2016-04-02 18:06:18 +0000
commitbfc1d9d976f653c2695aa12e656ae1ae94795dac (patch)
tree93e020e732debe7f6a70bbe8d16e47a49b1288df /lld/ELF/OutputSections.cpp
parent6d72d166dc0b67418bd334886e29a0a2bf541a92 (diff)
downloadbcm5719-llvm-bfc1d9d976f653c2695aa12e656ae1ae94795dac.tar.gz
bcm5719-llvm-bfc1d9d976f653c2695aa12e656ae1ae94795dac.zip
Remove DefinedElf class.
DefinedElf was a superclass of DefinedRegular and SharedSymbol classes and represented the notion of defined symbols created for ELF symbols. It turned out that we didn't use that class often. We had only two occurrences of dyn_cast'ing to DefinedElf, and both were easily rewritten without it. The class was also a bit confusing. The concept of "created for ELF symbol" is orthogonal to defined/undefined types. However, we had two distinct classes, DefinedElf and UndefinedElf. This patch simply removes the class. Now the class hierarchy is one level shallower. llvm-svn: 265234
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
-rw-r--r--lld/ELF/OutputSections.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index bf693b78a97..c8acbb9e902 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -1451,15 +1451,6 @@ void SymbolTableSection<ELFT>::writeLocalSymbols(uint8_t *&Buf) {
}
template <class ELFT>
-static const typename ELFT::Sym *getElfSym(SymbolBody &Body) {
- if (auto *EBody = dyn_cast<DefinedElf<ELFT>>(&Body))
- return &EBody->Sym;
- if (auto *EBody = dyn_cast<UndefinedElf<ELFT>>(&Body))
- return &EBody->Sym;
- return nullptr;
-}
-
-template <class ELFT>
void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
// Write the internal symbol table contents to the output symbol table
// pointed by Buf.
@@ -1470,7 +1461,7 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
uint8_t Type = STT_NOTYPE;
uintX_t Size = 0;
- if (const Elf_Sym *InputSym = getElfSym<ELFT>(*Body)) {
+ if (const Elf_Sym *InputSym = Body->getElfSym<ELFT>()) {
Type = InputSym->getType();
Size = InputSym->st_size;
} else if (auto *C = dyn_cast<DefinedCommon>(Body)) {
@@ -1533,7 +1524,7 @@ uint8_t SymbolTableSection<ELFT>::getSymbolBinding(SymbolBody *Body) {
uint8_t Visibility = Body->getVisibility();
if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED)
return STB_LOCAL;
- if (const Elf_Sym *ESym = getElfSym<ELFT>(*Body))
+ if (const Elf_Sym *ESym = Body->getElfSym<ELFT>())
return ESym->getBinding();
if (isa<DefinedSynthetic<ELFT>>(Body))
return STB_LOCAL;
OpenPOWER on IntegriCloud