about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-03-19 04:10:03 +0000
committerTrevor Gross <tmgross@umich.edu>2025-05-29 18:46:06 +0000
commitc136fb7734716a078cd82a7364245128923eb7e4 (patch)
treec6668c47037eee3d30908bbaf043565b9f05d212
parent7db8cf1fea87dd42082ac6eeb405e609628ac6b1 (diff)
downloadrust-c136fb7734716a078cd82a7364245128923eb7e4.tar.gz
rust-c136fb7734716a078cd82a7364245128923eb7e4.zip
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.
-rw-r--r--library/compiler-builtins/builtins-test-intrinsics/src/main.rs6
-rwxr-xr-xlibrary/compiler-builtins/ci/run.sh30
2 files changed, 24 insertions, 12 deletions
diff --git a/library/compiler-builtins/builtins-test-intrinsics/src/main.rs b/library/compiler-builtins/builtins-test-intrinsics/src/main.rs
index 96fe4a73851..66744a0817f 100644
--- a/library/compiler-builtins/builtins-test-intrinsics/src/main.rs
+++ b/library/compiler-builtins/builtins-test-intrinsics/src/main.rs
@@ -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
@@ -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 {}
 }
diff --git a/library/compiler-builtins/ci/run.sh b/library/compiler-builtins/ci/run.sh
index cf3f7dfda1d..27b9686eac6 100755
--- a/library/compiler-builtins/ci/run.sh
+++ b/library/compiler-builtins/ci/run.sh
@@ -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