Skip to content

Commit 24bd243

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 af81023 commit 24bd243

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

builtins-test-intrinsics/src/main.rs

Lines changed: 4 additions & 3 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
@@ -594,7 +596,6 @@ fn run() {
594596
bb(floatunsitf(bb(2)));
595597
bb(floatuntidf(bb(2)));
596598
bb(floatuntisf(bb(2)));
597-
#[cfg(f128_enabled)]
598599
bb(floatuntitf(bb(2)));
599600
#[cfg(f128_enabled)]
600601
bb(gttf(bb(2.), bb(2.)));
@@ -652,14 +653,14 @@ fn something_with_a_dtor(f: &dyn Fn()) {
652653

653654
#[unsafe(no_mangle)]
654655
#[cfg(not(thumb))]
655-
fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
656+
extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int {
656657
run();
657658
0
658659
}
659660

660661
#[unsafe(no_mangle)]
661662
#[cfg(thumb)]
662-
pub fn _start() -> ! {
663+
extern "C" fn _start() -> ! {
663664
run();
664665
loop {}
665666
}

ci/run.sh

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,31 @@ 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+
if [ "${BUILD_ONLY:-}" != "1" ]; then
77+
cargo run "${args[@]}"
78+
fi
7179
}
7280

7381
# 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
82+
run_intrinsics_test
83+
run_intrinsics_test --release
84+
run_intrinsics_test --features c
85+
run_intrinsics_test --features c --release
7886

7987
# Verify that there are no undefined symbols to `panic` within our
8088
# implementations
81-
CARGO_PROFILE_DEV_LTO=true build_intrinsics_test
82-
CARGO_PROFILE_RELEASE_LTO=true build_intrinsics_test --release
89+
CARGO_PROFILE_DEV_LTO=true run_intrinsics_test
90+
CARGO_PROFILE_RELEASE_LTO=true run_intrinsics_test --release
8391

8492
# Test libm
8593

0 commit comments

Comments
 (0)