[lld] r356331 - [ELF] De-virtualize findOrphanPos, excludeLibs and handleARMTlsRelocation

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 06:53:42 PDT 2019


Author: maskray
Date: Sun Mar 17 06:53:42 2019
New Revision: 356331

URL: http://llvm.org/viewvc/llvm-project?rev=356331&view=rev
Log:
[ELF] De-virtualize findOrphanPos, excludeLibs and handleARMTlsRelocation

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=356331&r1=356330&r2=356331&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Sun Mar 17 06:53:42 2019
@@ -1235,7 +1235,6 @@ static DenseSet<StringRef> getExcludeLib
 // A special library name "ALL" means all archive files.
 //
 // This is not a popular option, but some programs such as bionic libc use it.
-template <class ELFT>
 static void excludeLibs(opt::InputArgList &Args) {
   DenseSet<StringRef> Libs = getExcludeLibs(Args);
   bool All = Libs.count("ALL");
@@ -1555,7 +1554,7 @@ template <class ELFT> void LinkerDriver:
 
   // Handle the -exclude-libs option.
   if (Args.hasArg(OPT_exclude_libs))
-    excludeLibs<ELFT>(Args);
+    excludeLibs(Args);
 
   // Create ElfHeader early. We need a dummy section in
   // addReservedSymbols to mark the created symbols as not absolute.

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=356331&r1=356330&r2=356331&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Sun Mar 17 06:53:42 2019
@@ -161,7 +161,6 @@ static unsigned handleMipsTlsRelocation(
 // The pair of GOT entries created are of the form
 // GOT[e0] Module Index (Used to find pointer to TLS block at run-time)
 // GOT[e1] Offset of symbol in TLS block
-template <class ELFT>
 static unsigned handleARMTlsRelocation(RelType Type, Symbol &Sym,
                                        InputSectionBase &C, uint64_t Offset,
                                        int64_t Addend, RelExpr Expr) {
@@ -214,7 +213,7 @@ handleTlsRelocation(RelType Type, Symbol
     return 0;
 
   if (Config->EMachine == EM_ARM)
-    return handleARMTlsRelocation<ELFT>(Type, Sym, C, Offset, Addend, Expr);
+    return handleARMTlsRelocation(Type, Sym, C, Offset, Addend, Expr);
   if (Config->EMachine == EM_MIPS)
     return handleMipsTlsRelocation(Type, Sym, C, Offset, Addend, Expr);
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=356331&r1=356330&r2=356331&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sun Mar 17 06:53:42 2019
@@ -1042,7 +1042,6 @@ static bool shouldSkip(BaseCommand *Cmd)
 // We want to place orphan sections so that they share as much
 // characteristics with their neighbors as possible. For example, if
 // both are rw, or both are tls.
-template <typename ELFT>
 static std::vector<BaseCommand *>::iterator
 findOrphanPos(std::vector<BaseCommand *>::iterator B,
               std::vector<BaseCommand *>::iterator E) {
@@ -1367,7 +1366,7 @@ template <class ELFT> void Writer<ELFT>:
   I = FirstSectionOrDotAssignment;
 
   while (NonScriptI != E) {
-    auto Pos = findOrphanPos<ELFT>(I, NonScriptI);
+    auto Pos = findOrphanPos(I, NonScriptI);
     OutputSection *Orphan = cast<OutputSection>(*NonScriptI);
 
     // As an optimization, find all sections with the same sort rank




More information about the llvm-commits mailing list