Skip to content

Update the compiler-builtins subtree #143405

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

Merged
merged 14 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
symcheck: Make target a positional argument
This makes it more obvious what we intend to check rather than looking
for `--target`.
  • Loading branch information
tgross35 committed Jul 4, 2025
commit e164811f5d69c00baf93694dfe203001b40ecdeb
27 changes: 12 additions & 15 deletions library/compiler-builtins/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,26 @@ symcheck=(cargo run -p symbol-check --release)
[[ "$target" = "wasm"* ]] && symcheck+=(--features wasm)
symcheck+=(-- build-and-check)

"${symcheck[@]}" -p compiler_builtins --target "$target"
"${symcheck[@]}" -p compiler_builtins --target "$target" --release
"${symcheck[@]}" -p compiler_builtins --target "$target" --features c
"${symcheck[@]}" -p compiler_builtins --target "$target" --features c --release
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-asm
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-asm --release
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-f16-f128
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-f16-f128 --release
"${symcheck[@]}" "$target" -- -p compiler_builtins
"${symcheck[@]}" "$target" -- -p compiler_builtins --release
"${symcheck[@]}" "$target" -- -p compiler_builtins --features c
"${symcheck[@]}" "$target" -- -p compiler_builtins --features c --release
"${symcheck[@]}" "$target" -- -p compiler_builtins --features no-asm
"${symcheck[@]}" "$target" -- -p compiler_builtins --features no-asm --release
"${symcheck[@]}" "$target" -- -p compiler_builtins --features no-f16-f128
"${symcheck[@]}" "$target" -- -p compiler_builtins --features no-f16-f128 --release

run_intrinsics_test() {
args=(
--target "$target" --verbose \
--manifest-path builtins-test-intrinsics/Cargo.toml
)
args+=( "$@" )
build_args=(--verbose --manifest-path builtins-test-intrinsics/Cargo.toml)
build_args+=("$@")

# symcheck also checks the results of builtins-test-intrinsics
"${symcheck[@]}" "${args[@]}"
"${symcheck[@]}" "$target" -- "${build_args[@]}"

# FIXME: we get access violations on Windows, our entrypoint may need to
# be tweaked.
if [ "${BUILD_ONLY:-}" != "1" ] && ! [[ "$target" = *"windows"* ]]; then
cargo run "${args[@]}"
cargo run --target "$target" "${build_args[@]}"
fi
}

Expand Down
37 changes: 23 additions & 14 deletions library/compiler-builtins/crates/symbol-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ const CHECK_EXTENSIONS: &[Option<&str>] = &[Some("rlib"), Some("a"), Some("exe")

const USAGE: &str = "Usage:

symbol-check build-and-check CARGO_ARGS ...
symbol-check build-and-check [TARGET] -- CARGO_BUILD_ARGS ...

Cargo will get invoked with `CARGO_ARGS` and all output
Cargo will get invoked with `CARGO_ARGS` and the specified target. All output
`compiler_builtins*.rlib` files will be checked.

If TARGET is not specified, the host target is used.
";

fn main() {
Expand All @@ -30,11 +32,13 @@ fn main() {
let args_ref = args.iter().map(String::as_str).collect::<Vec<_>>();

match &args_ref[1..] {
["build-and-check", "--target", target, args @ ..] if !args.is_empty() => {
run_build_and_check(Some(target), args);
["build-and-check", target, "--", args @ ..] if !args.is_empty() => {
check_cargo_args(args);
run_build_and_check(target, args);
}
["build-and-check", args @ ..] if !args.is_empty() => {
run_build_and_check(None, args);
["build-and-check", "--", args @ ..] if !args.is_empty() => {
check_cargo_args(args);
run_build_and_check(&host_target(), args);
}
_ => {
println!("{USAGE}");
Expand All @@ -43,7 +47,18 @@ fn main() {
}
}

fn run_build_and_check(target: Option<&str>, args: &[&str]) {
/// Make sure `--target` isn't passed to avoid confusion (since it should be proivded only once,
/// positionally).
fn check_cargo_args(args: &[&str]) {
for arg in args {
assert!(
!arg.contains("--target"),
"target must be passed positionally. {USAGE}"
);
}
}

fn run_build_and_check(target: &str, args: &[&str]) {
let paths = exec_cargo_with_args(target, args);
for path in paths {
println!("Checking {}", path.display());
Expand All @@ -70,13 +85,7 @@ fn host_target() -> String {

/// Run `cargo build` with the provided additional arguments, collecting the list of created
/// libraries.
fn exec_cargo_with_args(target: Option<&str>, args: &[&str]) -> Vec<PathBuf> {
let mut host = String::new();
let target = target.unwrap_or_else(|| {
host = host_target();
host.as_str()
});

fn exec_cargo_with_args(target: &str, args: &[&str]) -> Vec<PathBuf> {
let mut cmd = Command::new("cargo");
cmd.args(["build", "--target", target, "--message-format=json"])
.args(args)
Expand Down