llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-driver Author: Heejin Ahn (aheejin) <details> <summary>Changes</summary> This adds checks for `-wasm-use-legacy-eh`. While this option is true by default in the backend, it is not supposed to be given to the Clang when Wasm EH is not used. --- Full diff: https://github.com/llvm/llvm-project/pull/122526.diff 2 Files Affected: - (modified) clang/lib/Driver/ToolChains/WebAssembly.cpp (+2-1) - (modified) clang/test/Driver/wasm-toolchain.c (+22) ``````````diff diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp index e338b0d2398e04..10f9a4f338f8f1 100644 --- a/clang/lib/Driver/ToolChains/WebAssembly.cpp +++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp @@ -422,7 +422,8 @@ void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs, } } - for (const auto *Option : {"-wasm-enable-eh", "-wasm-enable-sjlj"}) { + for (const auto *Option : + {"-wasm-enable-eh", "-wasm-enable-sjlj", "-wasm-use-legacy-eh"}) { if (Opt.starts_with(Option)) { BanIncompatibleOptionsForWasmEHSjLj(Option); EnableFeaturesForWasmEHSjLj(); diff --git a/clang/test/Driver/wasm-toolchain.c b/clang/test/Driver/wasm-toolchain.c index 84c1b4f6efe662..2d140520827768 100644 --- a/clang/test/Driver/wasm-toolchain.c +++ b/clang/test/Driver/wasm-toolchain.c @@ -202,6 +202,28 @@ // RUN: | FileCheck -check-prefix=WASM_SJLJ_NO_REFERENCE_TYPES %s // WASM_SJLJ_NO_REFERENCE_TYPES: invalid argument '-wasm-enable-sjlj' not allowed with '-mno-reference-types' +// '-mllvm -wasm-use-legacy-eh' not allowed with +// '-mllvm -enable-emscripten-cxx-exceptions' +// RUN: not %clang -### --target=wasm32-unknown-unknown \ +// RUN: --sysroot=/foo %s -mllvm -wasm-use-legacy-eh \ +// RUN: -mllvm -enable-emscripten-cxx-exceptions 2>&1 \ +// RUN: | FileCheck -check-prefix=WASM_LEGACY_EH_EMSCRIPTEN_EH %s +// WASM_LEGACY_EH_EMSCRIPTEN_EH: invalid argument '-wasm-use-legacy-eh' not allowed with '-enable-emscripten-cxx-exceptions' + +// '-mllvm -wasm-use-legacy-eh' not allowed with '-mllvm -enable-emscripten-sjlj' +// RUN: not %clang -### --target=wasm32-unknown-unknown \ +// RUN: --sysroot=/foo %s -mllvm -wasm-use-legacy-eh \ +// RUN: -mllvm -enable-emscripten-sjlj 2>&1 \ +// RUN: | FileCheck -check-prefix=WASM_LEGACY_EH_EMSCRIPTEN_SJLJ %s +// WASM_LEGACY_EH_EMSCRIPTEN_SJLJ: invalid argument '-wasm-use-legacy-eh' not allowed with '-enable-emscripten-sjlj' + +// '-mllvm -wasm-use-legacy-eh' not allowed with '-mno-exception-handling' +// RUN: not %clang -### --target=wasm32-unknown-unknown \ +// RUN: --sysroot=/foo %s -mllvm -wasm-use-legacy-eh \ +// RUN: -mno-exception-handling 2>&1 \ +// RUN: | FileCheck -check-prefix=WASM_LEGACY_EH_NO_EH %s +// WASM_LEGACY_EH_NO_EH: invalid argument '-wasm-use-legacy-eh' not allowed with '-mno-exception-handling' + // RUN: %clang -### %s -fsanitize=address --target=wasm32-unknown-emscripten 2>&1 | FileCheck -check-prefix=CHECK-ASAN-EMSCRIPTEN %s // CHECK-ASAN-EMSCRIPTEN: "-fsanitize=address" // CHECK-ASAN-EMSCRIPTEN: "-fsanitize-address-globals-dead-stripping" `````````` </details> https://github.com/llvm/llvm-project/pull/122526 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits