Skip to content

Commit b76f6cc

Browse files
committed
Run builtins-test-intrinsics when possible
Currently we only build this, but it is possible to run the binary. Change the CI script to do so here.
1 parent f5449b0 commit b76f6cc

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

builtins-test-intrinsics/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#![no_std]
1414
#![no_main]
1515

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

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

653655
#[unsafe(no_mangle)]
654656
#[cfg(not(thumb))]
655-
fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
657+
extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
656658
run();
657659
0
658660
}
659661

660662
#[unsafe(no_mangle)]
661663
#[cfg(thumb)]
662-
pub fn _start() -> ! {
664+
extern "C" fn _start() -> ! {
663665
run();
664666
loop {}
665667
}

ci/run.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,33 @@ symcheck+=(-- build-and-check)
6363
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-f16-f128
6464
"${symcheck[@]}" -p compiler_builtins --target "$target" --features no-f16-f128 --release
6565

66-
build_intrinsics_test() {
67-
# symcheck also checks the results of builtins-test-intrinsics
68-
"${symcheck[@]}" \
66+
run_intrinsics_test() {
67+
args=(
6968
--target "$target" --verbose \
70-
--manifest-path builtins-test-intrinsics/Cargo.toml "$@"
69+
--manifest-path builtins-test-intrinsics/Cargo.toml
70+
)
71+
args+=( "$@" )
72+
73+
# symcheck also checks the results of builtins-test-intrinsics
74+
"${symcheck[@]}" "${args[@]}"
75+
76+
# FIXME: we get access violations on Windows, our entrypoint may need to
77+
# be tweaked.
78+
if [ "${BUILD_ONLY:-}" != "1" ] && ! [[ "$target" = *"windows"* ]]; then
79+
cargo run "${args[@]}"
80+
fi
7181
}
7282

7383
# Verify that we haven't dropped any intrinsics/symbols
74-
build_intrinsics_test
75-
build_intrinsics_test --release
76-
build_intrinsics_test --features c
77-
build_intrinsics_test --features c --release
84+
run_intrinsics_test
85+
run_intrinsics_test --release
86+
run_intrinsics_test --features c
87+
run_intrinsics_test --features c --release
7888

7989
# Verify that there are no undefined symbols to `panic` within our
8090
# implementations
81-
CARGO_PROFILE_DEV_LTO=true build_intrinsics_test
82-
CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release
91+
CARGO_PROFILE_DEV_LTO=true run_intrinsics_test
92+
CARGO_PROFILE_RELEASE_LTO=true run_intrinsics_test --release
8393

8494
# Test libm
8595

0 commit comments

Comments
 (0)