diff options
author | Steven Wu <stevenwu@apple.com> | 2015-08-05 15:36:38 +0000 |
---|---|---|
committer | Steven Wu <stevenwu@apple.com> | 2015-08-05 15:36:38 +0000 |
commit | 9927206f8c827bd00f1fc404a6327e97ddd1776a (patch) | |
tree | 78d081d2f2510f1d17ad4f7af323bf82b0db03ee /llvm/lib/MC/MCMachOStreamer.cpp | |
parent | 2556a1efec43c86927ecf977a9d00fd7442cfdc1 (diff) | |
download | llvm-9927206f8c827bd00f1fc404a6327e97ddd1776a.zip llvm-9927206f8c827bd00f1fc404a6327e97ddd1776a.tar.gz llvm-9927206f8c827bd00f1fc404a6327e97ddd1776a.tar.bz2 |
Force the MachO generated for Darwin to have VERSION_MIN load command
On Darwin, it is required to stamp the object file with VERSION_MIN load
command. This commit will provide a VERSRION_MIN load command to the
MachO file that doesn't specify the version itself by inferring from
Target Triple.
llvm-svn: 244059
Diffstat (limited to 'llvm/lib/MC/MCMachOStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCMachOStreamer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index 53cd131..116ef09 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -493,6 +493,16 @@ MCStreamer *llvm::createMachOStreamer(MCContext &Context, MCAsmBackend &MAB, bool LabelSections) { MCMachOStreamer *S = new MCMachOStreamer(Context, MAB, OS, CE, DWARFMustBeAtTheEnd, LabelSections); + const Triple &TT = Context.getObjectFileInfo()->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) + S->EmitVersionMin((TT.isMacOSX() ? + MCVM_OSXVersionMin : MCVM_IOSVersionMin), + Major, Minor, Update); + } if (RelaxAll) S->getAssembler().setRelaxAll(true); return S; |