[PATCH] D22130: Link static PIE programs against rcrt0.o on OpenBSD
Stefan Kempf via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 8 05:37:18 PDT 2016
sisnkemp created this revision.
sisnkemp added a reviewer: rafael.
sisnkemp added a subscriber: cfe-commits.
When building a static PIE binary, linking against /usr/lib/crt0.o results in segfaults when trying to run the binary.
Static PIE programs must link against /usr/lib/rcrt0.o instead to run correctly. Bitrig has this patch in their local clang tree also.
http://reviews.llvm.org/D22130
Files:
lib/Driver/Tools.cpp
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -8083,6 +8083,10 @@
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
+ else if (Args.hasArg(options::OPT_static) &&
+ !Args.hasArg(options::OPT_nopie))
+ CmdArgs.push_back(
+ Args.MakeArgString(getToolChain().GetFilePath("rcrt0.o")));
else
CmdArgs.push_back(
Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22130.63205.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160708/67216b9c/attachment.bin>
More information about the cfe-commits
mailing list