[lld] fbcfbd9 - [NFC][ELF] Fix overzealous find/replace affecting comments

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 9 06:36:51 PST 2026


Author: Jessica Clarke
Date: 2026-02-09T14:35:50Z
New Revision: fbcfbd9d3a33d14430250ad056c7d726db41673a

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

LOG: [NFC][ELF] Fix overzealous find/replace affecting comments

Commit a94060ca0c87 ("[ELF] Pass Ctx & to Relocations") swapped the
InputSectionBase &c argument for an InputSectionBase *sec member, and so
"c." was replaced with "sec->". However, this must have done in such a
way that "Local-Exec." was transformed to "Local-Exesec->" and
"RISCV::relocateAlloc." to "RISCV::relocateAllosec->", i.e. without the
use of something like clangd, and without appropriate word boundaries in
a regex.

Added: 
    

Modified: 
    lld/ELF/Relocations.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 9ea5758eea8c2..16c2e50364e29 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1212,8 +1212,7 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
       !sec->file->ppc64DisableTLSRelax;
 
   // If we are producing an executable and the symbol is non-preemptable, it
-  // must be defined and the code sequence can be optimized to use
-  // Local-Exesec->
+  // must be defined and the code sequence can be optimized to use Local-Exec.
   //
   // ARM and RISC-V do not support any relaxations for TLS relocations, however,
   // we can omit the DTPMOD dynamic relocations and resolve them at link time
@@ -1226,7 +1225,7 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
   // module index, with a special value of 0 for the current module. GOT[e1] is
   // unused. There only needs to be one module index entry.
   if (oneof<R_TLSLD_GOT, R_TLSLD_GOTPLT, R_TLSLD_PC, R_TLSLD_HINT>(expr)) {
-    // Local-Dynamic relocs can be optimized to Local-Exesec->
+    // Local-Dynamic relocs can be optimized to Local-Exec.
     if (execOptimize) {
       sec->addReloc({ctx.target->adjustTlsExpr(type, R_RELAX_TLS_LD_TO_LE),
                      type, offset, addend, &sym});
@@ -1239,7 +1238,7 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
     return 1;
   }
 
-  // Local-Dynamic relocs can be optimized to Local-Exesec->
+  // Local-Dynamic relocs can be optimized to Local-Exec.
   if (expr == R_DTPREL) {
     if (execOptimize)
       expr = ctx.target->adjustTlsExpr(type, R_RELAX_TLS_LD_TO_LE);
@@ -1249,7 +1248,7 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
 
   // Local-Dynamic sequence where offset of tls variable relative to dynamic
   // thread pointer is stored in the got. This cannot be optimized to
-  // Local-Exesec->
+  // Local-Exec.
   if (expr == R_TLSLD_GOT_OFF) {
     sym.setFlags(NEEDS_GOT_DTPREL);
     sec->addReloc({expr, type, offset, addend, &sym});
@@ -1284,7 +1283,7 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
     //
     // R_RISCV_TLSDESC_{LOAD_LO12,ADD_LO12_I,CALL} reference a non-preemptible
     // label, so TLSDESC=>IE will be categorized as R_RELAX_TLS_GD_TO_LE. We fix
-    // the categorization in RISCV::relocateAllosec->
+    // the categorization in RISCV::relocateAlloc.
     if (sym.isPreemptible) {
       sym.setFlags(NEEDS_TLSIE);
       sec->addReloc({ctx.target->adjustTlsExpr(type, R_RELAX_TLS_GD_TO_IE),


        


More information about the llvm-commits mailing list