[lld] r316068 - [ELF] - Remove excessive helper. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 01:36:47 PDT 2017
Author: grimar
Date: Wed Oct 18 01:36:47 2017
New Revision: 316068
URL: http://llvm.org/viewvc/llvm-project?rev=316068&view=rev
Log:
[ELF] - Remove excessive helper. NFC.
Removes addRegular() helper that looks excessive from Writer.cpp.
Differential revision: https://reviews.llvm.org/D39006
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=316068&r1=316067&r2=316068&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Oct 18 01:36:47 2017
@@ -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, Secti
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>:
// 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();
More information about the llvm-commits
mailing list