1 // A basic clang -cc1 command-line. WebAssembly is somewhat special in
2 // enabling -ffunction-sections, -fdata-sections, and -fvisibility=hidden by
3 // default.
4 
5 // RUN: %clang++ %s -### -no-canonical-prefixes -target wasm32-unknown-unknown 2>&1 | FileCheck -check-prefix=CC1 %s
6 // CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} "-ffunction-sections" "-fdata-sections"
7 
8 // Ditto, but ensure that a user -fno-function-sections disables the
9 // default -ffunction-sections.
10 
11 // RUN: %clang++ %s -### -target wasm32-unknown-unknown -fno-function-sections 2>&1 | FileCheck -check-prefix=NO_FUNCTION_SECTIONS %s
12 // NO_FUNCTION_SECTIONS-NOT: function-sections
13 
14 // Ditto, but ensure that a user -fno-data-sections disables the
15 // default -fdata-sections.
16 
17 // RUN: %clang++ %s -### -target wasm32-unknown-unknown -fno-data-sections 2>&1 | FileCheck -check-prefix=NO_DATA_SECTIONS %s
18 // NO_DATA_SECTIONS-NOT: data-sections
19 
20 // Ditto, but ensure that a user -fvisibility=default disables the default
21 // -fvisibility=hidden.
22 
23 // RUN: %clang++ %s -### -target wasm32-unknown-unknown -fvisibility=default 2>&1 | FileCheck -check-prefix=FVISIBILITY_DEFAULT %s
24 // FVISIBILITY_DEFAULT-NOT: hidden
25 
26 // A basic C++ link command-line.
27 
28 // RUN: %clang++ -### -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo --stdlib=c++ %s 2>&1 | FileCheck -check-prefix=LINK %s
29 // LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
30 // LINK: lld{{.*}}" "-flavor" "wasm" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
31 
32 // A basic C++ link command-line with optimization.
33 
34 // RUN: %clang++ -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s --stdlib=c++ 2>&1 | FileCheck -check-prefix=LINK_OPT %s
35 // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
36 // LINK_OPT: lld{{.*}}" "-flavor" "wasm" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc++" "-lc++abi" "-lc" "{{.*[/\\]}}libclang_rt.builtins-wasm32.a" "-o" "a.out"
37