[clang][macho] add clang frontend support for emitting macho files with two build...
authorAlex Lorenz <arphaman@gmail.com>
Wed, 2 Feb 2022 08:19:49 +0000 (00:19 -0800)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 2 Feb 2022 16:30:39 +0000 (08:30 -0800)
commit116c1bea65ac268bc46a2373220c81d02fc0a256
tree294819c7088249fa8de575c7cfd3aa1fe51b8b94
parent6440197ba5bfc05c1fda74e11f6dbe93c1b5dea6
[clang][macho] add clang frontend support for emitting macho files with two build version load commands

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.

Differential Revision: https://reviews.llvm.org/D115415
clang/include/clang/Basic/TargetInfo.h
clang/include/clang/Basic/TargetOptions.h
clang/include/clang/Driver/Options.td
clang/lib/Basic/Targets.cpp
clang/lib/CodeGen/ModuleBuilder.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/darwin-target-variant.c [new file with mode: 0644]
llvm/include/llvm/IR/Module.h
llvm/lib/IR/Module.cpp