This is an archive of the discontinued LLVM Phabricator instance.

[macho] save the SDK version stored in module metadata into the version min and build version load commands in the object file
ClosedPublic

Authored by arphaman on Dec 12 2018, 1:11 PM.

Details

Summary

This patch introduces a new metadata node called "SDK Version". It will be set by the frontend to mark the platform SDK (macOS/iOS/etc) version which was used during that particular compilation.
This node is used when machine code is emitted, by either saving the SDK version into the appropriate macho load command (version min/build version), or by emitting the assembly for these load commands with the SDK version specified as well.
The assembly for both load commands is extended by allowing it to contain the sdk_version X, Y [, Z] trailing directive to represent the SDK version respectively.

Diff Detail

Repository
rL LLVM

Event Timeline

arphaman created this revision.Dec 12 2018, 1:11 PM
arphaman added a reviewer: ab.Dec 12 2018, 1:25 PM

Don't we need IR support for this as well? sdk version is not in the triple so it is going to get lost when building from IR. Maybe use a metadata node?

Don't we need IR support for this as well? sdk version is not in the triple so it is going to get lost when building from IR. Maybe use a metadata node?

I provide a way to set and retrieve the SDK version from the IR using the "SDK Version" metadata. Do I need something more than that? Clang can set it and we are already getting it in this patch.

Don't we need IR support for this as well? sdk version is not in the triple so it is going to get lost when building from IR. Maybe use a metadata node?

I provide a way to set and retrieve the SDK version from the IR using the "SDK Version" metadata. Do I need something more than that? Clang can set it and we are already getting it in this patch.

I am talking about Bitcode format support and Metadata in Bitcode prospective. The reason is that you don't necessary have SDK information when you building from bitcode. I am ok to do that as a followup if you think that is better.

steven_wu accepted this revision.Dec 12 2018, 3:58 PM

I think I missed something before. LGTM now!

This revision is now accepted and ready to land.Dec 12 2018, 3:58 PM
This revision was automatically updated to reflect the committed changes.