-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[WebAssembly] Refactor Wasm EH/SjLj error checking #122466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -120,26 +120,33 @@ | |||||
// RUN: | FileCheck -check-prefix=EMSCRIPTEN_EH_ALLOWED_WO_ENABLE %s | ||||||
// EMSCRIPTEN_EH_ALLOWED_WO_ENABLE: invalid argument '-mllvm -emscripten-cxx-exceptions-allowed' only allowed with '-mllvm -enable-emscripten-cxx-exceptions' | ||||||
|
||||||
// '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types | ||||||
// and '-mllvm -wasm-enable-eh' | ||||||
// '-fwasm-exceptions' sets +exception-handling, -multivalue, -reference-types, | ||||||
// "-exception-model=wasm", and '-mllvm -wasm-enable-eh' | ||||||
Comment on lines
+123
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
llvm-project/clang/lib/Driver/ToolChains/Clang.cpp Lines 7469 to 7470 in 9c85cde
which is the reason we set this only for Wasm SjLj and not Wasm EH here. But now EnableFeaturesForWasmEHSjLj includes it so it is set for both, which I think is harmless anyway.
|
||||||
// RUN: %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -fwasm-exceptions 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS %s | ||||||
// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-mllvm" "-wasm-enable-eh" "-target-feature" "+multivalue" "-target-feature" "+reference-types" | ||||||
|
||||||
// '-fwasm-exceptions' not allowed with '-mno-exception-handling' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -fwasm-exceptions -mno-exception-handling 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_NO_EH %s | ||||||
// WASM_EXCEPTIONS_NO_EH: invalid argument '-fwasm-exceptions' not allowed with '-mno-exception-handling' | ||||||
// WASM_EXCEPTIONS: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" "-mllvm" "-wasm-enable-eh" | ||||||
|
||||||
// '-fwasm-exceptions' not allowed with | ||||||
// '-mllvm -enable-emscripten-cxx-exceptions' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -fwasm-exceptions \ | ||||||
// RUN: -mllvm -enable-emscripten-cxx-exceptions 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_EMSCRIPTEN_EH %s | ||||||
// WASM_EXCEPTIONS_EMSCRIPTEN_EH: invalid argument '-fwasm-exceptions' not allowed with '-mllvm -enable-emscripten-cxx-exceptions' | ||||||
// WASM_EXCEPTIONS_EMSCRIPTEN_EH: invalid argument '-fwasm-exceptions' not allowed with '-enable-emscripten-cxx-exceptions' | ||||||
|
||||||
// '-fwasm-exceptions' not allowed with '-mllvm -enable-emscripten-sjlj' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -fwasm-exceptions \ | ||||||
// RUN: -mllvm -enable-emscripten-sjlj 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_EMSCRIPTEN_SJLJ %s | ||||||
// WASM_EXCEPTIONS_EMSCRIPTEN_SJLJ: invalid argument '-fwasm-exceptions' not allowed with '-enable-emscripten-sjlj' | ||||||
|
||||||
// '-fwasm-exceptions' not allowed with '-mno-exception-handling' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -fwasm-exceptions -mno-exception-handling 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_EXCEPTIONS_NO_EH %s | ||||||
// WASM_EXCEPTIONS_NO_EH: invalid argument '-fwasm-exceptions' not allowed with '-mno-exception-handling' | ||||||
Comment on lines
+145
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was just moved to gather feature-related errors together. |
||||||
|
||||||
// '-fwasm-exceptions' not allowed with '-mno-multivalue' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
|
@@ -154,46 +161,46 @@ | |||||
// WASM_EXCEPTIONS_NO_REFERENCE_TYPES: invalid argument '-fwasm-exceptions' not allowed with '-mno-reference-types' | ||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' sets +exception-handling, +multivalue, | ||||||
// +reference-types and '-exception-model=wasm' | ||||||
// +reference-types and '-exception-model=wasm' | ||||||
// RUN: %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ %s | ||||||
// WASM_SJLJ: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-exception-model=wasm" "-target-feature" "+multivalue" "-target-feature" "+reference-types" | ||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-exception-handling' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj -mno-exception-handling \ | ||||||
// RUN: 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_EH %s | ||||||
// WASM_SJLJ_NO_EH: invalid argument '-mllvm -wasm-enable-sjlj' not allowed with '-mno-exception-handling' | ||||||
// WASM_SJLJ: "-cc1" {{.*}} "-target-feature" "+exception-handling" "-target-feature" "+multivalue" "-target-feature" "+reference-types" "-exception-model=wasm" | ||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' not allowed with | ||||||
// '-mllvm -enable-emscripten-cxx-exceptions' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj \ | ||||||
// RUN: -mllvm -enable-emscripten-cxx-exceptions 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ_EMSCRIPTEN_EH %s | ||||||
// WASM_SJLJ_EMSCRIPTEN_EH: invalid argument '-mllvm -wasm-enable-sjlj' not allowed with '-mllvm -enable-emscripten-cxx-exceptions' | ||||||
// WASM_SJLJ_EMSCRIPTEN_EH: invalid argument '-wasm-enable-sjlj' not allowed with '-enable-emscripten-cxx-exceptions' | ||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' not allowed with '-mllvm -enable-emscripten-sjlj' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj \ | ||||||
// RUN: -mllvm -enable-emscripten-sjlj 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ_EMSCRIPTEN_SJLJ %s | ||||||
// WASM_SJLJ_EMSCRIPTEN_SJLJ: invalid argument '-mllvm -wasm-enable-sjlj' not allowed with '-mllvm -enable-emscripten-sjlj' | ||||||
// WASM_SJLJ_EMSCRIPTEN_SJLJ: invalid argument '-wasm-enable-sjlj' not allowed with '-enable-emscripten-sjlj' | ||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-exception-handling' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj -mno-exception-handling \ | ||||||
// RUN: 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_EH %s | ||||||
// WASM_SJLJ_NO_EH: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-exception-handling' | ||||||
Comment on lines
+185
to
+190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was just moved too. |
||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-multivalue' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj -mno-multivalue 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_MULTIVALUE %s | ||||||
// WASM_SJLJ_NO_MULTIVALUE: invalid argument '-mllvm -wasm-enable-sjlj' not allowed with '-mno-multivalue' | ||||||
// WASM_SJLJ_NO_MULTIVALUE: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-multivalue' | ||||||
|
||||||
// '-mllvm -wasm-enable-sjlj' not allowed with '-mno-reference-types' | ||||||
// RUN: not %clang -### --target=wasm32-unknown-unknown \ | ||||||
// RUN: --sysroot=/foo %s -mllvm -wasm-enable-sjlj \ | ||||||
// RUN: -mno-reference-types 2>&1 \ | ||||||
// RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_REFERENCE_TYPES %s | ||||||
// WASM_SJLJ_NO_REFERENCE_TYPES: invalid argument '-mllvm -wasm-enable-sjlj' not allowed with '-mno-reference-types' | ||||||
// WASM_SJLJ_NO_REFERENCE_TYPES: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-reference-types' | ||||||
|
||||||
// RUN: %clang -### %s -fsanitize=address --target=wasm32-unknown-emscripten 2>&1 | FileCheck -check-prefix=CHECK-ASAN-EMSCRIPTEN %s | ||||||
// CHECK-ASAN-EMSCRIPTEN: "-fsanitize=address" | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were not checking
-wasm-enable-eh
before because emscripten does not set it directly; it sets-fwasm-exceptions
, which sets-wasm-enable-eh
:llvm-project/clang/lib/Driver/ToolChains/WebAssembly.cpp
Lines 365 to 367 in 9c85cde
But this adds checks for it too for symmetry because it's not hard and users can in theory give that to clang too.