Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a minimum OS version for MachO objects #8323

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/LLVM_Runtime_Linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,18 @@ llvm::Triple get_triple_for_target(const Target &target) {
// Return default-constructed triple. Must be set later.
}

// Setting a minimum OS version here enables LLVM to include platform
// metadata in the MachO object file. Without this, Xcode 15's ld
// issues warnings about missing the "platform load command".
if (triple.isOSBinFormatMachO()) {
const llvm::VersionTuple minVer = triple.getMinimumSupportedOSVersion();
if (!minVer.empty()) {
const llvm::StringRef name = triple.getOSName();
// llvm::Triple determines the version by parsing the OSName.
triple.setOSName(name.str() + minVer.getAsString());
}
}

return triple;
}

Expand Down
Loading