[lld] 67c0846 - [ELF] Don't call getPPC64TargetInfo outside Driver. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 5 10:29:30 PDT 2024


Author: Fangrui Song
Date: 2024-10-05T10:29:25-07:00
New Revision: 67c0846357bcd6faca713315380f9981a805a6e5

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

LOG: [ELF] Don't call getPPC64TargetInfo outside Driver. NFC

getPPC64TargetInfo should only be called once per link invocation.

Added: 
    

Modified: 
    lld/ELF/SyntheticSections.cpp
    lld/ELF/Thunks.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 521873f4cb141e..bc0da5da755b84 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1571,7 +1571,7 @@ DynamicSection<ELFT>::computeContents() {
   }
 
   if (ctx.arg.emachine == EM_PPC64)
-    addInt(DT_PPC64_OPT, getPPC64TargetInfo(ctx)->ppc64DynamicSectionOpt);
+    addInt(DT_PPC64_OPT, ctx.target->ppc64DynamicSectionOpt);
 
   addInt(DT_NULL, 0);
   return entries;

diff  --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp
index ef97530679469d..1a01c3f6b3e581 100644
--- a/lld/ELF/Thunks.cpp
+++ b/lld/ELF/Thunks.cpp
@@ -1539,7 +1539,7 @@ static Thunk *addThunkPPC64(Ctx &ctx, RelType type, Symbol &s, int64_t a) {
   // If we are emitting stubs for NOTOC relocations, we need to tell
   // the PLT resolver that there can be multiple TOCs.
   if (type == R_PPC64_REL24_NOTOC)
-    getPPC64TargetInfo(ctx)->ppc64DynamicSectionOpt = 0x2;
+    ctx.target->ppc64DynamicSectionOpt = 0x2;
 
   if (s.isInPlt())
     return type == R_PPC64_REL24_NOTOC


        


More information about the llvm-commits mailing list