Skip to content

Commit a1f1565

Browse files
committed
rewrite macos-deployment-target to rmake
1 parent 2b78d92 commit a1f1565

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
@@ -16,7 +16,6 @@ run-make/libtest-junit/Makefile
1616
run-make/libtest-thread-limit/Makefile
1717
run-make/long-linker-command-lines-cmd-exe/Makefile
1818
run-make/long-linker-command-lines/Makefile
19-
run-make/macos-deployment-target/Makefile
2019
run-make/min-global-align/Makefile
2120
run-make/native-link-modifier-bundle/Makefile
2221
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)