• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 %s 2>&1 | FileCheck -check-prefix=LINK %s
29 // LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
30 // LINK: lld{{.*}}" "-flavor" "ld" "-L/foo/lib32" "crt1.o" "crti.o" "[[temp]]" "-lc" "-lcompiler_rt" "crtn.o" "-o" "a.out"
31 
32 // A basic C link command-line with optimization. WebAssembly is somewhat
33 // special in enabling --gc-sections by default.
34 
35 // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo %s 2>&1 | FileCheck -check-prefix=LINK_OPT %s
36 // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
37 // LINK_OPT: lld{{.*}}" "-flavor" "ld" "--gc-sections" "-L/foo/lib32" "crt1.o" "crti.o" "[[temp]]" "-lc" "-lcompiler_rt" "crtn.o" "-o" "a.out"
38 
39 // Ditto, but ensure that a user --no-gc-sections comes after the
40 // default --gc-sections.
41 
42 // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown --sysroot=/foo -Wl,--no-gc-sections %s 2>&1 | FileCheck -check-prefix=NO_GC_SECTIONS %s
43 // NO_GC_SECTIONS: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]"
44 // NO_GC_SECTIONS: lld{{.*}}" "-flavor" "ld" "--gc-sections" "-L/foo/lib32" "crt1.o" "crti.o" "--no-gc-sections" "[[temp]]" "-lc" "-lcompiler_rt" "crtn.o" "-o" "a.out"
45