summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2015-08-05 15:36:38 +0000
committerSteven Wu <stevenwu@apple.com>2015-08-05 15:36:38 +0000
commit9927206f8c827bd00f1fc404a6327e97ddd1776a (patch)
tree78d081d2f2510f1d17ad4f7af323bf82b0db03ee /llvm/lib/MC
parent2556a1efec43c86927ecf977a9d00fd7442cfdc1 (diff)
downloadbcm5719-llvm-9927206f8c827bd00f1fc404a6327e97ddd1776a.tar.gz
bcm5719-llvm-9927206f8c827bd00f1fc404a6327e97ddd1776a.zip
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')
-rw-r--r--llvm/lib/MC/MCMachOStreamer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 53cd1317a3d..116ef094d18 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;
OpenPOWER on IntegriCloud