[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 Nov 8 16:48:42 PST 2021
adalava created this revision.
adalava added reviewers: nemanjai, MaskRay, dim, PowerPC, sfertile, emaste.
Herald added subscribers: shchenz, hiraditya, krytarowski, arichardson.
adalava requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Amends 1cb9f37a17ab <https://reviews.llvm.org/rG1cb9f37a17ab528e53d38c790c1bc44a087d2a50> restricting the logic to PPC64 as it introduces regression of FreeBSD/amd64 binaries compiled in freestanding mode (as kernel and modules) as discussed in https://reviews.llvm.org/D109090.
Bug report https://bugs.llvm.org/show_bug.cgi?id=51590
Repository:
rG LLVM Github Monorepo
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
@@ -1988,10 +1988,16 @@
GlobalVariable::ExternalLinkage, nullptr,
"__stack_chk_guard");
- // FreeBSD has "__stack_chk_guard" defined externally on libc.so
+ // XXX -- needs more investigation
+ // FreeBSD userland has "__stack_chk_guard" defined externally on libc.so,
+ // so not dso_local. Kernel modules are compiled in freestanding mode, it
+ // can be considered dso_local. 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.385646.patch
Type: text/x-patch
Size: 1195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211109/c7c2311e/attachment.bin>
More information about the llvm-commits
mailing list