@@ -7,7 +7,9 @@ use rustc_data_structures::profiling::TimePassesFormat;
77use rustc_data_structures:: stable_hasher:: Hash64 ;
88use rustc_errors:: ColorConfig ;
99use rustc_errors:: { LanguageIdentifier , TerminalUrl } ;
10- use rustc_target:: spec:: { CodeModel , LinkerFlavorCli , MergeFunctions , PanicStrategy , SanitizerSet } ;
10+ use rustc_target:: spec:: {
11+ CodeModel , LinkerFlavorCli , MergeFunctions , PanicStrategy , SanitizerSet , WasmCAbi ,
12+ } ;
1113use rustc_target:: spec:: {
1214 RelocModel , RelroLevel , SplitDebuginfo , StackProtector , TargetTriple , TlsModel ,
1315} ;
@@ -429,6 +431,7 @@ mod desc {
429431 pub const parse_remap_path_scope: & str = "comma separated list of scopes: `macro`, `diagnostics`, `unsplit-debuginfo`, `split-debuginfo`, `split-debuginfo-path`, `object`, `all`" ;
430432 pub const parse_inlining_threshold: & str =
431433 "either a boolean (`yes`, `no`, `on`, `off`, etc), or a non-negative number" ;
434+ pub const parse_wasm_c_abi: & str = "`legacy` or `spec`" ;
432435}
433436
434437mod parse {
@@ -1331,6 +1334,15 @@ mod parse {
13311334 }
13321335 true
13331336 }
1337+
1338+ pub ( crate ) fn parse_wasm_c_abi ( slot : & mut WasmCAbi , v : Option < & str > ) -> bool {
1339+ match v {
1340+ Some ( "spec" ) => * slot = WasmCAbi :: Spec ,
1341+ Some ( "legacy" ) => * slot = WasmCAbi :: Legacy ,
1342+ _ => return false ,
1343+ }
1344+ true
1345+ }
13341346}
13351347
13361348options ! {
@@ -1933,6 +1945,8 @@ written to standard error output)"),
19331945 Requires `-Clto[=[fat,yes]]`") ,
19341946 wasi_exec_model: Option <WasiExecModel > = ( None , parse_wasi_exec_model, [ TRACKED ] ,
19351947 "whether to build a wasi command or reactor" ) ,
1948+ wasm_c_abi: WasmCAbi = ( WasmCAbi :: Legacy , parse_wasm_c_abi, [ TRACKED ] ,
1949+ "use spec-compliant C ABI for `wasm32-unknown-unknown` (default: legacy)" ) ,
19361950 write_long_types_to_disk: bool = ( true , parse_bool, [ UNTRACKED ] ,
19371951 "whether long type names should be written to files instead of being printed in errors" ) ,
19381952 // tidy-alphabetical-end
0 commit comments