Do not specify an SDK version in object files
This is unnecessary, since it ends up being overwritten when linking anyhow, and it feels wrong to embed some arbitrary SDK version in here.
This commit is contained in:
@@ -402,13 +402,17 @@ fn macho_object_build_version_for_target(target: &Target) -> object::write::Mach
|
||||
let platform =
|
||||
rustc_target::spec::current_apple_platform(target).expect("unknown Apple target OS");
|
||||
let min_os = rustc_target::spec::current_apple_deployment_target(target);
|
||||
let (sdk_major, sdk_minor) =
|
||||
rustc_target::spec::current_apple_sdk_version(platform).expect("unknown Apple target OS");
|
||||
|
||||
let mut build_version = object::write::MachOBuildVersion::default();
|
||||
build_version.platform = platform;
|
||||
build_version.minos = pack_version(min_os);
|
||||
build_version.sdk = pack_version((sdk_major, sdk_minor, 0));
|
||||
// The version here does not _really_ matter, since it is only used at runtime, and we specify
|
||||
// it when linking the final binary, so we will omit the version. This is also what LLVM does,
|
||||
// and the tooling also allows this (and shows the SDK version as `n/a`). Finally, it is the
|
||||
// semantically correct choice, as the SDK has not influenced the binary generated by rustc at
|
||||
// this point in time.
|
||||
build_version.sdk = 0;
|
||||
|
||||
build_version
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user