[lld] 469144f - [ELF] De-template InputSectionBase::getEnclosingFunction

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 26 15:21:27 PST 2021


Author: Fangrui Song
Date: 2021-12-26T15:21:22-08:00
New Revision: 469144ffa37f065a6bcd00e8bd837bc943f632e3

URL: https://github.com/llvm/llvm-project/commit/469144ffa37f065a6bcd00e8bd837bc943f632e3
DIFF: https://github.com/llvm/llvm-project/commit/469144ffa37f065a6bcd00e8bd837bc943f632e3.diff

LOG: [ELF] De-template InputSectionBase::getEnclosingFunction

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp
    lld/ELF/InputSection.h

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 76a29b034146..9a2b52cf568d 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -268,7 +268,6 @@ InputSection *InputSectionBase::getLinkOrderDep() const {
 }
 
 // Find a function symbol that encloses a given location.
-template <class ELFT>
 Defined *InputSectionBase::getEnclosingFunction(uint64_t offset) {
   for (Symbol *b : file->getSymbols())
     if (Defined *d = dyn_cast<Defined>(b))
@@ -289,7 +288,7 @@ std::string InputSectionBase::getLocation(uint64_t offset) {
     return (config->outputFile + ":(" + secAndOffset).str();
 
   std::string file = toString(getFile<ELFT>());
-  if (Defined *d = getEnclosingFunction<ELFT>(offset))
+  if (Defined *d = getEnclosingFunction(offset))
     return file + ":(function " + toString(*d) + ": " + secAndOffset;
 
   return file + ":(" + secAndOffset;
@@ -1203,7 +1202,7 @@ void InputSectionBase::adjustSplitStackFunctionPrologues(uint8_t *buf,
     if (enclosingPrologueAttempted(rel.offset, prologues))
       continue;
 
-    if (Defined *f = getEnclosingFunction<ELFT>(rel.offset)) {
+    if (Defined *f = getEnclosingFunction(rel.offset)) {
       prologues.insert(f);
       if (target->adjustPrologueForCrossSplitStack(buf + f->value, end,
                                                    f->stOther))

diff  --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h
index cbb060fd2740..3bd180be7d43 100644
--- a/lld/ELF/InputSection.h
+++ b/lld/ELF/InputSection.h
@@ -178,7 +178,6 @@ class InputSectionBase : public SectionBase {
 
   // Get the function symbol that encloses this offset from within the
   // section.
-  template <class ELFT>
   Defined *getEnclosingFunction(uint64_t offset);
 
   // Returns a source location string. Used to construct an error message.


        


More information about the llvm-commits mailing list