Skip to content

Run builtins-test-intrinsics when possible #804

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 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 4 additions & 2 deletions builtins-test-intrinsics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#![no_std]
#![no_main]

// Ensure this `compiler_builtins` gets used, rather than the version injected from the sysroot.
extern crate compiler_builtins;
extern crate panic_handler;

// SAFETY: no definitions, only used for linking
Expand Down Expand Up @@ -652,14 +654,14 @@ fn something_with_a_dtor(f: &dyn Fn()) {

#[unsafe(no_mangle)]
#[cfg(not(thumb))]
fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
run();
0
}

#[unsafe(no_mangle)]
#[cfg(thumb)]
pub fn _start() -> ! {
extern "C" fn _start() -> ! {
run();
loop {}
}
Expand Down
30 changes: 20 additions & 10 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,33 @@ symcheck+=(-- build-and-check)
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-f16-f128
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-f16-f128 --release

build_intrinsics_test() {
# symcheck also checks the results of builtins-test-intrinsics
"${symcheck[@]}" \
run_intrinsics_test() {
args=(
--target "$target" --verbose \
--manifest-path builtins-test-intrinsics/Cargo.toml "$@"
--manifest-path builtins-test-intrinsics/Cargo.toml
)
args+=( "$@" )

# symcheck also checks the results of builtins-test-intrinsics
"${symcheck[@]}" "${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[@]}"
fi
}

# Verify that we haven't dropped any intrinsics/symbols
build_intrinsics_test
build_intrinsics_test --release
build_intrinsics_test --features c
build_intrinsics_test --features c --release
run_intrinsics_test
run_intrinsics_test --release
run_intrinsics_test --features c
run_intrinsics_test --features c --release

# Verify that there are no undefined symbols to `panic` within our
# implementations
CARGO_PROFILE_DEV_LTO=true build_intrinsics_test
CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release
CARGO_PROFILE_DEV_LTO=true run_intrinsics_test
CARGO_PROFILE_RELEASE_LTO=true run_intrinsics_test --release

# Test libm

Expand Down