mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 00:20:40 +03:00
Add more support for xBSD type OS.
Use the same code for FreeBSD, NetBSD, OpenBSD and DragonFly BSD.
This commit is contained in:
parent
f94c34ea33
commit
8df1f7ec1a
4 changed files with 34 additions and 7 deletions
|
@ -176,6 +176,8 @@ static int linkObjToBinaryGcc(bool sharedLib, bool fullyStatic) {
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case llvm::Triple::FreeBSD:
|
case llvm::Triple::FreeBSD:
|
||||||
case llvm::Triple::NetBSD:
|
case llvm::Triple::NetBSD:
|
||||||
|
case llvm::Triple::OpenBSD:
|
||||||
|
case llvm::Triple::DragonFly:
|
||||||
addSoname = true;
|
addSoname = true;
|
||||||
args.push_back("-lpthread");
|
args.push_back("-lpthread");
|
||||||
args.push_back("-lm");
|
args.push_back("-lm");
|
||||||
|
|
|
@ -125,9 +125,8 @@ static std::string getX86TargetCPU(const llvm::Triple &triple) {
|
||||||
// Intel Macs are relatively recent, take advantage of that.
|
// Intel Macs are relatively recent, take advantage of that.
|
||||||
if (triple.isOSDarwin()) {
|
if (triple.isOSDarwin()) {
|
||||||
return triple.isArch64Bit() ? "core2" : "yonah";
|
return triple.isArch64Bit() ? "core2" : "yonah";
|
||||||
|
|
||||||
// Everything else goes to x86-64 in 64-bit mode.
|
|
||||||
}
|
}
|
||||||
|
// Everything else goes to x86-64 in 64-bit mode.
|
||||||
if (triple.isArch64Bit()) {
|
if (triple.isArch64Bit()) {
|
||||||
return "x86-64";
|
return "x86-64";
|
||||||
}
|
}
|
||||||
|
@ -145,9 +144,15 @@ static std::string getX86TargetCPU(const llvm::Triple &triple) {
|
||||||
}
|
}
|
||||||
if (triple.getOSName().startswith("netbsd")) {
|
if (triple.getOSName().startswith("netbsd")) {
|
||||||
return "i486";
|
return "i486";
|
||||||
|
}
|
||||||
|
if (triple.getOSName().startswith("openbsd")) {
|
||||||
|
return "i486";
|
||||||
|
}
|
||||||
|
if (triple.getOSName().startswith("dragonfly")) {
|
||||||
|
return "i486";
|
||||||
|
}
|
||||||
// All x86 devices running Android have core2 as their common
|
// All x86 devices running Android have core2 as their common
|
||||||
// denominator. This makes a better choice than pentium4.
|
// denominator. This makes a better choice than pentium4.
|
||||||
}
|
|
||||||
if (triple.getEnvironment() == llvm::Triple::Android) {
|
if (triple.getEnvironment() == llvm::Triple::Android) {
|
||||||
return "core2";
|
return "core2";
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,17 @@ unsigned Target::critsecsize() {
|
||||||
if (global.params.targetTriple.isOSWindows()) {
|
if (global.params.targetTriple.isOSWindows()) {
|
||||||
return global.params.is64bit ? 40 : 24;
|
return global.params.is64bit ? 40 : 24;
|
||||||
}
|
}
|
||||||
if (global.params.targetTriple.getOS() == llvm::Triple::FreeBSD) {
|
if (global.params.targetTriple.isOSFreeBSD() ||
|
||||||
|
#if LDC_LLVM_VER > 305
|
||||||
|
global.params.targetTriple.isOSNetBSD() ||
|
||||||
|
global.params.targetTriple.isOSOpenBSD() ||
|
||||||
|
global.params.targetTriple.isOSDragonFly()
|
||||||
|
#else
|
||||||
|
global.params.targetTriple.getOS() == llvm::Triple::NetBSD ||
|
||||||
|
global.params.targetTriple.getOS() == llvm::Triple::OpenBSD ||
|
||||||
|
global.params.targetTriple.getOS() == llvm::Triple::DragonFly
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
return sizeof(size_t);
|
return sizeof(size_t);
|
||||||
}
|
}
|
||||||
return sizeof(pthread_mutex_t);
|
return sizeof(pthread_mutex_t);
|
||||||
|
|
|
@ -662,8 +662,18 @@ LLStructType *DtoMutexType() {
|
||||||
return mutex;
|
return mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FreeBSD
|
// FreeBSD, NetBSD, OpenBSD, DragonFly
|
||||||
if (global.params.targetTriple.getOS() == llvm::Triple::FreeBSD) {
|
if (global.params.targetTriple.isOSFreeBSD() ||
|
||||||
|
#if LDC_LLVM_VER > 305
|
||||||
|
global.params.targetTriple.isOSNetBSD() ||
|
||||||
|
global.params.targetTriple.isOSOpenBSD() ||
|
||||||
|
global.params.targetTriple.isOSDragonFly()
|
||||||
|
#else
|
||||||
|
global.params.targetTriple.getOS() == llvm::Triple::NetBSD ||
|
||||||
|
global.params.targetTriple.getOS() == llvm::Triple::OpenBSD ||
|
||||||
|
global.params.targetTriple.getOS() == llvm::Triple::DragonFly
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
// Just a pointer
|
// Just a pointer
|
||||||
return LLStructType::get(gIR->context(), DtoSize_t());
|
return LLStructType::get(gIR->context(), DtoSize_t());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue