Skip to content

Commit c53484a

Browse files
Julianclaude
andcommitted
Reserve Mach-O header padding on macOS so install_name_tool can relocate.
Apple's new linker (ld_prime), used on macOS 15 runners, reserves far less header padding than the old ld. Tools like Homebrew rewrite the install name of installed dylibs, which needs spare header space; without it the relink fails with "updated load commands do not fit in the header". Mirrors pyca/cryptography#14777, which fixed the same regression there. Fixes #200. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 69157e8 commit c53484a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main() {
2+
// macOS 15 runners use Apple's new linker (ld_prime), which reserves
3+
// far less Mach-O header padding than the old ld. Tools like Homebrew
4+
// run install_name_tool on installed dylibs, which needs spare header
5+
// space; without this flag the relink fails with "updated load commands
6+
// do not fit in the header". See crate-py/rpds#200, and pyca/cryptography
7+
// hit the same regression when its CI moved to macos-15.
8+
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
9+
println!("cargo:rustc-link-arg=-Wl,-headerpad_max_install_names");
10+
}
11+
}

0 commit comments

Comments
 (0)