[PATCH] D16469: Pass --wrap=pthread_create to linker for -fsplit-stack
H.J Lu via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 22 13:26:37 PST 2016
hjl.tools updated this revision to Diff 45735.
hjl.tools added a comment.
Add a testcase.
http://reviews.llvm.org/D16469
Files:
lib/Driver/Tools.cpp
test/Driver/split-stack-ld.c
Index: test/Driver/split-stack-ld.c
===================================================================
--- /dev/null
+++ test/Driver/split-stack-ld.c
@@ -0,0 +1,17 @@
+// Test split stack ld flags.
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target i386-unknown-linux -fsplit-stack \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LINUX-I386 %s
+//
+// CHECK-LINUX-I386: "--wrap=pthread_create"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target x86_64-unknown-linux -fsplit-stack \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64 %s
+//
+// CHECK-LINUX-X86-64: "--wrap=pthread_create"
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9001,6 +9001,9 @@
if (WantPthread && !isAndroid)
CmdArgs.push_back("-lpthread");
+ if (Args.hasArg(options::OPT_fsplit_stack))
+ CmdArgs.push_back("--wrap=pthread_create");
+
CmdArgs.push_back("-lc");
if (Args.hasArg(options::OPT_static))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16469.45735.patch
Type: text/x-patch
Size: 1308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160122/3cef6280/attachment.bin>
More information about the cfe-commits
mailing list