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

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 14:04:11 PST 2022


arichardson requested changes to this revision.
arichardson added a comment.
This revision now requires changes to proceed.
Herald added a subscriber: StephenFan.
Herald added a project: All.

Just ran into this trying to build FreeBSD amd64 with recent LLVM. I'm okay with this workaround being merged as long as the comment is updated.



================
Comment at: llvm/lib/CodeGen/TargetLoweringBase.cpp:1992
+    // 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
----------------
Whether it's in libc.so or not should not matter, if `TM.getRelocationModel() == Reloc::Static` you are linking libc.a which means __stack_chk_guard is indeed dso_local. The ideal solution IMO would be to remove the FreeBSD special case completelty.

That said, I'm fine with having a ppc64 workaround here seeing as it is needed to use LLVM for PPC64 FreeBSD. However, the comment should be updated to say this is a workaround for PPC64 stack protector codegen not being correct rather than mentioning libc.so which is not relevant.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113443



More information about the llvm-commits mailing list