[lld] 164194a - [ELF] Untangle R_GOT style TLS IE and processRelocAux. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 31 12:38:41 PDT 2021


Author: Fangrui Song
Date: 2021-10-31T12:38:36-07:00
New Revision: 164194a5af0b3f8b571f64a830963ad256ece0aa

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

LOG: [ELF] Untangle R_GOT style TLS IE and processRelocAux. NFC

Added: 
    

Modified: 
    lld/ELF/Relocations.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 40159dc75da7..6c8e57a20210 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1279,9 +1279,9 @@ handleTlsRelocation(RelType type, Symbol &sym, InputSectionBase &c,
     } else if (expr != R_TLSIE_HINT) {
       if (!sym.isInGot())
         addTpOffsetGotEntry(sym);
-      // R_GOT may not be a link-time constant.
-      if (expr == R_GOT)
-        processRelocAux<ELFT>(c, expr, type, offset, sym, addend);
+      // R_GOT needs a relative relocation for PIC on i386 and Hexagon.
+      if (expr == R_GOT && config->isPic && !target->usesOnlyLowPageBits(type))
+        addRelativeReloc(&c, offset, sym, addend, expr, type);
       else
         c.relocations.push_back({expr, type, offset, addend, &sym});
     }


        


More information about the llvm-commits mailing list