[llvm] 50f69e5 - insertSSPDeclarations: adjust Darwin condition that sets dso_local

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 15:47:21 PDT 2023


Author: Fangrui Song
Date: 2023-10-31T15:47:05-07:00
New Revision: 50f69e5f8149a8577ab07f30a8bae49bbb79ff7d

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

LOG: insertSSPDeclarations: adjust Darwin condition that sets dso_local

This change is for AArch32 and not strictly needed, but it ensures that
we follow the model that direct accesses are only emitted for dso_local
and we do not need TargetMachine::shouldAssumeDSOLocal to force
dso_local for a dso_preemptable variable.

There is no behavior change to the arm/arm64 configurations listed in
commit 5888dee7d04748744743a35d3aef030018bdc275.

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringBase.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp
index 99eadf4bb9d578b..722cefb1eddb3c5 100644
--- a/llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -2019,7 +2019,8 @@ void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
     if (M.getDirectAccessExternalData() &&
         !TM.getTargetTriple().isWindowsGNUEnvironment() &&
         !TM.getTargetTriple().isOSFreeBSD() &&
-        !TM.getTargetTriple().isOSDarwin())
+        (!TM.getTargetTriple().isOSDarwin() ||
+         TM.getRelocationModel() == Reloc::Static))
       GV->setDSOLocal(true);
   }
 }


        


More information about the llvm-commits mailing list