Skip to content

Commit

Permalink
rewrite macos-deployment-target to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Aug 1, 2024
1 parent e60ebb2 commit d4e07d0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ run-make/libtest-thread-limit/Makefile
run-make/link-cfg/Makefile
run-make/long-linker-command-lines-cmd-exe/Makefile
run-make/long-linker-command-lines/Makefile
run-make/macos-deployment-target/Makefile
run-make/min-global-align/Makefile
run-make/native-link-modifier-bundle/Makefile
run-make/no-alloc-shim/Makefile
Expand Down
21 changes: 0 additions & 21 deletions tests/run-make/macos-deployment-target/Makefile

This file was deleted.

29 changes: 29 additions & 0 deletions tests/run-make/macos-deployment-target/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Check that a set deployment target actually makes it to the linker.
// This is important since its a compatibility hazard. The linker will
// generate load commands differently based on what minimum OS it can assume.
// See https://github.com/rust-lang/rust/pull/105123

//@ only-macos

use run_make_support::{cmd, rustc};

fn main() {
rustc()
.env("MACOSX_DEPLOYMENT_TARGET", "10.13")
.input("with_deployment_target.rs")
.output("with_deployment_target.dylib")
.run();
let pattern = if cmd("uname").arg("-m").run().stdout_utf8().contains("arm64") {
"minos 11.0"
} else {
"version 10.13"
};
// XXX: The check is for either the x86_64 minimum OR the aarch64 minimum
// (M1 starts at macOS 11). They also use different load commands, so we let that change with
// each too. The aarch64 check isn't as robust as the x86 one, but testing both seems unneeded.
cmd("vtool")
.arg("-show-build")
.arg("with_deployment_target.dylib")
.run()
.assert_stdout_contains("pattern");
}

0 comments on commit d4e07d0

Please sign in to comment.