[macho] save the SDK version stored in module metadata into the version min and
authorAlex Lorenz <arphaman@gmail.com>
Fri, 14 Dec 2018 01:14:10 +0000 (01:14 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Fri, 14 Dec 2018 01:14:10 +0000 (01:14 +0000)
commitafa75d7843c92a7ac9a194f4b1a2396c03e3efd8
tree0b2627d35b4422489fa052fc40254da1fd8f3369
parent4065da29f071f736f8f1314847939e7859942e91
[macho] save the SDK version stored in module metadata into the version min and
build version load commands in the object file

This commit 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.

rdar://45774000

Differential Revision: https://reviews.llvm.org/D55612

llvm-svn: 349119
19 files changed:
llvm/include/llvm/IR/Module.h
llvm/include/llvm/MC/MCAssembler.h
llvm/include/llvm/MC/MCObjectFileInfo.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/IR/Module.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCMachOStreamer.cpp
llvm/lib/MC/MCParser/DarwinAsmParser.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/MC/MachObjectWriter.cpp
llvm/lib/Object/ModuleSymbolTable.cpp
llvm/test/MC/MachO/ARM/build-version-sdk-version-errors.c [new file with mode: 0644]
llvm/test/MC/MachO/ARM/build-version-sdk-version.s [new file with mode: 0644]
llvm/test/MC/MachO/build-version-with-sdk-version.s [new file with mode: 0644]
llvm/test/MC/MachO/darwin-sdk-version.ll [new file with mode: 0644]
llvm/test/MC/MachO/osx-version-min-load-command-with-sdk-errors.s [new file with mode: 0644]
llvm/test/MC/MachO/osx-version-min-load-command-with-sdk.s [new file with mode: 0644]