[lld] r276774 - Add `static` to a function that is used only in one file.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 10:35:42 PDT 2016


Author: ruiu
Date: Tue Jul 26 12:35:42 2016
New Revision: 276774

URL: http://llvm.org/viewvc/llvm-project?rev=276774&view=rev
Log:
Add `static` to a function that is used only in one file.

Modified:
    lld/trunk/ELF/Writer.cpp
    lld/trunk/ELF/Writer.h

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=276774&r1=276773&r2=276774&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Jul 26 12:35:42 2016
@@ -930,7 +930,7 @@ void Writer<ELFT>::addStartStopSymbols(O
       Symtab.addSynthetic(Stop, Sec, DefinedSynthetic<ELFT>::SectionEnd);
 }
 
-template <class ELFT> bool elf::needsPtLoad(OutputSectionBase<ELFT> *Sec) {
+template <class ELFT> static bool needsPtLoad(OutputSectionBase<ELFT> *Sec) {
   if (!(Sec->getFlags() & SHF_ALLOC))
     return false;
 
@@ -982,7 +982,7 @@ std::vector<PhdrEntry<ELFT>> Writer<ELFT
     if (Sec->getFlags() & SHF_TLS)
       TlsHdr.add(Sec);
 
-    if (!needsPtLoad<ELFT>(Sec))
+    if (!needsPtLoad(Sec))
       continue;
 
     // If flags changed then we want new load segment.
@@ -1077,7 +1077,7 @@ template <class ELFT> void Writer<ELFT>:
       Alignment = std::max<uintX_t>(Alignment, Target->PageSize);
 
     // We only assign VAs to allocated sections.
-    if (needsPtLoad<ELFT>(Sec)) {
+    if (needsPtLoad(Sec)) {
       VA = alignTo(VA, Alignment);
       Sec->setVA(VA);
       VA += Sec->getSize();
@@ -1338,11 +1338,6 @@ template bool elf::isRelroSection<ELF32B
 template bool elf::isRelroSection<ELF64LE>(OutputSectionBase<ELF64LE> *);
 template bool elf::isRelroSection<ELF64BE>(OutputSectionBase<ELF64BE> *);
 
-template bool elf::needsPtLoad<ELF32LE>(OutputSectionBase<ELF32LE> *);
-template bool elf::needsPtLoad<ELF32BE>(OutputSectionBase<ELF32BE> *);
-template bool elf::needsPtLoad<ELF64LE>(OutputSectionBase<ELF64LE> *);
-template bool elf::needsPtLoad<ELF64BE>(OutputSectionBase<ELF64BE> *);
-
 template StringRef elf::getOutputSectionName<ELF32LE>(InputSectionBase<ELF32LE> *);
 template StringRef elf::getOutputSectionName<ELF32BE>(InputSectionBase<ELF32BE> *);
 template StringRef elf::getOutputSectionName<ELF64LE>(InputSectionBase<ELF64LE> *);

Modified: lld/trunk/ELF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.h?rev=276774&r1=276773&r2=276774&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.h (original)
+++ lld/trunk/ELF/Writer.h Tue Jul 26 12:35:42 2016
@@ -27,7 +27,6 @@ template <class ELFT> void writeResult(S
 template <class ELFT> void markLive();
 template <class ELFT> bool isOutputDynamic();
 template <class ELFT> bool isRelroSection(OutputSectionBase<ELFT> *Sec);
-template <class ELFT> bool needsPtLoad(OutputSectionBase<ELFT> *Sec);
 uint32_t toPhdrFlags(uint64_t Flags);
 
 // This describes a program header entry.




More information about the llvm-commits mailing list