Clang Project

clang_source_code/test/Driver/compiler-rt-unwind.c
1// General tests that the driver handles combinations of --rtlib=XXX and
2// --unwindlib=XXX properly.
3//
4// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
5// RUN:     --target=x86_64-unknown-linux -rtlib=libgcc \
6// RUN:     --gcc-toolchain="" \
7// RUN:   | FileCheck --check-prefix=RTLIB-GCC %s
8// RTLIB-GCC: "{{.*}}lgcc"
9// RTLIB-GCC: "{{.*}}lgcc_s"
10//
11// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
12// RUN:     --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
13// RUN:     --gcc-toolchain="" \
14// RUN:   | FileCheck --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER-RT %s
15// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lgcc"
16// RTLIB-GCC-UNWINDLIB-COMPILER-RT: "{{.*}}lunwind"
17//
18// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1   \
19// RUN:     --target=x86_64-unknown-linux -rtlib=compiler-rt \
20// RUN:     --gcc-toolchain="" \
21// RUN:   | FileCheck --check-prefix=RTLIB-COMPILER-RT %s
22// RTLIB-COMPILER-RT: "{{.*}}libclang_rt.builtins-x86_64.a"
23//
24// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1   \
25// RUN:     --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
26// RUN:     --gcc-toolchain="" \
27// RUN:   | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC %s
28// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}libclang_rt.builtins-x86_64.a"
29// RTLIB-COMPILER-RT-UNWINDLIB-GCC: "{{.*}}lgcc_s"
30//
31// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1              \
32// RUN:     --target=x86_64-unknown-linux -rtlib=compiler-rt --unwindlib=libgcc \
33// RUN:     -static --gcc-toolchain="" \
34// RUN:   | FileCheck --check-prefix=RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC %s
35// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}libclang_rt.builtins-x86_64.a"
36// RTLIB-COMPILER-RT-UNWINDLIB-GCC-STATIC: "{{.*}}lgcc_eh"
37//
38// RUN: not %clang -no-canonical-prefixes %s -o %t.o 2> %t.err              \
39// RUN:     --target=x86_64-unknown-linux -rtlib=libgcc --unwindlib=libunwind \
40// RUN:     --gcc-toolchain="" \
41// RUN: FileCheck --input-file=%t.err --check-prefix=RTLIB-GCC-UNWINDLIB-COMPILER_RT %s
42// RTLIB-GCC-UNWINDLIB-COMPILER_RT: "{{[.|\\\n]*}}--rtlib=libgcc requires --unwindlib=libgcc"
43