[llvm-branch-commits] [lld] 5d9f460 - [ELF] Use invokeOnRelocs. NFC

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jul 29 01:06:58 PDT 2024


Author: Fangrui Song
Date: 2024-07-29T10:06:37+02:00
New Revision: 5d9f4600865ca5d734a73f540136402462deac91

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

LOG: [ELF] Use invokeOnRelocs. NFC

(cherry picked from commit c7231e49099d56fdc5b2207142184a0bf2544ec1)

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-branch-commits mailing list