[PATCH] D113443: [FreeBSD] avoid marking __stack_chk_guard symbol as dso_local on PPC64

Alfredo Dal'Ava JĂșnior via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 11:23:31 PST 2023


adalava updated this revision to Diff 495220.
adalava added a comment.

Update comments


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113443/new/

https://reviews.llvm.org/D113443

Files:
  llvm/lib/CodeGen/TargetLoweringBase.cpp


Index: llvm/lib/CodeGen/TargetLoweringBase.cpp
===================================================================
--- llvm/lib/CodeGen/TargetLoweringBase.cpp
+++ llvm/lib/CodeGen/TargetLoweringBase.cpp
@@ -1964,10 +1964,14 @@
                                   GlobalVariable::ExternalLinkage, nullptr,
                                   "__stack_chk_guard");
 
-    // FreeBSD has "__stack_chk_guard" defined externally on libc.so
+    // XXX this is a workaround for FreeBSD PPC64 stack protector codegen and
+    // requires more investigation. For unknown reasons set dso_local here
+    // breaks PPC64 userland binaries (see bug #51590).
+    // However, FreeBSD amd64 kernel and modules are broken if dso_local
+    // is not set here, while PCC64 kernel and modules are fine without it.
     if (TM.getRelocationModel() == Reloc::Static &&
         !TM.getTargetTriple().isWindowsGNUEnvironment() &&
-        !TM.getTargetTriple().isOSFreeBSD())
+        !(TM.getTargetTriple().isPPC64() && TM.getTargetTriple().isOSFreeBSD()))
       GV->setDSOLocal(true);
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113443.495220.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230206/740fd136/attachment.bin>


More information about the llvm-commits mailing list