This is an archive of the discontinued LLVM Phabricator instance.

[clang][macho] add clang frontend support for emitting macho files with two build version load commands
ClosedPublic

Authored by arphaman on Dec 8 2021, 5:54 PM.

Details

Summary

This patch extends clang frontend to add metadata that can be used to emit macho files with two build version load commands.
It utilizes "darwin.target_variant.triple" and "darwin.target_variant.SDK Version" metadata names for that.

MachO uses two build version load commands to represent an object file / binary that is targeting both the macOS target,
and the Mac Catalyst target. At runtime, a dynamic library that supports both targets can be loaded from either a native
macOS or a Mac Catalyst app on a macOS system. We want to add support to this to upstream to LLVM to be able to build
compiler-rt for both targets, to finish the complete support for the Mac Catalyst platform, which is right now targetable
by upstream clang, but the compiler-rt bits aren't supported because of the lack of this multiple build version support.

Follow-up to https://reviews.llvm.org/D112189, I'm working on final two patches, to add clang driver support, and change compiler-rt to build with target variant.

Diff Detail

Event Timeline

arphaman created this revision.Dec 8 2021, 5:54 PM
arphaman requested review of this revision.Dec 8 2021, 5:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2021, 5:54 PM
arphaman added a subscriber: thakis.Dec 8 2021, 5:54 PM
dexonsmith accepted this revision.Dec 8 2021, 6:12 PM

This LGTM, but I came across it pretty quickly; might be worth leaving for a couple of days in case someone else has comments.

This revision is now accepted and ready to land.Dec 8 2021, 6:12 PM
steven_wu accepted this revision.Dec 10 2021, 9:09 AM

I saw another change trying to add a separate runtime for Mac Catalyst in compiler-rt: https://reviews.llvm.org/D117924. I patched that one in and it looks worked for us.

Also friendly pinging for this change (and catalyst support in compiler-rt). We were kind of blocked by this in chromium :)

bc-lee added a subscriber: bc-lee.Jan 26 2022, 4:41 PM
This revision was landed with ongoing or failed builds.Feb 2 2022, 8:31 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2022, 8:31 AM