summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/compiler-rt-unwind.c
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2019-03-19 20:01:59 +0000
committerSterling Augustine <saugustine@google.com>2019-03-19 20:01:59 +0000
commit6271606969e276f48c6965f31a46acf54e476e65 (patch)
tree78c553a12462332ae565b97163604be343e2c436 /clang/test/Driver/compiler-rt-unwind.c
parent77423914419162ad57bad560bf4dccf3f5759db2 (diff)
downloadbcm5719-llvm-6271606969e276f48c6965f31a46acf54e476e65.tar.gz
bcm5719-llvm-6271606969e276f48c6965f31a46acf54e476e65.zip
Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib= [take 2]
"clang++ hello.cc --rtlib=compiler-rt" now can works without specifying additional unwind or exception handling libraries. This reworked version of the feature no longer modifies today's default unwind library for compiler-rt: which is nothing. Rather, a user can specify -DCLANG_DEFAULT_UNWINDLIB=libunwind when configuring the compiler. This should address the issues from the previous version. Update tests for new --unwindlib semantics. Differential Revision: https://reviews.llvm.org/D59109 llvm-svn: 356508
Diffstat (limited to 'clang/test/Driver/compiler-rt-unwind.c')
-rw-r--r--clang/test/Driver/compiler-rt-unwind.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/clang/test/Driver/compiler-rt-unwind.c b/clang/test/Driver/compiler-rt-unwind.c
new file mode 100644
index 00000000000..00024dfa7ed
--- /dev/null
+++ b/clang/test/Driver/compiler-rt-unwind.c
@@ -0,0 +1,49 @@
+// General tests that the driver handles combinations of --rtlib=XXX and
+// --unwindlib=XXX properly.
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-unknown-linux \
+// RUN: --gcc-toolchain="" \
+// RUN: | FileCheck --check-prefix=RTLIB-EMPTY %s
+// RTLIB-EMPTY: "{{.*}}lgcc"
+// RTLIB-EMPTY: "{{.*}}-lgcc_s"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-unknown-linux -rtlib=libgcc \
+// RUN: --gcc-toolchain="" \
+// RUN: | FileCheck --check-prefix=RTLIB-GCC %s
+// RTLIB-GCC: "{{.*}}lgcc"
+// RTLIB-GCC: "{{.*}}lgcc_s"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
+// RUN: --gcc-toolchain="" \
+// RUN: | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s
+// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc"
+// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lunwind"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt \
+// RUN: --gcc-toolchain="" \
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
+// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins-x86_64.a"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
+// RUN: --gcc-toolchain="" \
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins-x86_64.a"
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}lgcc_s"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
+// RUN: -static --gcc-toolchain="" \
+// RUN: | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins-x86_64.a"
+// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}lgcc_eh"
+//
+// RUN: not %clang -no-canonical-prefixes %s -o %t.o 2> %t.err \
+// RUN: --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
+// RUN: --gcc-toolchain="" \
+// RUN: FileCheck --input-file=%t.err --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER_RT %s
+// RTLIB-GCC-UNWINDLIB-COMPILER_RT: "{{[.|\\\n]*}}--rtlib=libgcc requires --unwindlib=libgcc"
OpenPOWER on IntegriCloud