forked from OSchip/llvm-project
[clang][WebAssembly] Pass `-Wa,--no-type-check` through to the MC layer
I took as an example the `-Wa,--noexecstack` clang flag that maps down to `cc1 -mnoexecstack`. Differential Revision: https://reviews.llvm.org/D131217
This commit is contained in:
parent
d46ea783e6
commit
849df8f6f0
|
@ -180,6 +180,7 @@ CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
|
|||
CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is
|
||||
///< enabled.
|
||||
CODEGENOPT(NoWarn , 1, 0) ///< Set when -Wa,--no-warn is enabled.
|
||||
CODEGENOPT(NoTypeCheck , 1, 0) ///< Set when -Wa,--no-type-check is enabled.
|
||||
CODEGENOPT(MisExpect , 1, 0) ///< Set when -Wmisexpect is enabled
|
||||
CODEGENOPT(EnableSegmentedStacks , 1, 0) ///< Set when -fsplit-stack is enabled.
|
||||
CODEGENOPT(NoInlineLineTables, 1, 0) ///< Whether debug info should contain
|
||||
|
|
|
@ -5286,6 +5286,9 @@ def msave_temp_labels : Flag<["-"], "msave-temp-labels">,
|
|||
"Note this may change .s semantics and shouldn't generally be used "
|
||||
"on compiler-generated code.">,
|
||||
MarshallingInfoFlag<CodeGenOpts<"SaveTempLabels">>;
|
||||
def mno_type_check : Flag<["-"], "mno-type-check">,
|
||||
HelpText<"Don't perform type checking of the assembly code (wasm only)">,
|
||||
MarshallingInfoFlag<CodeGenOpts<"NoTypeCheck">>;
|
||||
def fno_math_builtin : Flag<["-"], "fno-math-builtin">,
|
||||
HelpText<"Disable implicit builtin knowledge of math functions">,
|
||||
MarshallingInfoFlag<LangOpts<"NoMathBuiltin">>;
|
||||
|
|
|
@ -2580,6 +2580,13 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
|
|||
switch (C.getDefaultToolChain().getArch()) {
|
||||
default:
|
||||
break;
|
||||
case llvm::Triple::wasm32:
|
||||
case llvm::Triple::wasm64:
|
||||
if (Value == "--no-type-check") {
|
||||
CmdArgs.push_back("-mno-type-check");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case llvm::Triple::thumb:
|
||||
case llvm::Triple::thumbeb:
|
||||
case llvm::Triple::arm:
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# REQUIRES: webassembly-registered-target
|
||||
|
||||
# RUN: %clang -### %s -c -o tmp.o -target wasm32-unknown-unknown -Wa,--no-type-check 2>&1 | FileCheck %s
|
||||
# CHECK: "-cc1as" {{.*}} "-mno-type-check"
|
||||
|
||||
# Verify that without -Wa,--no-type-check the assembler will error out
|
||||
# RUN: not %clang %s -c -o tmp.o -target wasm32-unknown-unknown 2>&1 | FileCheck --check-prefix=ERROR %s
|
||||
# ERROR: error: popped i64, expected i32
|
||||
|
||||
foo:
|
||||
.functype foo () -> (i32)
|
||||
i64.const 42
|
||||
end_function
|
|
@ -134,6 +134,7 @@ struct AssemblerInvocation {
|
|||
unsigned NoExecStack : 1;
|
||||
unsigned FatalWarnings : 1;
|
||||
unsigned NoWarn : 1;
|
||||
unsigned NoTypeCheck : 1;
|
||||
unsigned IncrementalLinkerCompatible : 1;
|
||||
unsigned EmbedBitcode : 1;
|
||||
|
||||
|
@ -166,6 +167,7 @@ public:
|
|||
NoExecStack = 0;
|
||||
FatalWarnings = 0;
|
||||
NoWarn = 0;
|
||||
NoTypeCheck = 0;
|
||||
IncrementalLinkerCompatible = 0;
|
||||
Dwarf64 = 0;
|
||||
DwarfVersion = 0;
|
||||
|
@ -304,6 +306,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
|||
Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);
|
||||
Opts.FatalWarnings = Args.hasArg(OPT_massembler_fatal_warnings);
|
||||
Opts.NoWarn = Args.hasArg(OPT_massembler_no_warn);
|
||||
Opts.NoTypeCheck = Args.hasArg(OPT_mno_type_check);
|
||||
Opts.RelocationModel =
|
||||
std::string(Args.getLastArgValue(OPT_mrelocation_model, "pic"));
|
||||
Opts.TargetABI = std::string(Args.getLastArgValue(OPT_target_abi));
|
||||
|
@ -468,6 +471,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
|
|||
|
||||
MCOptions.MCNoWarn = Opts.NoWarn;
|
||||
MCOptions.MCFatalWarnings = Opts.FatalWarnings;
|
||||
MCOptions.MCNoTypeCheck = Opts.NoTypeCheck;
|
||||
MCOptions.ABIName = Opts.TargetABI;
|
||||
|
||||
// FIXME: There is a bit of code duplication with addPassesToEmitFile.
|
||||
|
|
Loading…
Reference in New Issue