Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dmd/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ struct Target
OS_FreeBSD = 0x10,
OS_Solaris = 0x20,
OS_DragonFlyBSD = 0x40,
OS_Hurd = 0x80,

// Combination masks
all = OS_linux | OS_Windows | OS_OSX | OS_OpenBSD | OS_FreeBSD | OS_Solaris | OS_DragonFlyBSD,
Posix = OS_linux | OS_OSX | OS_OpenBSD | OS_FreeBSD | OS_Solaris | OS_DragonFlyBSD,
all = OS_linux | OS_Windows | OS_OSX | OS_OpenBSD | OS_FreeBSD | OS_Solaris | OS_DragonFlyBSD | OS_Hurd,
Posix = OS_linux | OS_OSX | OS_OpenBSD | OS_FreeBSD | OS_Solaris | OS_DragonFlyBSD | OS_Hurd,
};

OS os;
Expand Down
5 changes: 4 additions & 1 deletion driver/linker-gcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ void ArgsBuilder::addLTOLinkFlags() {
global.params.targetTriple->isOSFreeBSD() ||
global.params.targetTriple->isOSNetBSD() ||
global.params.targetTriple->isOSOpenBSD() ||
global.params.targetTriple->isOSDragonFly()) {
global.params.targetTriple->isOSDragonFly() ||
global.params.targetTriple->isOSHurd()) {
// LLD supports LLVM LTO natively, do not add the plugin itself.
// Otherwise, assume that ld.gold or ld.bfd is used with plugin support.
addLTOGoldPluginFlags(!isLld);
Expand Down Expand Up @@ -435,6 +436,7 @@ void ArgsBuilder::addCppStdlibLinkFlags(const llvm::Triple &triple) {
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
case llvm::Triple::DragonFly:
case llvm::Triple::Hurd:
args.push_back("-lstdc++");
break;
case llvm::Triple::Darwin:
Expand Down Expand Up @@ -689,6 +691,7 @@ void ArgsBuilder::addDefaultPlatformLibs() {
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
case llvm::Triple::DragonFly:
case llvm::Triple::Hurd:
addSoname = true;
args.push_back("-lpthread");
args.push_back("-lm");
Expand Down
7 changes: 7 additions & 0 deletions driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,13 @@ void registerPredefinedTargetVersions() {
VersionCondition::addPredefinedGlobalIdent("CppRuntime_LLVM");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Clang"); // legacy
break;
case llvm::Triple::Hurd:
VersionCondition::addPredefinedGlobalIdent("Hurd");
VersionCondition::addPredefinedGlobalIdent("Posix");
VersionCondition::addPredefinedGlobalIdent("CRuntime_Glibc");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_GNU");
VersionCondition::addPredefinedGlobalIdent("CppRuntime_Gcc"); // legacy
break;
default:
if (triple.getEnvironment() == llvm::Triple::Android) {
VersionCondition::addPredefinedGlobalIdent("Android");
Expand Down
2 changes: 1 addition & 1 deletion gen/modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ RegistryStyle getModuleRegistryStyle() {
if (t.isOSWindows() || t.getEnvironment() == llvm::Triple::Android ||
t.isOSBinFormatWasm() || t.isOSDarwin() || t.isOSLinux() ||
t.isOSFreeBSD() || t.isOSNetBSD() || t.isOSOpenBSD() ||
t.isOSDragonFly()) {
t.isOSDragonFly() || t.isOSHurd()) {
return RegistryStyle::section;
}

Expand Down
2 changes: 2 additions & 0 deletions gen/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ void Target::_init(const Param &params) {
os = OS_DragonFlyBSD;
} else if (triple.isOSSolaris()) {
os = OS_Solaris;
} else if (triple.isOSHurd()) {
os = OS_Hurd;
Comment thread
yelninei marked this conversation as resolved.
} else {
os = OS_Freestanding;
}
Expand Down
11 changes: 7 additions & 4 deletions runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ else()
endif()

set(SHARED_LIBS_SUPPORTED OFF)
if("${TARGET_SYSTEM}" MATCHES "Windows|Linux|FreeBSD|DragonFly|APPLE")
if("${TARGET_SYSTEM}" MATCHES "Windows|Linux|FreeBSD|DragonFly|APPLE|GNU")
set(SHARED_LIBS_SUPPORTED ON)
endif()

Expand Down Expand Up @@ -175,6 +175,7 @@ file(GLOB_RECURSE DRUNTIME_D_BIONIC ${RUNTIME_DIR}/src/core/sys/bionic/*.d)
file(GLOB_RECURSE DRUNTIME_D_DARWIN ${RUNTIME_DIR}/src/core/sys/darwin/*.d)
file(GLOB_RECURSE DRUNTIME_D_DRAGONFLYBSD ${RUNTIME_DIR}/src/core/sys/dragonflybsd/*.d)
file(GLOB_RECURSE DRUNTIME_D_FREEBSD ${RUNTIME_DIR}/src/core/sys/freebsd/*.d)
file(GLOB_RECURSE DRUNTIME_D_HURD ${RUNTIME_DIR}/src/core/sys/hurd/*.d)
file(GLOB_RECURSE DRUNTIME_D_LINUX ${RUNTIME_DIR}/src/core/sys/linux/*.d)
file(GLOB_RECURSE DRUNTIME_D_NETBSD ${RUNTIME_DIR}/src/core/sys/netbsd/*.d)
file(GLOB_RECURSE DRUNTIME_D_OPENBSD ${RUNTIME_DIR}/src/core/sys/openbsd/*.d)
Expand All @@ -183,9 +184,9 @@ file(GLOB_RECURSE DRUNTIME_D_SOLARIS ${RUNTIME_DIR}/src/core/sys/solaris/*.d)
file(GLOB_RECURSE DRUNTIME_D_WINDOWS ${RUNTIME_DIR}/src/core/sys/windows/*.d)
list(REMOVE_ITEM DRUNTIME_D
${DRUNTIME_D_BIONIC} ${DRUNTIME_D_DARWIN} ${DRUNTIME_D_DRAGONFLYBSD}
${DRUNTIME_D_FREEBSD} ${DRUNTIME_D_LINUX} ${DRUNTIME_D_NETBSD}
${DRUNTIME_D_OPENBSD} ${DRUNTIME_D_POSIX} ${DRUNTIME_D_SOLARIS}
${DRUNTIME_D_WINDOWS}
${DRUNTIME_D_FREEBSD} ${DRUNTIME_D_HURD} ${DRUNTIME_D_LINUX}
${DRUNTIME_D_NETBSD} ${DRUNTIME_D_OPENBSD} ${DRUNTIME_D_POSIX}
${DRUNTIME_D_SOLARIS} ${DRUNTIME_D_WINDOWS}
)
if("${TARGET_SYSTEM}" MATCHES "Windows")
list(APPEND DRUNTIME_D ${DRUNTIME_D_WINDOWS})
Expand All @@ -206,6 +207,8 @@ elseif("${TARGET_SYSTEM}" MATCHES "UNIX")
list(APPEND DRUNTIME_D ${DRUNTIME_D_OPENBSD})
elseif("${TARGET_SYSTEM}" MATCHES "SunOS")
list(APPEND DRUNTIME_D ${DRUNTIME_D_SOLARIS})
elseif("${TARGET_SYSTEM}" MATCHES "GNU")
list(APPEND DRUNTIME_D ${DRUNTIME_D_HURD})
endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions runtime/druntime/src/rt/sections_ldc.d
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ else version (FreeBSD) {}
else version (DragonFlyBSD) {}
else version (NetBSD) {}
else version (OpenBSD) {}
else version (Hurd) {}
else version (Windows) {}
else version (LDC):

Expand Down
Loading