mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
Default to PIC on OS X.
driver/target.h is due for a refactoring after the next release is branched off.
This commit is contained in:
parent
4597423dc5
commit
edbace8ae8
2 changed files with 8 additions and 1 deletions
|
@ -547,7 +547,7 @@ int main(int argc, char** argv)
|
||||||
VersionCondition::addPredefinedGlobalIdent("D_LP64");
|
VersionCondition::addPredefinedGlobalIdent("D_LP64");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRelocModel == llvm::Reloc::PIC_) {
|
if (gTargetMachine->getRelocationModel() == llvm::Reloc::PIC_) {
|
||||||
VersionCondition::addPredefinedGlobalIdent("D_PIC");
|
VersionCondition::addPredefinedGlobalIdent("D_PIC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,13 @@ llvm::TargetMachine* createTargetMachine(
|
||||||
FeaturesStr = Features.getString();
|
FeaturesStr = Features.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (triple.isMacOSX() && relocModel == llvm::Reloc::Default)
|
||||||
|
{
|
||||||
|
// OS X defaults to PIC (and as of 10.7.5/LLVM 3.1-3.3, TLS use leads
|
||||||
|
// to crashes for non-PIC code). LLVM doesn't handle this.
|
||||||
|
relocModel = llvm::Reloc::PIC_;
|
||||||
|
}
|
||||||
|
|
||||||
#if LDC_LLVM_VER == 300
|
#if LDC_LLVM_VER == 300
|
||||||
llvm::NoFramePointerElim = genDebugInfo;
|
llvm::NoFramePointerElim = genDebugInfo;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue