| 1 |
// A basic clang -cc1 command-line. WebAssembly is somewhat special in |
| 2 |
// enabling -fvisibility=hidden by default. |
| 3 |
|
| 4 |
// RUN: %clang -### %s --target=wasm32-unknown-unknown 2>&1 \ |
| 5 |
// RUN: | FileCheck -check-prefix=CC1 %s |
| 6 |
// CC1: "-cc1" "-triple" "wasm32-unknown-unknown" {{.*}} "-fvisibility=hidden" {{.*}} |
| 7 |
|
| 8 |
// Ditto, but ensure that a user -fvisibility=default disables the default |
| 9 |
// -fvisibility=hidden. |
| 10 |
|
| 11 |
// RUN: %clang -### %s --target=wasm32-unknown-unknown -fvisibility=default 2>&1 \ |
| 12 |
// RUN: | FileCheck -check-prefix=FVISIBILITY_DEFAULT %s |
| 13 |
// FVISIBILITY_DEFAULT-NOT: hidden |
| 14 |
|
| 15 |
// A basic C link command-line with unknown OS. |
| 16 |
|
| 17 |
// RUN: %clang -### --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \ |
| 18 |
// RUN: | FileCheck -check-prefix=LINK %s |
| 19 |
// LINK: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 20 |
// LINK: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 21 |
|
| 22 |
// A basic C link command-line with optimization with unknown OS. |
| 23 |
|
| 24 |
// RUN: %clang -### -O2 --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \ |
| 25 |
// RUN: | FileCheck -check-prefix=LINK_OPT %s |
| 26 |
// LINK_OPT: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 27 |
// LINK_OPT: wasm-ld{{.*}}" "-L/foo/lib" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 28 |
|
| 29 |
// A basic C link command-line with known OS. |
| 30 |
|
| 31 |
// RUN: %clang -### --target=wasm32-wasi --sysroot=/foo %s 2>&1 \ |
| 32 |
// RUN: | FileCheck -check-prefix=LINK_KNOWN %s |
| 33 |
// LINK_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 34 |
// LINK_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 35 |
|
| 36 |
// -shared should be passed through to `wasm-ld` and include crt1-reactor.o with a known OS. |
| 37 |
|
| 38 |
// RUN: %clang -### -shared -mexec-model=reactor --target=wasm32-wasi --sysroot=/foo %s 2>&1 \ |
| 39 |
// RUN: | FileCheck -check-prefix=LINK_KNOWN_SHARED %s |
| 40 |
// LINK_KNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 41 |
// LINK_KNOWN_SHARED: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 42 |
|
| 43 |
// -shared should be passed through to `wasm-ld` and include crt1-reactor.o with an unknown OS. |
| 44 |
|
| 45 |
// RUN: %clang -### -shared -mexec-model=reactor --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \ |
| 46 |
// RUN: | FileCheck -check-prefix=LINK_UNKNOWN_SHARED %s |
| 47 |
// LINK_UNKNOWN_SHARED: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 48 |
// LINK_UNKNOWN_SHARED: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "-shared" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 49 |
|
| 50 |
// A basic C link command-line with optimization with known OS. |
| 51 |
|
| 52 |
// RUN: %clang -### -O2 --target=wasm32-wasi --sysroot=/foo %s 2>&1 \ |
| 53 |
// RUN: | FileCheck -check-prefix=LINK_OPT_KNOWN %s |
| 54 |
// LINK_OPT_KNOWN: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 55 |
// LINK_OPT_KNOWN: wasm-ld{{.*}}" "-L/foo/lib/wasm32-wasi" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 56 |
|
| 57 |
// A basic C compile command-line with known OS. |
| 58 |
|
| 59 |
// RUN: %clang -### --target=wasm32-wasi --sysroot=/foo %s 2>&1 \ |
| 60 |
// RUN: | FileCheck -check-prefix=COMPILE %s |
| 61 |
// COMPILE: "-cc1" {{.*}} "-internal-isystem" "/foo/include/wasm32-wasi" "-internal-isystem" "/foo/include" |
| 62 |
|
| 63 |
// -fPIC should work on a known OS |
| 64 |
|
| 65 |
// RUN: %clang -### -fPIC --target=wasm32-wasi --sysroot=/foo %s 2>&1 \ |
| 66 |
// RUN: | FileCheck -check-prefix=COMPILE_KNOWN_PIC %s |
| 67 |
// COMPILE_KNOWN_PIC: "-cc1" {{.*}} "-mrelocation-model" "pic" "-pic-level" "2" {{.*}} "-internal-isystem" "/foo/include/wasm32-wasi" "-internal-isystem" "/foo/include" |
| 68 |
|
| 69 |
// -fPIC should work on an unknown OS |
| 70 |
|
| 71 |
// RUN: %clang -### -fPIC --target=wasm32-unknown-unknown --sysroot=/foo %s 2>&1 \ |
| 72 |
// RUN: | FileCheck -check-prefix=COMPILE_UNKNOWN_PIC %s |
| 73 |
// COMPILE_UNKNOWN_PIC: "-cc1" {{.*}} "-mrelocation-model" "pic" "-pic-level" "2" |
| 74 |
|
| 75 |
// Thread-related command line tests. |
| 76 |
|
| 77 |
// '-pthread' sets +atomics, +bulk-memory, +mutable-globals, +sign-ext, and --shared-memory |
| 78 |
// RUN: %clang -### --target=wasm32-unknown-unknown --sysroot=/foo %s -pthread 2>&1 \ |
| 79 |
// RUN: | FileCheck -check-prefix=PTHREAD %s |
| 80 |
// PTHREAD: "-cc1" {{.*}} "-target-feature" "+atomics" "-target-feature" "+bulk-memory" "-target-feature" "+mutable-globals" "-target-feature" "+sign-ext" |
| 81 |
// PTHREAD: wasm-ld{{.*}}" "--shared-memory" "-lpthread" |
| 82 |
// |
| 83 |
// '-pthread' with '-nostdlib' should still set '--shared-memory' but not include '-lpthread' |
| 84 |
// RUN: %clang -### --target=wasm32-unknown-unknown --sysroot=/foo %s -pthread -nostdlib 2>&1 \ |
| 85 |
// RUN: | FileCheck -check-prefix=PTHREAD-NOSTDLIB %s |
| 86 |
// PTHREAD-NOSTDLIB: "-cc1" {{.*}} "-target-feature" "+atomics" "-target-feature" "+bulk-memory" "-target-feature" "+mutable-globals" "-target-feature" "+sign-ext" |
| 87 |
// PTHREAD-NOSTDLIB: wasm-ld{{.*}}" "--shared-memory" "-o" "a.out" |
| 88 |
|
| 89 |
// '-pthread' not allowed with '-mno-atomics' |
| 90 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 91 |
// RUN: --sysroot=/foo %s -pthread -mno-atomics 2>&1 \ |
| 92 |
// RUN: | FileCheck -check-prefix=PTHREAD_NO_ATOMICS %s |
| 93 |
// PTHREAD_NO_ATOMICS: invalid argument '-pthread' not allowed with '-mno-atomics' |
| 94 |
|
| 95 |
// '-pthread' not allowed with '-mno-bulk-memory' |
| 96 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 97 |
// RUN: --sysroot=/foo %s -pthread -mno-bulk-memory 2>&1 \ |
| 98 |
// RUN: | FileCheck -check-prefix=PTHREAD_NO_BULK_MEM %s |
| 99 |
// PTHREAD_NO_BULK_MEM: invalid argument '-pthread' not allowed with '-mno-bulk-memory' |
| 100 |
|
| 101 |
// '-pthread' not allowed with '-mno-mutable-globals' |
| 102 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 103 |
// RUN: --sysroot=/foo %s -pthread -mno-mutable-globals 2>&1 \ |
| 104 |
// RUN: | FileCheck -check-prefix=PTHREAD_NO_MUT_GLOBALS %s |
| 105 |
// PTHREAD_NO_MUT_GLOBALS: invalid argument '-pthread' not allowed with '-mno-mutable-globals' |
| 106 |
|
| 107 |
// '-pthread' not allowed with '-mno-sign-ext' |
| 108 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 109 |
// RUN: --sysroot=/foo %s -pthread -mno-sign-ext 2>&1 \ |
| 110 |
// RUN: | FileCheck -check-prefix=PTHREAD_NO_SIGN_EXT %s |
| 111 |
// PTHREAD_NO_SIGN_EXT: invalid argument '-pthread' not allowed with '-mno-sign-ext' |
| 112 |
|
| 113 |
// 'wasm32-wasi-threads' does the same thing as '-pthread' |
| 114 |
// RUN: %clang -### --target=wasm32-wasi-threads --sysroot=/foo %s 2>&1 \ |
| 115 |
// RUN: | FileCheck -check-prefix=WASI_THREADS %s |
| 116 |
// WASI_THREADS: "-cc1" {{.*}} "-target-feature" "+atomics" "-target-feature" "+bulk-memory" "-target-feature" "+mutable-globals" "-target-feature" "+sign-ext" |
| 117 |
// WASI_THREADS: wasm-ld{{.*}}" "--shared-memory" "-lpthread" |
| 118 |
|
| 119 |
// '-mllvm -emscripten-cxx-exceptions-allowed=foo,bar' sets |
| 120 |
// '-mllvm --force-attribute=foo:noinline -mllvm --force-attribute=bar:noinline' |
| 121 |
// RUN: %clang -### --target=wasm32-unknown-unknown \ |
| 122 |
// RUN: --sysroot=/foo %s -mllvm -enable-emscripten-cxx-exceptions \ |
| 123 |
// RUN: -mllvm -emscripten-cxx-exceptions-allowed=foo,bar 2>&1 \ |
| 124 |
// RUN: | FileCheck -check-prefix=EMSCRIPTEN_EH_ALLOWED_NOINLINE %s |
| 125 |
// EMSCRIPTEN_EH_ALLOWED_NOINLINE: "-cc1" {{.*}} "-mllvm" "--force-attribute=foo:noinline" "-mllvm" "--force-attribute=bar:noinline" |
| 126 |
|
| 127 |
// '-mllvm -emscripten-cxx-exceptions-allowed' only allowed with |
| 128 |
// '-mllvm -enable-emscripten-cxx-exceptions' |
| 129 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 130 |
// RUN: --sysroot=/foo %s -mllvm -emscripten-cxx-exceptions-allowed 2>&1 \ |
| 131 |
// RUN: | FileCheck -check-prefix=EMSCRIPTEN_EH_ALLOWED_WO_ENABLE %s |
| 132 |
// EMSCRIPTEN_EH_ALLOWED_WO_ENABLE: invalid argument '-mllvm -emscripten-cxx-exceptions-allowed' only allowed with '-mllvm -enable-emscripten-cxx-exceptions' |
| 133 |
|
| 134 |
// '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types, |
| 135 |
// "-exception-model=wasm", and '-mllvm -wasm-enable-eh' |
| 136 |
// RUN: %clang -### --target=wasm32-unknown-unknown \ |
| 137 |
// RUN: --sysroot=/foo %s -fwasm-exceptions 2>&1 \ |
| 138 |
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS %s |
| 139 |
// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" "-mllvm" "-wasm-enable-eh" |
| 140 |
|
| 141 |
// '-fwasm-exceptions' not allowed with |
| 142 |
// '-mllvm -enable-emscripten-cxx-exceptions' |
| 143 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 144 |
// RUN: --sysroot=/foo %s -fwasm-exceptions \ |
| 145 |
// RUN: -mllvm -enable-emscripten-cxx-exceptions 2>&1 \ |
| 146 |
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_EMSCRIPTEN_EH %s |
| 147 |
// WASM_EXCEPTIONS_EMSCRIPTEN_EH: invalid argument '-fwasm-exceptions' not allowed with '-enable-emscripten-cxx-exceptions' |
| 148 |
|
| 149 |
// '-fwasm-exceptions' not allowed with '-mllvm -enable-emscripten-sjlj' |
| 150 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 151 |
// RUN: --sysroot=/foo %s -fwasm-exceptions \ |
| 152 |
// RUN: -mllvm -enable-emscripten-sjlj 2>&1 \ |
| 153 |
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_EMSCRIPTEN_SJLJ %s |
| 154 |
// WASM_EXCEPTIONS_EMSCRIPTEN_SJLJ: invalid argument '-fwasm-exceptions' not allowed with '-enable-emscripten-sjlj' |
| 155 |
|
| 156 |
// '-fwasm-exceptions' not allowed with '-mno-exception-handling' |
| 157 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 158 |
// RUN: --sysroot=/foo %s -fwasm-exceptions -mno-exception-handling 2>&1 \ |
| 159 |
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_NO_EH %s |
| 160 |
// WASM_EXCEPTIONS_NO_EH: invalid argument '-fwasm-exceptions' not allowed with '-mno-exception-handling' |
| 161 |
|
| 162 |
// '-fwasm-exceptions' not allowed with '-mno-multivalue' |
| 163 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 164 |
// RUN: --sysroot=/foo %s -fwasm-exceptions -mno-multivalue 2>&1 \ |
| 165 |
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_NO_MULTIVALUE %s |
| 166 |
// WASM_EXCEPTIONS_NO_MULTIVALUE: invalid argument '-fwasm-exceptions' not allowed with '-mno-multivalue' |
| 167 |
|
| 168 |
// '-fwasm-exceptions' not allowed with '-mno-reference-types' |
| 169 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 170 |
// RUN: --sysroot=/foo %s -fwasm-exceptions -mno-reference-types 2>&1 \ |
| 171 |
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_NO_REFERENCE_TYPES %s |
| 172 |
// WASM_EXCEPTIONS_NO_REFERENCE_TYPES: invalid argument '-fwasm-exceptions' not allowed with '-mno-reference-types' |
| 173 |
|
| 174 |
// '-mllvm -wasm-enable-sjlj' sets +exception-handling, +multivalue, |
| 175 |
// +reference-types and '-exception-model=wasm' |
| 176 |
// RUN: %clang -### --target=wasm32-unknown-unknown \ |
| 177 |
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj 2>&1 \ |
| 178 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ %s |
| 179 |
// WASM_SJLJ: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" |
| 180 |
|
| 181 |
// '-mllvm -wasm-enable-sjlj' not allowed with |
| 182 |
// '-mllvm -enable-emscripten-cxx-exceptions' |
| 183 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 184 |
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj \ |
| 185 |
// RUN: -mllvm -enable-emscripten-cxx-exceptions 2>&1 \ |
| 186 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ_EMSCRIPTEN_EH %s |
| 187 |
// WASM_SJLJ_EMSCRIPTEN_EH: invalid argument '-wasm-enable-sjlj' not allowed with '-enable-emscripten-cxx-exceptions' |
| 188 |
|
| 189 |
// '-mllvm -wasm-enable-sjlj' not allowed with '-mllvm -enable-emscripten-sjlj' |
| 190 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 191 |
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj \ |
| 192 |
// RUN: -mllvm -enable-emscripten-sjlj 2>&1 \ |
| 193 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ_EMSCRIPTEN_SJLJ %s |
| 194 |
// WASM_SJLJ_EMSCRIPTEN_SJLJ: invalid argument '-wasm-enable-sjlj' not allowed with '-enable-emscripten-sjlj' |
| 195 |
|
| 196 |
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-exception-handling' |
| 197 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 198 |
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj -mno-exception-handling \ |
| 199 |
// RUN: 2>&1 \ |
| 200 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_EH %s |
| 201 |
// WASM_SJLJ_NO_EH: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-exception-handling' |
| 202 |
|
| 203 |
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-multivalue' |
| 204 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 205 |
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj -mno-multivalue 2>&1 \ |
| 206 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_MULTIVALUE %s |
| 207 |
// WASM_SJLJ_NO_MULTIVALUE: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-multivalue' |
| 208 |
|
| 209 |
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-reference-types' |
| 210 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 211 |
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj \ |
| 212 |
// RUN: -mno-reference-types 2>&1 \ |
| 213 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_REFERENCE_TYPES %s |
| 214 |
// WASM_SJLJ_NO_REFERENCE_TYPES: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-reference-types' |
| 215 |
|
| 216 |
// '-mllvm -wasm-use-legacy-eh' not allowed with |
| 217 |
// '-mllvm -enable-emscripten-cxx-exceptions' |
| 218 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 219 |
// RUN: --sysroot=/foo %s -mllvm -wasm-use-legacy-eh \ |
| 220 |
// RUN: -mllvm -enable-emscripten-cxx-exceptions 2>&1 \ |
| 221 |
// RUN: | FileCheck -check-prefix=WASM_LEGACY_EH_EMSCRIPTEN_EH %s |
| 222 |
// WASM_LEGACY_EH_EMSCRIPTEN_EH: invalid argument '-wasm-use-legacy-eh' not allowed with '-enable-emscripten-cxx-exceptions' |
| 223 |
|
| 224 |
// '-mllvm -wasm-use-legacy-eh' not allowed with '-mllvm -enable-emscripten-sjlj' |
| 225 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 226 |
// RUN: --sysroot=/foo %s -mllvm -wasm-use-legacy-eh \ |
| 227 |
// RUN: -mllvm -enable-emscripten-sjlj 2>&1 \ |
| 228 |
// RUN: | FileCheck -check-prefix=WASM_LEGACY_EH_EMSCRIPTEN_SJLJ %s |
| 229 |
// WASM_LEGACY_EH_EMSCRIPTEN_SJLJ: invalid argument '-wasm-use-legacy-eh' not allowed with '-enable-emscripten-sjlj' |
| 230 |
|
| 231 |
// '-mllvm -wasm-use-legacy-eh' not allowed with '-mno-exception-handling' |
| 232 |
// RUN: not %clang -### --target=wasm32-unknown-unknown \ |
| 233 |
// RUN: --sysroot=/foo %s -mllvm -wasm-use-legacy-eh \ |
| 234 |
// RUN: -mno-exception-handling 2>&1 \ |
| 235 |
// RUN: | FileCheck -check-prefix=WASM_LEGACY_EH_NO_EH %s |
| 236 |
// WASM_LEGACY_EH_NO_EH: invalid argument '-wasm-use-legacy-eh' not allowed with '-mno-exception-handling' |
| 237 |
|
| 238 |
// When invoking clang with multiple files in a single command line, target |
| 239 |
// feature flags should be equally added to the multiple clang-cc1 command lines |
| 240 |
// RUN: %clang -### --target=wasm32-unknown-unknown \ |
| 241 |
// RUN: --sysroot=/foo %s %s -mllvm -wasm-enable-sjlj 2>&1 \ |
| 242 |
// RUN: | FileCheck -check-prefix=WASM_SJLJ_MULTI_FILES %s |
| 243 |
// WASM_SJLJ_MULTI_FILES: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" |
| 244 |
// WASM_SJLJ_MULTI_FILES: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" |
| 245 |
|
| 246 |
// RUN: %clang -### %s -fsanitize=address --target=wasm32-unknown-emscripten 2>&1 | FileCheck -check-prefix=CHECK-ASAN-EMSCRIPTEN %s |
| 247 |
// CHECK-ASAN-EMSCRIPTEN: "-fsanitize=address" |
| 248 |
// CHECK-ASAN-EMSCRIPTEN: "-fsanitize-address-globals-dead-stripping" |
| 249 |
|
| 250 |
// RUN: not %clang -### %s -fsanitize=function --target=wasm32-unknown-emscripten 2>&1 | FileCheck --check-prefix=FUNCTION %s |
| 251 |
// FUNCTION: error: unsupported option '-fsanitize=function' for target 'wasm32-unknown-emscripten' |
| 252 |
|
| 253 |
// Basic exec-model tests. |
| 254 |
|
| 255 |
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -mexec-model=command 2>&1 \ |
| 256 |
// RUN: | FileCheck -check-prefix=CHECK-COMMAND %s |
| 257 |
// CHECK-COMMAND: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 258 |
// CHECK-COMMAND: wasm-ld{{.*}}" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 259 |
|
| 260 |
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -mexec-model=reactor 2>&1 \ |
| 261 |
// RUN: | FileCheck -check-prefix=CHECK-REACTOR %s |
| 262 |
// CHECK-REACTOR: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 263 |
// CHECK-REACTOR: wasm-ld{{.*}}" "crt1-reactor.o" "--entry" "_initialize" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 264 |
|
| 265 |
// -fPIC implies +mutable-globals |
| 266 |
|
| 267 |
// RUN: %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -fPIC 2>&1 \ |
| 268 |
// RUN: | FileCheck -check-prefix=CHECK-PIC %s |
| 269 |
// CHECK-PIC: "-cc1" {{.*}} "-target-feature" "+mutable-globals" |
| 270 |
|
| 271 |
// '-mno-mutable-globals' is not allowed with '-fPIC' |
| 272 |
// RUN: not %clang -### %s --target=wasm32-unknown-unknown --sysroot=%s/no-sysroot-there -fPIC -mno-mutable-globals %s 2>&1 \ |
| 273 |
// RUN: | FileCheck -check-prefix=PIC_NO_MUTABLE_GLOBALS %s |
| 274 |
// PIC_NO_MUTABLE_GLOBALS: error: invalid argument '-fPIC' not allowed with '-mno-mutable-globals' |
| 275 |
|
| 276 |
// Test that `wasm32-wasip2` invokes the `wasm-component-ld` linker by default |
| 277 |
// instead of `wasm-ld`. |
| 278 |
|
| 279 |
// RUN: %clang -### -O2 --target=wasm32-wasip2 %s --sysroot /foo 2>&1 \ |
| 280 |
// RUN: | FileCheck -check-prefix=LINK_WASIP2 %s |
| 281 |
// LINK_WASIP2: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 282 |
// LINK_WASIP2: wasm-component-ld{{.*}}" "-L/foo/lib/wasm32-wasip2" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |
| 283 |
|
| 284 |
// Test that on `wasm32-wasip2` the `wasm-component-ld` programs is told where |
| 285 |
// to find `wasm-ld` by default. |
| 286 |
|
| 287 |
// RUN: %clang -### -O2 --target=wasm32-wasip2 %s --sysroot /foo 2>&1 \ |
| 288 |
// RUN: | FileCheck -check-prefix=LINK_WASIP2_FIND_WASMLD %s |
| 289 |
// LINK_WASIP2_FIND_WASMLD: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 290 |
// LINK_WASIP2_FIND_WASMLD: wasm-component-ld{{.*}}" {{.*}} "--wasm-ld-path" "{{.*}}wasm-ld{{.*}}" {{.*}} "[[temp]]" {{.*}} |
| 291 |
|
| 292 |
// If `wasm32-wasip2` is configured with `wasm-ld` as a linker then don't pass |
| 293 |
// the `--wasm-ld-path` flag. |
| 294 |
|
| 295 |
// RUN: %clang -### -O2 --target=wasm32-wasip2 -fuse-ld=lld %s --sysroot /foo 2>&1 \ |
| 296 |
// RUN: | FileCheck -check-prefix=LINK_WASIP2_USE_WASMLD %s |
| 297 |
// LINK_WASIP2_USE_WASMLD: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 298 |
// LINK_WASIP2_USE_WASMLD: wasm-ld{{.*}}" "-m" "wasm32" {{.*}} "[[temp]]" {{.*}} |
| 299 |
|
| 300 |
// Basic `wasm32-linux-muslwali` compile-link test. |
| 301 |
|
| 302 |
// RUN: %clang -### --target=wasm32-linux-muslwali --sysroot=/foo %s 2>&1 \ |
| 303 |
// RUN: | FileCheck -check-prefix=LINK_WALI_BASIC %s |
| 304 |
// LINK_WALI_BASIC: "-cc1" {{.*}} "-o" "[[temp:[^"]*]]" |
| 305 |
// LINK_WALI_BASIC: wasm-ld{{.*}}" "-L/foo/lib/wasm32-linux-muslwali" "crt1.o" "[[temp]]" "-lc" "{{.*[/\\]}}libclang_rt.builtins.a" "-o" "a.out" |