Dan Gohman | e3d71e1 | 2016-01-07 01:00:21 +0000 | [diff] [blame] | 1 | // A basic clang -cc1 command-line. WebAssembly is somewhat special in |
| 2 | // enabling -ffunction-sections, -fdata-sections, and -fvisibility=hidden by |
| 3 | // default. |
Dan Gohman | 4e48020 | 2016-01-07 00:32:04 +0000 | [diff] [blame] | 4 | |
| 5 | // RUN: %clang %s -### -target wasm32-unknown-unknown 2>&1 | FileCheck -check-prefix=CC1 %s |
Dan Gohman | e3d71e1 | 2016-01-07 01:00:21 +0000 | [diff] [blame] | 6 | // CC1: clang{{.*}} "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility" "hidden" {{.*}} "-ffunction-sections" "-fdata-sections" |
Dan Gohman | a5b804b | 2016-01-07 00:50:27 +0000 | [diff] [blame] | 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 |
Dan Gohman | 4e48020 | 2016-01-07 00:32:04 +0000 | [diff] [blame] | 19 | |
Dan Gohman | fbe544e | 2016-01-07 01:15:05 +0000 | [diff] [blame^] | 20 | // Ditto, but ensure that a user -fvisibility=default disables the default |
| 21 | // -fvisibilt=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 | |
Dan Gohman | 4e48020 | 2016-01-07 00:32:04 +0000 | [diff] [blame] | 26 | // A basic C link command-line. |
| 27 | |
| 28 | // RUN: %clang -### -no-canonical-prefixes -target wasm32-unknown-unknown %s 2>&1 | FileCheck -check-prefix=LINK %s |
| 29 | // LINK: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 30 | // LINK: lld{{.*}}" "-flavor" "ld" "[[temp]]" "-o" "a.out" |
| 31 | |
Dan Gohman | e3d71e1 | 2016-01-07 01:00:21 +0000 | [diff] [blame] | 32 | // A basic C link command-line with optimization. WebAssembly is somewhat |
| 33 | // special in enabling --gc-sections by default. |
Dan Gohman | 4e48020 | 2016-01-07 00:32:04 +0000 | [diff] [blame] | 34 | |
| 35 | // RUN: %clang -### -O2 -no-canonical-prefixes -target wasm32-unknown-unknown %s 2>&1 | FileCheck -check-prefix=LINK_OPT %s |
| 36 | // LINK_OPT: clang{{.*}}" "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 37 | // LINK_OPT: lld{{.*}}" "-flavor" "ld" "--gc-sections" "[[temp]]" "-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 -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" "--no-gc-sections" "[[temp]]" "-o" "a.out" |