-
Notifications
You must be signed in to change notification settings - Fork 478
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
CC support for wasm32-wali-linux-musl
Tier-3 Linux target
#1373
base: main
Are you sure you want to change the base?
Conversation
wasm32-wali-linux-musl
Tier-3 Linux target
@@ -1363,6 +1363,12 @@ impl Build { | |||
target | |||
)); | |||
} | |||
} else if target.contains("wasm32") && target.contains("linux") { |
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.
Would it be better to do an exact match?
} else if target.contains("wasm32") && target.contains("linux") { | |
} else if target == "wasm32-wali-linux-musl" { |
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.
I'd prefer to avoid .contains
, and use target.arch == "wasm32" && target.os == "linux"
(or similar)
@@ -2178,6 +2184,25 @@ impl Build { | |||
} | |||
|
|||
cmd.push_cc_arg(format!("--target={}", target).into()); | |||
} else if target.contains("wasm32") && target.contains("linux") { |
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.
Same here
// wasm32-linux currently uses the LLVM-18 wasi threads target | ||
cmd.push_cc_arg("--target=wasm32-wasi-threads".into()); | ||
for x in &[ | ||
"atomics", | ||
"bulk-memory", | ||
"mutable-globals", | ||
"sign-ext", | ||
"exception-handling", | ||
] { | ||
cmd.push_cc_arg(format!("-m{}", x).into()); | ||
} | ||
for x in &["wasm-exceptions", "declspec"] { | ||
cmd.push_cc_arg(format!("-f{}", x).into()); | ||
} | ||
let musl_sysroot = self.wasm_musl_sysroot().unwrap(); | ||
cmd.push_cc_arg( | ||
format!("--sysroot={}", Path::new(&musl_sysroot).display()).into(), | ||
); |
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.
cc @madsmtm do you think we can use gen-target-info to auto generate this information?
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.
Hmm, the EDIT: Wrote this in other review comments.--target
at least definitely looks odd?
But yeah, we should definitely look into taking atomics
/buld-memory
/... from rustc
's target data instead of hardcoding it here.
Having these conditions rely on just |
I'd also really rather prefer not using the full target if we can. |
@@ -2178,6 +2184,25 @@ impl Build { | |||
} | |||
|
|||
cmd.push_cc_arg(format!("--target={}", target).into()); | |||
} else if target.contains("wasm32") && target.contains("linux") { | |||
// wasm32-linux currently uses the LLVM-18 wasi threads target | |||
cmd.push_cc_arg("--target=wasm32-wasi-threads".into()); |
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.
The use of --target
seems odd? It is not clear why we are passing a different target here than the llvm_target
in rustc
's Target
, which is set to wasm32-wasi
?
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.
This configuration is similar to wasm32-wasip1-threads
, which uses the wasm32-wasi
llvm target. I am not sure using llvm_target as wasm32-wasi-threads
breaks any pattern matching within rustc, so I stuck to what the former currently does.
To support the new Tier-3 target
wasm32-wali-linux-musl
within the rust compiler: rust-lang/rust#135651Minimally, this just supports providing appropriate musl library linking and flags for the target