diff options
author | Jim Grosbach <grosbach@apple.com> | 2014-03-18 22:09:08 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2014-03-18 22:09:08 +0000 |
commit | e133cd2ea2089cc1860e687a6946d102b90f8dfb (patch) | |
tree | 96200fc7971262085d63f3fca0fb0148124ff3ce /lib | |
parent | d55fc3f151f3167da4aa467cf2ff4038f82e3664 (diff) | |
download | llvm-e133cd2ea2089cc1860e687a6946d102b90f8dfb.tar.gz llvm-e133cd2ea2089cc1860e687a6946d102b90f8dfb.tar.bz2 llvm-e133cd2ea2089cc1860e687a6946d102b90f8dfb.tar.xz |
MachO: Emit a version-min load command when possible.
When deployment target version information is available, emit it to the
target streamer for inclusion in the object file.
rdar://11337778
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 8131662570..086b08173e 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -178,6 +178,25 @@ bool AsmPrinter::doInitialization(Module &M) { Mang = new Mangler(TM.getDataLayout()); + // Emit the version-min deplyment target directive if needed. + // + // FIXME: If we end up with a collection of these sorts of Darwin-specific + // or ELF-specific things, it may make sense to have a platform helper class + // that will work with the target helper class. For now keep it here, as the + // alternative is duplicated code in each of the target asm printers that + // use the directive, where it would need the same conditionalization + // anyway. + Triple TT(getTargetTriple()); + if (TT.isOSDarwin()) { + unsigned Major, Minor, Update; + TT.getOSVersion(Major, Minor, Update); + // If there is a version specified, Major will be non-zero. + if (Major) + OutStreamer.EmitVersionMin((TT.isMacOSX() ? + MCVM_OSXVersionMin : MCVM_IOSVersionMin), + Major, Minor, Update); + } + // Allow the target to emit any magic that it wants at the start of the file. EmitStartOfAsmFile(M); |