Skip to content

Commit d4e07d0

Browse files
committed
rewrite macos-deployment-target to rmake
1 parent e60ebb2 commit d4e07d0

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ run-make/libtest-thread-limit/Makefile
2828
run-make/link-cfg/Makefile
2929
run-make/long-linker-command-lines-cmd-exe/Makefile
3030
run-make/long-linker-command-lines/Makefile
31-
run-make/macos-deployment-target/Makefile
3231
run-make/min-global-align/Makefile
3332
run-make/native-link-modifier-bundle/Makefile
3433
run-make/no-alloc-shim/Makefile

tests/run-make/macos-deployment-target/Makefile

-21
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Check that a set deployment target actually makes it to the linker.
2+
// This is important since its a compatibility hazard. The linker will
3+
// generate load commands differently based on what minimum OS it can assume.
4+
// See https://github.com/rust-lang/rust/pull/105123
5+
6+
//@ only-macos
7+
8+
use run_make_support::{cmd, rustc};
9+
10+
fn main() {
11+
rustc()
12+
.env("MACOSX_DEPLOYMENT_TARGET", "10.13")
13+
.input("with_deployment_target.rs")
14+
.output("with_deployment_target.dylib")
15+
.run();
16+
let pattern = if cmd("uname").arg("-m").run().stdout_utf8().contains("arm64") {
17+
"minos 11.0"
18+
} else {
19+
"version 10.13"
20+
};
21+
// XXX: The check is for either the x86_64 minimum OR the aarch64 minimum
22+
// (M1 starts at macOS 11). They also use different load commands, so we let that change with
23+
// each too. The aarch64 check isn't as robust as the x86 one, but testing both seems unneeded.
24+
cmd("vtool")
25+
.arg("-show-build")
26+
.arg("with_deployment_target.dylib")
27+
.run()
28+
.assert_stdout_contains("pattern");
29+
}

0 commit comments

Comments
 (0)