[lld] c7231e4 - [ELF] Use invokeOnRelocs. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 27 10:58:31 PDT 2024


Author: Fangrui Song
Date: 2024-07-27T10:58:27-07:00
New Revision: c7231e49099d56fdc5b2207142184a0bf2544ec1

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

LOG: [ELF] Use invokeOnRelocs. NFC

Added: 
    

Modified: 
    lld/ELF/InputSection.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 306872f164f6f..7857d857488c0 100644
--- a/lld/ELF/InputSection.cpp
+++ b/lld/ELF/InputSection.cpp
@@ -1073,11 +1073,7 @@ void InputSectionBase::relocate(uint8_t *buf, uint8_t *bufEnd) {
   auto *sec = cast<InputSection>(this);
   // For a relocatable link, also call relocateNonAlloc() to rewrite applicable
   // locations with tombstone values.
-  const RelsOrRelas<ELFT> rels = sec->template relsOrRelas<ELFT>();
-  if (rels.areRelocsRel())
-    sec->relocateNonAlloc<ELFT>(buf, rels.rels);
-  else
-    sec->relocateNonAlloc<ELFT>(buf, rels.relas);
+  invokeOnRelocs(*sec, sec->relocateNonAlloc<ELFT>, buf);
 }
 
 // For each function-defining prologue, find any calls to __morestack,


        


More information about the llvm-commits mailing list