1 | // A basic clang -cc1 command-line. WebAssembly is somewhat special in |
2 | // enabling -fvisibility=hidden by default. |
3 | |
4 | // RUN: %clang %s -### -no-canonical-prefixes -target wasm32-unknown-unknown 2>&1 | FileCheck -check-prefix=CC1 %s |
5 | // CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} |
6 | |
7 | // Ditto, but ensure that a user -fvisibility=default disables the default |
8 | // -fvisibility=hidden. |
9 | |
10 | // RUN: %clang %s -### -target wasm32-unknown-unknown -fvisibility=default 2>&1 | FileCheck -check-prefix=FVISIBILITY_DEFAULT %s |
11 | // FVISIBILITY_DEFAULT-NOT: hidden |
12 | |
13 | // A basic C link command-line with unknown OS. |
14 | |
15 | // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK %s |
16 | // LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
17 | // LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out" |
18 | |
19 | // A basic C link command-line with optimization with unknown OS. |
20 | |
21 | // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK_OPT %s |
22 | // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
23 | // LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out" |
24 | |
25 | // A basic C link command-line with known OS. |
26 | |
27 | // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-wasi-musl --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK_KNOWN %s |
28 | // LINK_KNOWN: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
29 | // LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi-musl" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out" |
30 | |
31 | // A basic C link command-line with optimization with known OS. |
32 | |
33 | // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-wasi-musl --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK_OPT_KNOWN %s |
34 | // LINK_OPT_KNOWN: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
35 | // LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi-musl" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out" |
36 | |
37 | // A basic C compile command-line with known OS. |
38 | |
39 | // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-wasi-musl --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=COMPILE %s |
40 | // COMPILE: clang{{.*}}" "-cc1" {{.*}} "-internal-isystem" "/foo/include/wasm32-wasi-musl" "-internal-isystem" "/foo/include" |
41 | |
42 | // Thread-related command line tests. |
43 | |
44 | // '-pthread' sets '-target-feature +atomics' and '--shared-memory' |
45 | // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s -fuse-ld=wasm-ld -pthread 2>&1 | FileCheck -check-prefix=PTHREAD %s |
46 | // PTHREAD: clang{{.*}}" "-cc1" {{.*}} "-target-feature" "+atomics" |
47 | // PTHREAD: wasm-ld{{.*}}" "-lpthread" "--shared-memory" |
48 | |
49 | // '-pthread' not allowed with '-mno-atomics' |
50 | // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s -pthread -mno-atomics 2>&1 | FileCheck -check-prefix=PTHREAD_NO_ATOMICS %s |
51 | // PTHREAD_NO_ATOMICS: invalid argument '-pthread' not allowed with '-mno-atomics' |
52 | |