summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2017-10-18 08:36:47 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2017-10-18 08:36:47 +0000
commita4ca931336adb72a10b41d10f82df2e9345c67a7 (patch)
tree7429dd5af72ec47ee0de83805d63dd8a9a3cbafc
parent72a6f893cb0eb4ebb94a6f893aa9244e49a58d5f (diff)
downloadbcm5719-llvm-a4ca931336adb72a10b41d10f82df2e9345c67a7.tar.gz
bcm5719-llvm-a4ca931336adb72a10b41d10f82df2e9345c67a7.zip
[ELF] - Remove excessive helper. NFC.
Removes addRegular() helper that looks excessive from Writer.cpp. Differential revision: https://reviews.llvm.org/D39006 llvm-svn: 316068
-rw-r--r--lld/ELF/Writer.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 52490d054d5..b368007c236 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -726,17 +726,6 @@ void PhdrEntry::add(OutputSection *Sec) {
}
template <class ELFT>
-static Symbol *addRegular(StringRef Name, SectionBase *Sec, uint64_t Value,
- uint8_t StOther = STV_HIDDEN,
- uint8_t Binding = STB_WEAK) {
- // The linker generated symbols are added as STB_WEAK to allow user defined
- // ones to override them.
- return Symtab->addRegular<ELFT>(Name, StOther, STT_NOTYPE, Value,
- /*Size=*/0, Binding, Sec,
- /*File=*/nullptr);
-}
-
-template <class ELFT>
static DefinedRegular *
addOptionalRegular(StringRef Name, SectionBase *Sec, uint64_t Val,
uint8_t StOther = STV_HIDDEN, uint8_t Binding = STB_GLOBAL) {
@@ -745,8 +734,10 @@ addOptionalRegular(StringRef Name, SectionBase *Sec, uint64_t Val,
return nullptr;
if (S->isInCurrentDSO())
return nullptr;
- return cast<DefinedRegular>(
- addRegular<ELFT>(Name, Sec, Val, StOther, Binding)->body());
+ Symbol *Sym = Symtab->addRegular<ELFT>(Name, StOther, STT_NOTYPE, Val,
+ /*Size=*/0, Binding, Sec,
+ /*File=*/nullptr);
+ return cast<DefinedRegular>(Sym->body());
}
// The beginning and the ending of .rel[a].plt section are marked
@@ -1251,7 +1242,9 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// Even the author of gold doesn't remember why gold behaves that way.
// https://sourceware.org/ml/binutils/2002-03/msg00360.html
if (InX::DynSymTab)
- addRegular<ELFT>("_DYNAMIC", InX::Dynamic, 0);
+ Symtab->addRegular<ELFT>("_DYNAMIC", STV_HIDDEN, STT_NOTYPE, 0 /*Value*/,
+ /*Size=*/0, STB_WEAK, InX::Dynamic,
+ /*File=*/nullptr);
// Define __rel[a]_iplt_{start,end} symbols if needed.
addRelIpltSymbols();
OpenPOWER on IntegriCloud