Hi,

Here is the part for dmd.
dmd: Port the codegen backend. This is mostly just adding a new platform and 
adding it to a lot of checks for the platform. I dont claim to fully understand 
the backend part but following existing code paths for linux/bsd seems to work.

dmd-tests: mostly skipping tests that are 32bit only/64bit only / windows only


The reason i am confident is that with this change all dmd compiler tests pass 
on x86 and x86_64 for me, except 

- dmd/compiler/test/dshell/sameenv.d : checks that 2 executables have the same 
environment variables but they expectedly differ in LD_ORIGIN_PATH
- dmd/compiler/test/runnable_cxx/cppa.d : A warning coming from non 
_GLIBCXX_USE_CXX98_ABI version. I am not sure why this works on linux but this 
test is currently skipped in the ldc guix package for some platforms already.


The reserved version keyword for Hurd is `Hurd` so I stuck with that naming 
scheme everywhere.

Questions/Comments:
- compiler/src/dmd/backend/backconfig.d : Should fpxmmregs and avx also be 
enabled for 32bit? it is enabled for linux, disabled on freebsd.


- compiler/src/dmd/dmdparams.d : i chose "hurd" as the name for the os in the 
triplet 
as opposed to "gnu" to match it everywhere else. The triplet used is neither 
compatible with the gnu config canonical triplet or the llvm triplet as e.g the 
name for glibc is "glibc". 
>From 4b37087977e88d572dd6f6724cd147dd11a0228a Mon Sep 17 00:00:00 2001
From: Yelninei <[email protected]>
Date: Sat, 21 Mar 2026 15:42:32 +0000
Subject: [PATCH 1/2] dmd: Port to GNU Hurd

---
 compiler/ini/hurd/bin32/dmd.conf      |  5 +++
 compiler/ini/hurd/bin64/dmd.conf      |  5 +++
 compiler/src/build.d                  |  4 ++-
 compiler/src/dmd/backend/arm/cod1.d   |  2 +-
 compiler/src/dmd/backend/backconfig.d | 46 ++++++++++++++++++++++++---
 compiler/src/dmd/backend/cdef.d       | 12 +++++--
 compiler/src/dmd/backend/elfobj.d     |  9 ++++--
 compiler/src/dmd/backend/melf.d       |  3 +-
 compiler/src/dmd/backend/x86/cod1.d   | 21 ++++++------
 compiler/src/dmd/backend/x86/cod3.d   |  6 ++--
 compiler/src/dmd/cli.d                | 13 ++++++--
 compiler/src/dmd/dmdparams.d          |  2 ++
 compiler/src/dmd/dmsc.d               |  1 +
 compiler/src/dmd/json.d               |  2 ++
 compiler/src/dmd/main.d               |  2 +-
 compiler/src/dmd/mars.d               |  7 ++--
 compiler/src/dmd/target.d             | 44 ++++++++++++++++---------
 compiler/src/osmodel.mak              |  7 ++--
 18 files changed, 142 insertions(+), 49 deletions(-)
 create mode 100644 compiler/ini/hurd/bin32/dmd.conf
 create mode 100644 compiler/ini/hurd/bin64/dmd.conf

diff --git a/compiler/ini/hurd/bin32/dmd.conf b/compiler/ini/hurd/bin32/dmd.conf
new file mode 100644
index 0000000000..15f03e72fe
--- /dev/null
+++ b/compiler/ini/hurd/bin32/dmd.conf
@@ -0,0 +1,5 @@
+[Environment32]
+DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib32 -L--export-dynamic -fPIC
+
+[Environment64]
+DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic -fPIC
diff --git a/compiler/ini/hurd/bin64/dmd.conf b/compiler/ini/hurd/bin64/dmd.conf
new file mode 100644
index 0000000000..15f03e72fe
--- /dev/null
+++ b/compiler/ini/hurd/bin64/dmd.conf
@@ -0,0 +1,5 @@
+[Environment32]
+DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib32 -L--export-dynamic -fPIC
+
+[Environment64]
+DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import -L-L%@P%/../lib64 -L--export-dynamic -fPIC
diff --git a/compiler/src/build.d b/compiler/src/build.d
index ac50483e47..5349778ffa 100755
--- a/compiler/src/build.d
+++ b/compiler/src/build.d
@@ -1680,7 +1680,7 @@ bool download(string to, string from, uint tries = 3)
 /**
 Detects the host OS.
 
-Returns: a string from `{windows, osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris}`
+Returns: a string from `{windows, osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris,hurd}`
 */
 string detectOS()
 {
@@ -1700,6 +1700,8 @@ string detectOS()
         return "dragonflybsd";
     else version(Solaris)
         return "solaris";
+    else version(Hurd)
+        return "hurd";
     else
         static assert(0, "Unrecognized or unsupported OS.");
 }
diff --git a/compiler/src/dmd/backend/arm/cod1.d b/compiler/src/dmd/backend/arm/cod1.d
index faa7207589..f9f2384e36 100644
--- a/compiler/src/dmd/backend/arm/cod1.d
+++ b/compiler/src/dmd/backend/arm/cod1.d
@@ -1580,7 +1580,7 @@ void cdfunc(ref CGstate cg, ref CodeBuilder cdb, elem* e, ref regm_t pretregs)
 
     /* Assume called function access statics
      */
-    if (config.exe & (EX_LINUX | EX_LINUX64 | EX_OSX | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64) &&
+    if (config.exe & (EX_LINUX | EX_LINUX64 | EX_OSX | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_HURD | EX_HURD64) &&
         config.flags3 & CFG3pic)
         cgstate.accessedTLS = true;
 
diff --git a/compiler/src/dmd/backend/backconfig.d b/compiler/src/dmd/backend/backconfig.d
index 1cdff29ede..77b104cdad 100644
--- a/compiler/src/dmd/backend/backconfig.d
+++ b/compiler/src/dmd/backend/backconfig.d
@@ -288,6 +288,42 @@ void out_config_init(
         cfg.objfmt = OBJ_ELF;
         cfg.ehmethod = useExceptions ? EHmethod.EH_DWARF : EHmethod.EH_NONE;
     }
+    else if (cfg.exe & (EX_HURD | EX_HURD64))
+    {
+        cfg.fpxmmregs = true;
+        cfg.avx = avx;
+        if (model == 64)
+        {
+            cfg.ehmethod = useExceptions ? EHmethod.EH_DWARF : EHmethod.EH_NONE;
+        }
+        else
+        {
+            cfg.ehmethod = useExceptions ? EHmethod.EH_DWARF : EHmethod.EH_NONE;
+            if (!exe)
+                cfg.flags |= CFGromable; // put switch tables in code segment
+        }
+        cfg.flags |= CFGnoebp;
+        switch (pic)
+        {
+            case 0:         // PIC.fixed
+                break;
+
+            case 1:         // PIC.pic
+                cfg.flags3 |= CFG3pic;
+                break;
+
+            case 2:         // PIC.pie
+                cfg.flags3 |= CFG3pic | CFG3pie;
+                break;
+
+            default:
+                assert(0);
+        }
+        if (symdebug)
+            cfg.flags |= CFGalwaysframe;
+
+        cfg.objfmt = OBJ_ELF;
+    }
 
     cfg.flags2 |= CFG2nodeflib;      // no default library
     cfg.flags3 |= CFG3eseqds;
@@ -320,7 +356,7 @@ static if (0)
     if (symdebug)
     {
         if (cfg.exe & (EX_LINUX | EX_LINUX64 | EX_OPENBSD | EX_OPENBSD64 | EX_FREEBSD | EX_FREEBSD64 | EX_DRAGONFLYBSD64 |
-                          EX_SOLARIS | EX_SOLARIS64 | EX_OSX | EX_OSX64))
+                          EX_SOLARIS | EX_SOLARIS64 | EX_OSX | EX_OSX64 | EX_HURD | EX_HURD64))
         {
             configv.addlinenumbers = 1;
             cfg.fulltypes = (symdebug == 1) ? CVDWARF_D : CVDWARF_C;
@@ -446,7 +482,7 @@ void util_set32(exefmt_t exe)
     _tysize[TYnullptr] = LONGSIZE;
     _tysize[TYnptr] = LONGSIZE;
     _tysize[TYnref] = LONGSIZE;
-if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64))
+if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64 | EX_HURD | EX_HURD64))
 {
     _tysize[TYldouble] = 12;
     _tysize[TYildouble] = 12;
@@ -477,7 +513,7 @@ if (exe & EX_windos)
     _tyalignsize[TYnullptr] = LONGSIZE;
     _tyalignsize[TYnref] = LONGSIZE;
     _tyalignsize[TYnptr] = LONGSIZE;
-if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64))
+if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64 | EX_HURD | EX_HURD64))
 {
     _tyalignsize[TYldouble] = 4;
     _tyalignsize[TYildouble] = 4;
@@ -533,7 +569,7 @@ void util_set64(exefmt_t exe)
     _tysize[TYnptr] = 8;
     _tysize[TYnref] = 8;
     if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD |
-                      EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64 | EX_OSX | EX_OSX64))
+                      EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64 | EX_OSX | EX_OSX64 | EX_HURD | EX_HURD64))
     {
         _tysize[TYldouble] = 16;
         _tysize[TYildouble] = 16;
@@ -557,7 +593,7 @@ void util_set64(exefmt_t exe)
     _tyalignsize[TYnullptr] = 8;
     _tyalignsize[TYnptr] = 8;
     _tyalignsize[TYnref] = 8;
-    if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64))
+    if (exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS | EX_SOLARIS64 | EX_HURD | EX_HURD64))
     {
         _tyalignsize[TYldouble] = 16;
         _tyalignsize[TYildouble] = 16;
diff --git a/compiler/src/dmd/backend/cdef.d b/compiler/src/dmd/backend/cdef.d
index d242a260a0..f1e9c94cb2 100644
--- a/compiler/src/dmd/backend/cdef.d
+++ b/compiler/src/dmd/backend/cdef.d
@@ -44,6 +44,7 @@ enum TARGET_OPENBSD = xversion!`OpenBSD`;
 enum TARGET_SOLARIS = xversion!`Solaris`;
 enum TARGET_WINDOS  = xversion!`Windows`;
 enum TARGET_DRAGONFLYBSD  = xversion!`DragonFlyBSD`;
+enum TARGET_HURD    = xversion!`Hurd`;
 
 //
 //      Attributes
@@ -304,6 +305,8 @@ enum
     EX_OPENBSD      = 0x400000,
     EX_OPENBSD64    = 0x800000,
     EX_DRAGONFLYBSD64 = 0x1000000,
+    EX_HURD         = 0x2000000,
+    EX_HURD64       = 0x4000000,
 }
 
 // All of them
@@ -328,7 +331,9 @@ enum exefmt_t EX_all =
     EX_SOLARIS64 |
     EX_OPENBSD   |
     EX_OPENBSD64 |
-    EX_DRAGONFLYBSD64;
+    EX_DRAGONFLYBSD64 |
+    EX_HURD |
+    EX_HURD64;
 
 // All segmented memory models
 enum exefmt_t EX_segmented = EX_DOSX | EX_ZPM | EX_RATIONAL | EX_PHARLAP |
@@ -350,6 +355,7 @@ enum exefmt_t EX_posix = EX_LINUX   | EX_LINUX64   |
                          EX_FREEBSD | EX_FREEBSD64 |
                          EX_SOLARIS | EX_SOLARIS64 |
                          EX_OPENBSD | EX_OPENBSD64 |
+                         EX_HURD    | EX_HURD64    |
                          EX_DRAGONFLYBSD64;
 
 // All 16 bit targets
@@ -362,7 +368,8 @@ enum exefmt_t EX_32 = EX_DOSX | EX_OS2 | EX_PHARLAP |
                 EX_OSX     |
                 EX_FREEBSD |
                 EX_SOLARIS |
-                EX_OPENBSD;
+                EX_OPENBSD |
+                EX_HURD;
 
 // All 64 bit targets
 enum exefmt_t EX_64 =
@@ -372,6 +379,7 @@ enum exefmt_t EX_64 =
                 EX_FREEBSD64 |
                 EX_SOLARIS64 |
                 EX_OPENBSD64 |
+                EX_HURD64    |
                 EX_DRAGONFLYBSD64;
 
 // Constraints
diff --git a/compiler/src/dmd/backend/elfobj.d b/compiler/src/dmd/backend/elfobj.d
index 64005973f3..be19711757 100644
--- a/compiler/src/dmd/backend/elfobj.d
+++ b/compiler/src/dmd/backend/elfobj.d
@@ -68,7 +68,7 @@ else
     enum DMDV2 = false;
 bool REQUIRE_DSO_REGISTRY()
 {
-    return DMDV2 && (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_DRAGONFLYBSD64));
+    return DMDV2 && (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_DRAGONFLYBSD64 | EX_HURD | EX_HURD64));
 }
 
 /**
@@ -81,7 +81,7 @@ bool USE_INIT_ARRAY() { return true; }
  * FreeBSD defaults to lld as of FreeBSD 13 (2021); OpenBSD as of 6.5 (2019).
  */
 
-bool ELF_COMDAT() { return (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64)) != 0; }
+bool ELF_COMDAT() { return (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_HURD | EX_HURD64)) != 0; }
 
 /***************************************************
  * Correspondence of relocation types
@@ -1240,6 +1240,11 @@ void ElfObj_term(const(char)[] objfilename)
             ELFOSABI = ELFOSABI_OPENBSD;
             break;
 
+        case EX_HURD:
+        case EX_HURD64:
+            ELFOSABI = ELFOSABI_GNU;
+            break;
+
         case EX_SOLARIS:
         case EX_SOLARIS64:
         case EX_DRAGONFLYBSD64:
diff --git a/compiler/src/dmd/backend/melf.d b/compiler/src/dmd/backend/melf.d
index 300061cfb1..6e9c8ff0d5 100644
--- a/compiler/src/dmd/backend/melf.d
+++ b/compiler/src/dmd/backend/melf.d
@@ -54,7 +54,8 @@ nothrow:
             enum ELFOSABI_SYSV       = 0;       /* UNIX System V ABI */
             enum ELFOSABI_HPUX       = 1;       /* HP-UX */
             enum ELFOSABI_NETBSD     = 2;
-            enum ELFOSABI_LINUX      = 3;
+            enum ELFOSABI_GNU        = 3;
+            enum ELFOSABI_LINUX      = ELFOSABI_GNU;
             enum ELFOSABI_FREEBSD    = 9;
             enum ELFOSABI_OPENBSD    = 12;
             enum ELFOSABI_ARM        = 97;      /* ARM */
diff --git a/compiler/src/dmd/backend/x86/cod1.d b/compiler/src/dmd/backend/x86/cod1.d
index dd40dbf591..e15f6017ea 100644
--- a/compiler/src/dmd/backend/x86/cod1.d
+++ b/compiler/src/dmd/backend/x86/cod1.d
@@ -2152,7 +2152,8 @@ void getClibFunction(uint clib, ref Symbol* s, ref ClibInfo* cinfo, objfmt_t obj
                           EX_FREEBSD | EX_FREEBSD64 |
                           EX_OPENBSD | EX_OPENBSD64 |
                           EX_DRAGONFLYBSD64 |
-                          EX_SOLARIS | EX_SOLARIS64);
+                          EX_SOLARIS | EX_SOLARIS64 |
+                          EX_HURD    | EX_HURD64);
 
     switch (clib)
     {
@@ -2174,7 +2175,7 @@ void getClibFunction(uint clib, ref Symbol* s, ref ClibInfo* cinfo, objfmt_t obj
 
         case CLIB.ldiv:
             cinfo.retregs16 = mDX|mAX;
-            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD))
+            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_HURD))
             {
                 s = symboly("__divdi3", mAX|mBX|mCX|mDX);
                 cinfo.flags = INFpushebx;
@@ -2202,7 +2203,7 @@ void getClibFunction(uint clib, ref Symbol* s, ref ClibInfo* cinfo, objfmt_t obj
 
         case CLIB.lmod:
             cinfo.retregs16 = mCX|mBX;
-            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD))
+            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_HURD))
             {
                 s = symboly("__moddi3", mAX|mBX|mCX|mDX);
                 cinfo.flags = INFpushebx;
@@ -2230,7 +2231,7 @@ void getClibFunction(uint clib, ref Symbol* s, ref ClibInfo* cinfo, objfmt_t obj
 
         case CLIB.uldiv:
             cinfo.retregs16 = mDX|mAX;
-            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD))
+            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_HURD))
             {
                 s = symboly("__udivdi3", mAX|mBX|mCX|mDX);
                 cinfo.flags = INFpushebx;
@@ -2258,7 +2259,7 @@ void getClibFunction(uint clib, ref Symbol* s, ref ClibInfo* cinfo, objfmt_t obj
 
         case CLIB.ulmod:
             cinfo.retregs16 = mCX|mBX;
-            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD))
+            if (exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_HURD))
             {
                 s = symboly("__umoddi3", mAX|mBX|mCX|mDX);
                 cinfo.flags = INFpushebx;
@@ -2899,7 +2900,7 @@ void callclib(ref CodeBuilder cdb, elem* e, uint clib, ref regm_t pretregs, regm
         }
         if (pushebx)
         {
-            if (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64))
+            if (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_HURD | EX_HURD64))
             {
                 cdb.gen1(0x50 + CX);                             // PUSH ECX
                 cdb.gen1(0x50 + BX);                             // PUSH EBX
@@ -2920,7 +2921,7 @@ void callclib(ref CodeBuilder cdb, elem* e, uint clib, ref regm_t pretregs, regm
             cdb.gen1(0x50 + DX);                                 // PUSH EDX
             cdb.gen1(0x50 + AX);                                 // PUSH EAX
         }
-        if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS))
+        if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS | EX_HURD))
         {
             // Note: not for OSX
             /* Pass EBX on the stack instead, this is because EBX is used
@@ -3383,7 +3384,7 @@ void cdfunc(ref CGstate cg, ref CodeBuilder cdb, elem* e, ref regm_t pretregs)
 
     /* Assume called function access statics
      */
-    if (config.exe & (EX_LINUX | EX_LINUX64 | EX_OSX | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64) &&
+    if (config.exe & (EX_LINUX | EX_LINUX64 | EX_OSX | EX_FREEBSD | EX_FREEBSD64 | EX_OPENBSD | EX_OPENBSD64 | EX_HURD | EX_HURD64) &&
         config.flags3 & CFG3pic)
         cgstate.accessedTLS = true;
 
@@ -3430,7 +3431,7 @@ void cdfunc(ref CGstate cg, ref CodeBuilder cdb, elem* e, ref regm_t pretregs)
         parameters[i].numalign = 0;
         if (alignsize > stackalign &&
             (I64 || (alignsize >= 16 &&
-                (config.exe & (EX_OSX | EX_LINUX) && (tyaggregate(ep.Ety) || tyvector(ep.Ety))))))
+                     (config.exe & (EX_OSX | EX_LINUX | EX_HURD) && (tyaggregate(ep.Ety) || tyvector(ep.Ety))))))
         {
             if (alignsize > STACKALIGN)
             {
@@ -3998,7 +3999,7 @@ private void funccall(ref CodeBuilder cdb, elem* e, uint numpara, uint numalign,
         tym_t e11ty = tybasic(e11.Ety);
         assert(!I16 || (e11ty == (farfunc ? TYfptr : TYnptr)));
         load_localgot(cdb);
-        if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS)) // 32 bit only
+        if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS | EX_HURD)) // 32 bit only
         {
             if (config.flags3 & CFG3pic)
                 keepmsk |= mBX;
diff --git a/compiler/src/dmd/backend/x86/cod3.d b/compiler/src/dmd/backend/x86/cod3.d
index e93f304c06..740b030e3e 100644
--- a/compiler/src/dmd/backend/x86/cod3.d
+++ b/compiler/src/dmd/backend/x86/cod3.d
@@ -2225,7 +2225,7 @@ void outjmptab(block* b)
                 break;
             }
         }
-        if (config.exe & (EX_LINUX64 | EX_FREEBSD64 | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS64))
+        if (config.exe & (EX_LINUX64 | EX_FREEBSD64 | EX_OPENBSD64 | EX_DRAGONFLYBSD64 | EX_SOLARIS64 | EX_HURD64))
         {
             if (config.flags3 & CFG3pic)
             {
@@ -2238,7 +2238,7 @@ void outjmptab(block* b)
                 *poffset += 8;
             }
         }
-        else if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS))
+        else if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS | EX_HURD))
         {
             if (config.flags3 & CFG3pic)
             {
@@ -2891,7 +2891,7 @@ void cdgot(ref CGstate cg, ref CodeBuilder cdb, elem* e, ref regm_t pretregs)
 @trusted
 void load_localgot(ref CodeBuilder cdb)
 {
-    if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS)) // note: I32 only
+    if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS | EX_HURD)) // note: I32 only
     {
         if (config.flags3 & CFG3pic)
         {
diff --git a/compiler/src/dmd/cli.d b/compiler/src/dmd/cli.d
index beb8ab745d..8ad82c3b1b 100644
--- a/compiler/src/dmd/cli.d
+++ b/compiler/src/dmd/cli.d
@@ -31,10 +31,11 @@ enum TargetOS : ubyte
     FreeBSD      = 0x10,
     Solaris      = 0x20,
     DragonFlyBSD = 0x40,
+    Hurd         = 0x80,
 
     // Combination masks
-    all = linux | Windows | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD,
-    Posix = linux | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD,
+    all = linux | Windows | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD | Hurd,
+    Posix = linux | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD | Hurd,
 }
 
 // Detect the current TargetOS
@@ -66,6 +67,10 @@ else version(Solaris)
 {
     private enum targetOS = TargetOS.Solaris;
 }
+else version(Hurd)
+{
+    private enum targetOS = TargetOS.Hurd;
+}
 else
 {
     private enum targetOS = TargetOS.all;
@@ -782,6 +787,7 @@ dmd -cov -unittest myprog.d
                     $(LI $(I openbsd): OpenBSD)
                     $(LI $(I osx): OSX)
                     $(LI $(I solaris): Solaris)
+                    $(LI $(I hurd): Hurd)
                     $(LI $(I windows): Windows)
                 )`
         ),
@@ -869,7 +875,8 @@ dmd -cov -unittest myprog.d
                $(I os) is the operating system, this may have a trailing version number:
                `freestanding` for no operating system,
                `darwin` or `osx` for MacOS, `dragonfly` or `dragonflybsd` for DragonflyBSD,
-               `freebsd`, `openbsd`, `linux`, `solaris` or `windows` for their respective operating systems.
+               `freebsd`, `openbsd`, `linux`, `solaris`, `hurd` or `windows` for their
+               respective operating systems.
                $(I cenv) is the C runtime environment and is optional: `musl` for musl-libc,
                `msvc` for the MSVC runtime, `bionic` for the Andriod libc, `gnu` or `glibc`
                for the GCC C runtime, `newlib` or `uclibc` for their respective C runtimes.
diff --git a/compiler/src/dmd/dmdparams.d b/compiler/src/dmd/dmdparams.d
index 7d82c1e2b4..58d621bee9 100644
--- a/compiler/src/dmd/dmdparams.d
+++ b/compiler/src/dmd/dmdparams.d
@@ -227,6 +227,8 @@ struct Triple
             os =  Target.OS.OpenBSD;
         else if (matches("linux"))
             os =  Target.OS.linux;
+        else if (matches("hurd")) // "gnu"?
+            os =  Target.OS.Hurd;
         else if (matches("windows"))
             os =  Target.OS.Windows;
         else
diff --git a/compiler/src/dmd/dmsc.d b/compiler/src/dmd/dmsc.d
index 1c80135396..ef39b209d5 100644
--- a/compiler/src/dmd/dmsc.d
+++ b/compiler/src/dmd/dmsc.d
@@ -55,6 +55,7 @@ void backend_init(const ref Param params, const ref DMDparams driverParams, cons
         case Target.OS.OpenBSD: exfmt = is64 ? EX_OPENBSD64 : EX_OPENBSD; break;
         case Target.OS.Solaris: exfmt = is64 ? EX_SOLARIS64 : EX_SOLARIS; break;
         case Target.OS.DragonFlyBSD: assert(is64); exfmt = EX_DRAGONFLYBSD64; break;
+        case Target.OS.Hurd:    exfmt = is64 ? EX_HURD64    : EX_HURD; break;
         default: assert(0);
     }
 
diff --git a/compiler/src/dmd/json.d b/compiler/src/dmd/json.d
index 080870aa47..1a1fabd367 100644
--- a/compiler/src/dmd/json.d
+++ b/compiler/src/dmd/json.d
@@ -867,6 +867,8 @@ public:
                 item("solaris");
                 item("bsd");
             }
+            else if (target.os == Target.OS.Hurd)
+                item("hurd");
         }
         arrayEnd();
 
diff --git a/compiler/src/dmd/main.d b/compiler/src/dmd/main.d
index a574bfdb4b..29f91ab8af 100644
--- a/compiler/src/dmd/main.d
+++ b/compiler/src/dmd/main.d
@@ -1037,7 +1037,7 @@ void reconcileCommands(ref Param params, ref Target target)
             error(Loc.initial, "`-m32` is not supported on DragonFlyBSD, it is 64-bit only");
     }
 
-    if (target.os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
+    if (target.os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD | Target.OS.Hurd))
     {
         if (driverParams.lib && driverParams.dll)
             error(Loc.initial, "cannot mix `-lib` and `-shared`");
diff --git a/compiler/src/dmd/mars.d b/compiler/src/dmd/mars.d
index cca1ff3272..606f5a1233 100644
--- a/compiler/src/dmd/mars.d
+++ b/compiler/src/dmd/mars.d
@@ -377,7 +377,7 @@ void setDefaultLibraries(const ref Target target, ref const(char)[] defaultlibna
         {
             defaultlibname = target.isX86_64 ? "phobos64" : "phobos32mscoff";
         }
-        else if (target.os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
+        else if (target.os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD | Target.OS.Hurd))
         {
             defaultlibname = "libphobos2.a";
         }
@@ -1150,7 +1150,7 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param
             enum len = "-os=".length;
             // Parse:
             //      -os=identifier
-            immutable string msg = "Only `host`, `linux`, `windows`, `osx`,`openbsd`, `freebsd`, `solaris`, `dragonflybsd` allowed for `-os`";
+            immutable string msg = "Only `host`, `linux`, `windows`, `osx`,`openbsd`, `freebsd`, `solaris`, `dragonflybsd`, `hurd` allowed for `-os`";
             if (Identifier.isValidIdentifier(p + len))
             {
                 const ident = p + len;
@@ -1164,6 +1164,7 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param
                 case "freebsd":      target.os = Target.OS.FreeBSD;      break;
                 case "solaris":      target.os = Target.OS.Solaris;      break;
                 case "dragonflybsd": target.os = Target.OS.DragonFlyBSD; break;
+                case "hurd":         target.os = Target.OS.Hurd;         break;
                 default:
                     errorInvalidSwitch(p, msg);
                     return false;
@@ -1898,7 +1899,7 @@ bool createModule(const(char)* file, ref Strings libmodules, ref Param params, c
         libmodules.push(file);
         return false;
     }
-    if (target.os & (Target.OS.linux | Target.OS.OSX| Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
+    if (target.os & (Target.OS.linux | Target.OS.OSX| Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD | Target.OS.Hurd))
     {
         if (FileName.equals(ext, target.dll_ext))
         {
diff --git a/compiler/src/dmd/target.d b/compiler/src/dmd/target.d
index f739cbfe35..79ec40129d 100644
--- a/compiler/src/dmd/target.d
+++ b/compiler/src/dmd/target.d
@@ -65,6 +65,8 @@ Target.OS defaultTargetOS() @safe
         return Target.OS.Solaris;
     else version (DragonFlyBSD)
         return Target.OS.DragonFlyBSD;
+    else version (Hurd)
+        return Target.OS.Hurd;
     else
         static assert(0, "unknown TARGET");
 }
@@ -179,7 +181,7 @@ void addPredefinedGlobalIdentifiers(const ref Target tgt)
     {
         if (tgt.os & OS.Posix)
             predef("Posix");
-        if (tgt.os & (OS.linux | OS.FreeBSD | OS.OpenBSD | OS.DragonFlyBSD | OS.Solaris))
+        if (tgt.os & (OS.linux | OS.FreeBSD | OS.OpenBSD | OS.DragonFlyBSD | OS.Solaris | OS.Hurd))
             predef("ELFv1");
         switch (tgt.os)
         {
@@ -188,6 +190,7 @@ void addPredefinedGlobalIdentifiers(const ref Target tgt)
             case OS.OpenBSD:      { predef("OpenBSD");      break; }
             case OS.DragonFlyBSD: { predef("DragonFlyBSD"); break; }
             case OS.Solaris:      { predef("Solaris");      break; }
+            case OS.Hurd:         { predef("Hurd");         break; }
             case OS.Windows:
             {
                  predef("Windows");
@@ -330,10 +333,11 @@ extern (C++) struct Target
         FreeBSD      = 0x10,
         Solaris      = 0x20,
         DragonFlyBSD = 0x40,
+        Hurd         = 0x80,
 
         // Combination masks
-        all = linux | Windows | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD,
-        Posix = linux | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD,
+        all = linux | Windows | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD | Hurd,
+        Posix = linux | OSX | OpenBSD | FreeBSD | Solaris | DragonFlyBSD | Hurd,
     }
 
     extern(D) enum ObjectFormat : ubyte
@@ -455,7 +459,7 @@ extern (C++) struct Target
             classinfosize = 0x98+16; // 168
         }
 
-        if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris))
+        if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.Hurd))
         {
             realsize = 12;
             realpad = 2;
@@ -478,7 +482,7 @@ extern (C++) struct Target
 
         if (isX86_64 || isAArch64)
         {
-            if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris))
+            if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.Hurd))
             {
                 realsize = 16;
                 realpad = 6;
@@ -506,7 +510,7 @@ extern (C++) struct Target
             dll_ext = "dll";
             run_noext = false;
         }
-        else if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.OSX))
+        else if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.OSX | Target.OS.Hurd))
         {
             obj_ext = "o";
             lib_ext = "a";
@@ -1074,7 +1078,8 @@ extern (C++) struct Target
             if (tns.ty != TY.Tstruct)
             {
     L2:
-                if (os == Target.OS.linux && tf.linkage != LINK.d && isX86)
+              if ((os & (Target.OS.linux | Target.OS.Hurd)) &&
+                  tf.linkage != LINK.d && isX86)
                 {
                                                     // 32 bit C/C++ structs always on stack
                 }
@@ -1101,7 +1106,8 @@ extern (C++) struct Target
         if (auto ts = tns.isTypeStruct())
         {
             auto sd = ts.sym;
-            if (os == Target.OS.linux && tf.linkage != LINK.d && isX86)
+            if ((os & (Target.OS.linux | Target.OS.Hurd)) &&
+                tf.linkage != LINK.d && isX86)
             {
                 //printf("  2 true\n");
                 return true;            // 32 bit C/C++ structs always on stack
@@ -1418,7 +1424,7 @@ struct TargetC
         shortsize = 2;
         intsize = 4;
         long_longsize = 8;
-        if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris))
+        if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.Hurd))
             longsize = 4;
         else if (os == Target.OS.OSX)
             longsize = 4;
@@ -1428,7 +1434,7 @@ struct TargetC
             assert(0);
         if (target.isX86_64 || target.isAArch64)
         {
-            if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris))
+            if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.Hurd))
                 longsize = 8;
             else if (os == Target.OS.OSX)
                 longsize = 8;
@@ -1453,11 +1459,19 @@ struct TargetC
             else
                 runtime = Runtime.Glibc;
         }
+        else if (os == Target.OS.Hurd)
+        {
+            version (CRuntime_Glibc)
+                runtime = Runtime.Glibc;
+            else
+              assert(0);
+        }
 
         if (os == Target.OS.Windows)
             bitFieldStyle = BitFieldStyle.MS;
         else if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OSX |
-                       Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris))
+                       Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris |
+                       Target.OS.Hurd))
             bitFieldStyle = BitFieldStyle.Gcc_Clang;
         else
             assert(0);
@@ -1518,7 +1532,7 @@ struct TargetCPP
     extern (D) void initialize(ref const Param params, ref const Target target) @safe
     {
         const os = target.os;
-        if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris))
+        if (os & (Target.OS.linux | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.DragonFlyBSD | Target.OS.Solaris | Target.OS.Hurd))
             twoDtorInVtable = true;
         else if (os == Target.OS.OSX)
             twoDtorInVtable = true;
@@ -1532,7 +1546,7 @@ struct TargetCPP
         exceptions = (os & Target.OS.Posix) != 0;
         if (os == Target.OS.Windows)
             runtime = Runtime.Microsoft;
-        else if (os & (Target.OS.linux | Target.OS.DragonFlyBSD))
+        else if (os & (Target.OS.linux | Target.OS.DragonFlyBSD | Target.OS.Hurd))
             runtime = Runtime.GNU;
         else if (os & (Target.OS.OSX | Target.OS.FreeBSD | Target.OS.OpenBSD))
             runtime = Runtime.LLVM;
@@ -1556,7 +1570,7 @@ struct TargetCPP
         import dmd.mangle.cpp : toCppMangleItanium;
         import dmd.mangle.cppwin : toCppMangleMSVC;
 
-        if (target.os & (Target.OS.linux | Target.OS.OSX | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
+        if (target.os & (Target.OS.linux | Target.OS.OSX | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD | Target.OS.Hurd))
             return toCppMangleItanium(s);
         if (target.os == Target.OS.Windows)
             return toCppMangleMSVC(s);
@@ -1576,7 +1590,7 @@ struct TargetCPP
         import dmd.mangle.cpp : cppTypeInfoMangleItanium;
         import dmd.mangle.cppwin : cppTypeInfoMangleMSVC;
 
-        if (target.os & (Target.OS.linux | Target.OS.OSX | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD))
+        if (target.os & (Target.OS.linux | Target.OS.OSX | Target.OS.FreeBSD | Target.OS.OpenBSD | Target.OS.Solaris | Target.OS.DragonFlyBSD | Target.OS.Hurd))
             return cppTypeInfoMangleItanium(cd);
         if (target.os == Target.OS.Windows)
             return cppTypeInfoMangleMSVC(cd);
diff --git a/compiler/src/osmodel.mak b/compiler/src/osmodel.mak
index 69676c18b0..443509c61e 100644
--- a/compiler/src/osmodel.mak
+++ b/compiler/src/osmodel.mak
@@ -2,7 +2,7 @@
 #
 # Detects and sets the macros:
 #
-#   OS         = one of {windows,osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris}
+#   OS         = one of {windows,osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris,hurd}
 #   MODEL      = one of { 32, 64 }
 #   MODEL_FLAG = one of { -m32, -m64 }
 #   ARCH       = one of { x86, x86_64, aarch64 }
@@ -40,6 +40,9 @@ ifeq (,$(OS))
     ifeq (SunOS,$(uname_S))
       OS:=solaris
     endif
+    ifeq (GNU,$(uname_S))
+      OS:=hurd
+    endif
     ifeq (,$(OS))
       $(error Unrecognized or unsupported OS for uname: $(uname_S))
     endif
@@ -87,7 +90,7 @@ ifeq (,$(MODEL))
       MODEL:=64
       ARCH:=aarch64
     endif
-    ifneq (,$(findstring $(uname_M),i386 i586 i686))
+    ifneq (,$(findstring $(uname_M),i386 i586 i686 i686-AT386))
       MODEL:=32
       ARCH:=x86
     endif
-- 
2.52.0

>From 5972894f4125fd55b4a4e08337be670650020b19 Mon Sep 17 00:00:00 2001
From: Yelninei <[email protected]>
Date: Sat, 21 Mar 2026 15:47:08 +0000
Subject: [PATCH 2/2] dmd: Fix tests on Hurd

---
 compiler/test/compilable/cdcmp.d              |  2 +-
 compiler/test/compilable/test21672.d          |  2 +-
 compiler/test/compilable/test22346.c          |  2 +-
 compiler/test/compilable/test23875.c          |  2 +-
 compiler/test/compilable/test24130.c          |  2 +-
 compiler/test/compilable/vcg-ast.d            |  2 +-
 compiler/test/fail_compilation/fail17105.d    |  2 +-
 compiler/test/fail_compilation/fail18372.d    |  2 +-
 .../test/fail_compilation/fail21227_win.d     |  2 +-
 compiler/test/fail_compilation/fail3753.d     |  2 +-
 compiler/test/fail_compilation/fail6451.d     |  2 +-
 compiler/test/fail_compilation/ice20042.d     |  2 +-
 compiler/test/fail_compilation/ice20264.d     |  2 +-
 compiler/test/fail_compilation/impconv.d      |  2 +-
 compiler/test/fail_compilation/invalid_lib.d  |  2 +-
 compiler/test/fail_compilation/vector_types.d |  2 +-
 compiler/test/fail_compilation/xmmslice.d     |  2 +-
 compiler/test/run.d                           |  2 +-
 compiler/test/runnable/bitfieldsms.c          |  2 +-
 compiler/test/runnable/bitfieldsposix32.c     |  2 +-
 compiler/test/runnable/bitfieldsposix64.c     |  2 +-
 compiler/test/runnable/dbitfieldsms.d         |  2 +-
 compiler/test/runnable/dbitfieldsposix32.d    |  2 +-
 compiler/test/runnable/dbitfieldsposix64.d    |  2 +-
 compiler/test/runnable/dhry.d                 | 15 +++++++++
 compiler/test/runnable/ice21727.d             |  2 +-
 compiler/test/runnable/test22.d               | 32 ++++++++++++++++++-
 compiler/test/runnable/test23343.c            |  2 +-
 compiler/test/runnable/test_cdstrpar.d        |  2 +-
 compiler/test/runnable/testargtypes.d         |  2 +-
 compiler/test/runnable_cxx/cpp_abi_tests.d    |  2 +-
 compiler/test/runnable_cxx/cppa.d             |  2 +-
 compiler/test/runnable_cxx/nonpod_byval.d     |  2 +-
 compiler/test/tools/paths.d                   |  2 ++
 34 files changed, 79 insertions(+), 32 deletions(-)

diff --git a/compiler/test/compilable/cdcmp.d b/compiler/test/compilable/cdcmp.d
index 16abde0bd5..f8f9106e5f 100644
--- a/compiler/test/compilable/cdcmp.d
+++ b/compiler/test/compilable/cdcmp.d
@@ -2,7 +2,7 @@
 // REQUIRED_ARGS: -O
 // POST_SCRIPT: compilable/extra-files/objdump-postscript.sh
 // only testing on SYSV-ABI, but backend code is identical across platforms
-// DISABLED: win32 win64 osx linux32 freebsd32 freebsd64 openbsd32 openbsd64
+// DISABLED: win32 win64 osx linux32 freebsd32 freebsd64 openbsd32 openbsd64 hurd32
 
 bool test_ltz(ubyte x) { return x <  0; }
 bool test_lez(ubyte x) { return x <= 0; }
diff --git a/compiler/test/compilable/test21672.d b/compiler/test/compilable/test21672.d
index abad340fcc..81ab7622b7 100644
--- a/compiler/test/compilable/test21672.d
+++ b/compiler/test/compilable/test21672.d
@@ -1,5 +1,5 @@
 // REQUIRED_ARGS: -mcpu=avx2 -O
-// DISABLED: win32 linux32 freebsd32 openbsd32
+// DISABLED: win32 linux32 freebsd32 openbsd32 hurd32
 
 // https://issues.dlang.org/show_bug.cgi?id=21672
 
diff --git a/compiler/test/compilable/test22346.c b/compiler/test/compilable/test22346.c
index 9d1444ad74..8c4d85b6cf 100644
--- a/compiler/test/compilable/test22346.c
+++ b/compiler/test/compilable/test22346.c
@@ -1,4 +1,4 @@
-/* DISABLED: win32 win64 linux32 osx32 osx64 freebsd32 openbsd32
+/* DISABLED: win32 win64 linux32 osx32 osx64 freebsd32 openbsd32 hurd32
  */
 
 // https://issues.dlang.org/show_bug.cgi?id=23346
diff --git a/compiler/test/compilable/test23875.c b/compiler/test/compilable/test23875.c
index c5ee060cc6..b074f12680 100644
--- a/compiler/test/compilable/test23875.c
+++ b/compiler/test/compilable/test23875.c
@@ -1,4 +1,4 @@
-/* DISABLED: win32 linux32
+/* DISABLED: win32 linux32 hurd32
  */
 
 // https://issues.dlang.org/show_bug.cgi?id=23875
diff --git a/compiler/test/compilable/test24130.c b/compiler/test/compilable/test24130.c
index 5f7f69f6cc..5160968b55 100644
--- a/compiler/test/compilable/test24130.c
+++ b/compiler/test/compilable/test24130.c
@@ -1,5 +1,5 @@
 /*
- * DISABLED: freebsd32 freebsd64 linux32 linux64 osx32 osx64 win64 dragonflybsd openbsd
+ * DISABLED: freebsd32 freebsd64 linux32 linux64 osx32 osx64 win64 dragonflybsd openbsd hurd
  */
 
 // https://issues.dlang.org/show_bug.cgi?id=24130
diff --git a/compiler/test/compilable/vcg-ast.d b/compiler/test/compilable/vcg-ast.d
index 6a90555740..3e0647f50b 100644
--- a/compiler/test/compilable/vcg-ast.d
+++ b/compiler/test/compilable/vcg-ast.d
@@ -5,7 +5,7 @@ OUTPUT_FILES: compilable/vcg-ast.d.cg
 EXTRA_FILES: imports/vcg_ast_import.d
 TEST_OUTPUT_FILE: extra-files/vcg-ast.d.cg
 // size_t currently must be ulong in this test, not uint
-DISABLED: freebsd32 openbsd32 linux32 osx32 win32
+DISABLED: freebsd32 openbsd32 linux32 osx32 win32 hurd32
 */
 
 module vcg;
diff --git a/compiler/test/fail_compilation/fail17105.d b/compiler/test/fail_compilation/fail17105.d
index 407c40222c..14be167f9c 100644
--- a/compiler/test/fail_compilation/fail17105.d
+++ b/compiler/test/fail_compilation/fail17105.d
@@ -1,5 +1,5 @@
 /* REQUIRED_ARGS: -m64
-DISABLED: win32 linux32 osx32 freebsd32 openbsd32
+DISABLED: win32 linux32 osx32 freebsd32 openbsd32 hurd32
 TEST_OUTPUT:
 ---
 fail_compilation/fail17105.d(20): Error: missing 4th parameter to `__simd()`
diff --git a/compiler/test/fail_compilation/fail18372.d b/compiler/test/fail_compilation/fail18372.d
index 6100894bb0..8eb92786c0 100644
--- a/compiler/test/fail_compilation/fail18372.d
+++ b/compiler/test/fail_compilation/fail18372.d
@@ -1,5 +1,5 @@
 /*
-DISABLED: win32 win64 linux32 osx32 freebsd32 openbsd32
+DISABLED: win32 win64 linux32 osx32 freebsd32 openbsd32 hurd32
 TEST_OUTPUT:
 ---
 fail_compilation/fail18372.d(103): Error: `__va_list_tag` is not defined, perhaps `import core.stdc.stdarg;` ?
diff --git a/compiler/test/fail_compilation/fail21227_win.d b/compiler/test/fail_compilation/fail21227_win.d
index a0a029f08f..00305ae7c9 100644
--- a/compiler/test/fail_compilation/fail21227_win.d
+++ b/compiler/test/fail_compilation/fail21227_win.d
@@ -1,6 +1,6 @@
 /*
 REQUIRED_ARGS: -Jfail_compilation
-DISABLED: linux osx freebsd dragonflybsd netbsd openbsd
+DISABLED: linux osx freebsd dragonflybsd netbsd openbsd hurd
 TEST_OUTPUT:
 ---
 fail_compilation\fail21227_win.d(2): Error: absolute path is not allowed in import expression: `"\\\\UNC\\path\\to\\file.txt"`
diff --git a/compiler/test/fail_compilation/fail3753.d b/compiler/test/fail_compilation/fail3753.d
index 97deb00eb8..98ac1a3231 100644
--- a/compiler/test/fail_compilation/fail3753.d
+++ b/compiler/test/fail_compilation/fail3753.d
@@ -1,5 +1,5 @@
 /*
-DISABLED: dragonflybsd freebsd linux osx win32 openbsd
+DISABLED: dragonflybsd freebsd linux osx win32 openbsd hurd
 TEST_OUTPUT:
 ---
 Error: cannot mix `core.std.stdlib.alloca()` and exception handling in `_Dmain()`
diff --git a/compiler/test/fail_compilation/fail6451.d b/compiler/test/fail_compilation/fail6451.d
index fcc1d76a70..7e1977bba9 100644
--- a/compiler/test/fail_compilation/fail6451.d
+++ b/compiler/test/fail_compilation/fail6451.d
@@ -1,5 +1,5 @@
 /*
-DISABLED: win32 win64 linux32 osx32 freebsd32 openbsd32
+DISABLED: win32 win64 linux32 osx32 freebsd32 openbsd32 hurd32
 TEST_OUTPUT:
 ---
 fail_compilation/fail6451.d(9): Error: `__va_list_tag` is not defined, perhaps `import core.stdc.stdarg;` ?
diff --git a/compiler/test/fail_compilation/ice20042.d b/compiler/test/fail_compilation/ice20042.d
index 7a674b3c54..3836932195 100644
--- a/compiler/test/fail_compilation/ice20042.d
+++ b/compiler/test/fail_compilation/ice20042.d
@@ -1,5 +1,5 @@
 /*
-DISABLED: freebsd32 openbsd32 linux32 osx32 win32
+DISABLED: freebsd32 openbsd32 linux32 osx32 win32 hurd32
 TEST_OUTPUT:
 ---
 fail_compilation/ice20042.d(18): Error: slice operation `cast(__vector(float[4]))[nanF, nanF, nanF, nanF] = [1.0F, 2.0F, 3.0F, 4.0F][0..4]` cannot be evaluated at compile time
diff --git a/compiler/test/fail_compilation/ice20264.d b/compiler/test/fail_compilation/ice20264.d
index a8a1e7119b..03ffa77931 100644
--- a/compiler/test/fail_compilation/ice20264.d
+++ b/compiler/test/fail_compilation/ice20264.d
@@ -1,5 +1,5 @@
 /*
-DISABLED: freebsd32 openbsd32 linux32 osx32 win32
+DISABLED: freebsd32 openbsd32 linux32 osx32 win32 hurd32
 TEST_OUTPUT:
 ---
 fail_compilation/ice20264.d(12): Error: cannot modify expression `cast(__vector(float[4]))a` because it is not an lvalue
diff --git a/compiler/test/fail_compilation/impconv.d b/compiler/test/fail_compilation/impconv.d
index 0cc2deb13d..e4026957f2 100644
--- a/compiler/test/fail_compilation/impconv.d
+++ b/compiler/test/fail_compilation/impconv.d
@@ -3,7 +3,7 @@ FIXME: DMD host compilers < 2.073 with faulty optimization
 lead to unfortunate test failures, see
 https://github.com/dlang/dmd/pull/6831#issuecomment-304495842.
 
-DISABLED: win32 win64 linux osx freebsd openbsd
+DISABLED: win32 win64 linux osx freebsd openbsd hurd
 */
 
 /*
diff --git a/compiler/test/fail_compilation/invalid_lib.d b/compiler/test/fail_compilation/invalid_lib.d
index 70121123a7..19eb4eaddf 100644
--- a/compiler/test/fail_compilation/invalid_lib.d
+++ b/compiler/test/fail_compilation/invalid_lib.d
@@ -1,6 +1,6 @@
 /*
 REQUIRED_ARGS: -lib
-REQUIRED_ARGS(linux freebsd osx openbsd): fail_compilation/extra-files/fake.a
+REQUIRED_ARGS(linux freebsd osx openbsd hurd): fail_compilation/extra-files/fake.a
 REQUIRED_ARGS(windows): -m32 fail_compilation/extra-files/fake.lib
 
 Use a regex because the path is really strange on Azure (OMF_32, 64):
diff --git a/compiler/test/fail_compilation/vector_types.d b/compiler/test/fail_compilation/vector_types.d
index 322bbc66cb..f17dbc25e2 100644
--- a/compiler/test/fail_compilation/vector_types.d
+++ b/compiler/test/fail_compilation/vector_types.d
@@ -1,7 +1,7 @@
 /*
 REQUIRED_ARGS: -o-
 TEST_OUTPUT:
-DISABLED: freebsd32 openbsd32 linux32 osx32 win32
+DISABLED: freebsd32 openbsd32 linux32 osx32 win32 hurd32
 ---
 fail_compilation/vector_types.d(15): Error: 32 byte vector type `__vector(double[4])` is not supported on this platform
 fail_compilation/vector_types.d(16): Error: 32 byte vector type `__vector(float[8])` is not supported on this platform
diff --git a/compiler/test/fail_compilation/xmmslice.d b/compiler/test/fail_compilation/xmmslice.d
index f91ac1f525..48f79c65d2 100644
--- a/compiler/test/fail_compilation/xmmslice.d
+++ b/compiler/test/fail_compilation/xmmslice.d
@@ -1,6 +1,6 @@
 
 /* REQUIRED_ARGS: -mcpu=avx
-DISABLED: win32 freebsd32 openbsd32 linux32 osx32
+DISABLED: win32 freebsd32 openbsd32 linux32 osx32 hurd32
 TEST_OUTPUT:
 ---
 fail_compilation/xmmslice.d(110): Error: `__vector(int[4])` cannot be sliced with `[]`
diff --git a/compiler/test/run.d b/compiler/test/run.d
index cf7b3d1986..137b7393bd 100755
--- a/compiler/test/run.d
+++ b/compiler/test/run.d
@@ -575,7 +575,7 @@ string[string] getEnvironment()
         env["PIC_FLAG"]  = pic ? "-fPIC" : "";
         env["DFLAGS"] = "-I%s/import -I%s".format(druntimePath, phobosPath)
             ~ " -L-L%s/%s".format(phobosPath, generatedSuffix);
-        bool isShared = environment.get("SHARED") != "0" && os.among("linux", "freebsd") > 0;
+        bool isShared = environment.get("SHARED") != "0" && os.among("linux", "freebsd", "hurd") > 0;
         if (isShared)
             env["DFLAGS"] = env["DFLAGS"] ~ " -defaultlib=libphobos2.so -L-rpath=%s/%s".format(phobosPath, generatedSuffix);
 
diff --git a/compiler/test/runnable/bitfieldsms.c b/compiler/test/runnable/bitfieldsms.c
index 5aee443d55..85af0eb5f8 100644
--- a/compiler/test/runnable/bitfieldsms.c
+++ b/compiler/test/runnable/bitfieldsms.c
@@ -1,5 +1,5 @@
 /* test bitfields for Microsoft C
- * DISABLED: win32 linux freebsd openbsd osx
+ * DISABLED: win32 linux freebsd openbsd osx hurd
  * RUN_OUTPUT:
 ---
                 DM |   MS |  P32 |  P64
diff --git a/compiler/test/runnable/bitfieldsposix32.c b/compiler/test/runnable/bitfieldsposix32.c
index 790b594912..19804a06db 100644
--- a/compiler/test/runnable/bitfieldsposix32.c
+++ b/compiler/test/runnable/bitfieldsposix32.c
@@ -1,5 +1,5 @@
 /* test bitfields
- * DISABLED: win32 win64 linux64 freebsd64 openbsd64 osx64
+ * DISABLED: win32 win64 linux64 freebsd64 openbsd64 osx64 hurd64
  * RUN_OUTPUT:
 ---
 T0 = 1 1 | 1 1
diff --git a/compiler/test/runnable/bitfieldsposix64.c b/compiler/test/runnable/bitfieldsposix64.c
index 8a2b089334..d4196376a9 100644
--- a/compiler/test/runnable/bitfieldsposix64.c
+++ b/compiler/test/runnable/bitfieldsposix64.c
@@ -1,5 +1,5 @@
 /* test bitfields
- * DISABLED: win32 win64 linux32 freebsd32 openbsd32 osx32
+ * DISABLED: win32 win64 linux32 freebsd32 openbsd32 osx32 hurd32
  * RUN_OUTPUT:
 ---
 T0 = 1 1 | 1 1
diff --git a/compiler/test/runnable/dbitfieldsms.d b/compiler/test/runnable/dbitfieldsms.d
index 42157f7c7b..bcffb18a9d 100644
--- a/compiler/test/runnable/dbitfieldsms.d
+++ b/compiler/test/runnable/dbitfieldsms.d
@@ -1,6 +1,6 @@
 /* test bitfields for Microsoft C
  * REQUIRED_ARGS: -preview=bitfields
- * DISABLED: win32 linux freebsd openbsd osx
+ * DISABLED: win32 linux freebsd openbsd osx hurd
  * RUN_OUTPUT:
 ---
                 DM |   MS |  P32 |  P64
diff --git a/compiler/test/runnable/dbitfieldsposix32.d b/compiler/test/runnable/dbitfieldsposix32.d
index 33ef3acdb4..cf9d0be9cd 100644
--- a/compiler/test/runnable/dbitfieldsposix32.d
+++ b/compiler/test/runnable/dbitfieldsposix32.d
@@ -1,6 +1,6 @@
 /* test bitfields
  * REQUIRED_ARGS: -preview=bitfields
- * DISABLED: win32 win64 linux64 freebsd64 openbsd64 osx64
+ * DISABLED: win32 win64 linux64 freebsd64 openbsd64 osx64 hurd64
  * RUN_OUTPUT:
 ---
 T0 = 1 1 | 1 1
diff --git a/compiler/test/runnable/dbitfieldsposix64.d b/compiler/test/runnable/dbitfieldsposix64.d
index 59aaf27327..6af0ab32b5 100644
--- a/compiler/test/runnable/dbitfieldsposix64.d
+++ b/compiler/test/runnable/dbitfieldsposix64.d
@@ -1,6 +1,6 @@
 /* test bitfields
  * REQUIRED_ARGS: -preview=bitfields
- * DISABLED: win32 win64 linux32 freebsd32 openbsd32 osx32
+ * DISABLED: win32 win64 linux32 freebsd32 openbsd32 osx32 hurd32
  * RUN_OUTPUT:
 ---
 T0 = 1 1 | 1 1
diff --git a/compiler/test/runnable/dhry.d b/compiler/test/runnable/dhry.d
index 4d2e1b3c64..598feda290 100644
--- a/compiler/test/runnable/dhry.d
+++ b/compiler/test/runnable/dhry.d
@@ -945,3 +945,18 @@ version (OpenBSD)
      return q;
     }
 }
+version (Hurd)
+{
+    import core.sys.posix.sys.time;
+
+    double dtime()
+    {
+     double q;
+     timeval tv;
+
+     gettimeofday(&tv,null);
+     q = cast(double)tv.tv_sec + cast(double)tv.tv_usec * 1.0e-6;
+
+     return q;
+    }
+}
diff --git a/compiler/test/runnable/ice21727.d b/compiler/test/runnable/ice21727.d
index c373c53c25..e4f615297b 100644
--- a/compiler/test/runnable/ice21727.d
+++ b/compiler/test/runnable/ice21727.d
@@ -1,5 +1,5 @@
 // REQUIRED_ARGS: -m64 -O -inline
-// DISABLED: win32 linux32 freebsd32 osx32 openbsd32 netbsd32 dragonflybsd32
+// DISABLED: win32 linux32 freebsd32 osx32 openbsd32 netbsd32 dragonflybsd32 hurd32
 // https://issues.dlang.org/show_bug.cgi?id=21727
 
 import core.simd;
diff --git a/compiler/test/runnable/test22.d b/compiler/test/runnable/test22.d
index 38a9cc367e..d46982310b 100644
--- a/compiler/test/runnable/test22.d
+++ b/compiler/test/runnable/test22.d
@@ -760,7 +760,37 @@ do
             ;
         }
         }
-        else
+        else version (Hurd)
+	{
+        asm     // assembler by W. Bright
+        {
+            // EDX = (A.length - 1) * real.sizeof
+            mov     ECX,A[EBP]          ; // ECX = A.length
+            dec     ECX                 ;
+            lea     EDX,[ECX][ECX*8]    ;
+            add     EDX,ECX             ;
+            add     EDX,ECX             ;
+            add     EDX,ECX             ;
+            add     EDX,A+4[EBP]        ;
+            fld     real ptr [EDX]      ; // ST0 = coeff[ECX]
+            jecxz   return_ST           ;
+            fld     x[EBP]              ; // ST0 = x
+            fxch    ST(1)               ; // ST1 = x, ST0 = r
+            align   4                   ;
+    L2:     fmul    ST,ST(1)            ; // r *= x
+            fld     real ptr -12[EDX]   ;
+            sub     EDX,12              ; // deg--
+            faddp   ST(1),ST            ;
+            dec     ECX                 ;
+            jne     L2                  ;
+            fxch    ST(1)               ; // ST1 = r, ST0 = x
+            fstp    ST(0)               ; // dump x
+            align   4                   ;
+    return_ST:                          ;
+            ;
+        }
+        }
+	else
         {
         asm     // assembler by W. Bright
         {
diff --git a/compiler/test/runnable/test23343.c b/compiler/test/runnable/test23343.c
index 27ff5a7cb8..eeb3f1054e 100644
--- a/compiler/test/runnable/test23343.c
+++ b/compiler/test/runnable/test23343.c
@@ -1,4 +1,4 @@
-/* DISABLED: win linux freebsd openbsd osx32 dragonflybsd netbsd
+/* DISABLED: win linux freebsd openbsd osx32 dragonflybsd netbsd hurd
  */
 
 /* https://issues.dlang.org/show_bug.cgi?id=23343
diff --git a/compiler/test/runnable/test_cdstrpar.d b/compiler/test/runnable/test_cdstrpar.d
index 90aa499ab9..1a2907de96 100644
--- a/compiler/test/runnable/test_cdstrpar.d
+++ b/compiler/test/runnable/test_cdstrpar.d
@@ -1,7 +1,7 @@
 // REQUIRED_ARGS: -O -fPIC
 // PERMUTE_ARGS:
 // only testing on SYSV-ABI, but backend code is identical across platforms
-// DISABLED: win32 win64 osx linux32 freebsd32 openbsd32
+// DISABLED: win32 win64 osx linux32 freebsd32 openbsd32 hurd32
 debug = PRINTF;
 debug (PRINTF) import core.stdc.stdio;
 
diff --git a/compiler/test/runnable/testargtypes.d b/compiler/test/runnable/testargtypes.d
index 4492420aa8..8f08348a61 100644
--- a/compiler/test/runnable/testargtypes.d
+++ b/compiler/test/runnable/testargtypes.d
@@ -1,5 +1,5 @@
 /*
-DISABLED: win32 win64 osx32 linux32 freebsd32 openbsd32
+DISABLED: win32 win64 osx32 linux32 freebsd32 openbsd32 hurd32
 */
 
 void chkArgTypes(S, V...)()
diff --git a/compiler/test/runnable_cxx/cpp_abi_tests.d b/compiler/test/runnable_cxx/cpp_abi_tests.d
index 4e241749fb..5240009816 100644
--- a/compiler/test/runnable_cxx/cpp_abi_tests.d
+++ b/compiler/test/runnable_cxx/cpp_abi_tests.d
@@ -1,5 +1,5 @@
 // EXTRA_CPP_SOURCES: cpp_abi_tests.cpp
-// CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd): -std=c++11
+// CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd hurd): -std=c++11
 
 // N.B MSVC doesn't have a C++11 switch, but it defaults to the latest fully-supported standard
 // N.B MSVC 2013 doesn't support char16_t/char32_t
diff --git a/compiler/test/runnable_cxx/cppa.d b/compiler/test/runnable_cxx/cppa.d
index c62bc6face..f7bc035895 100644
--- a/compiler/test/runnable_cxx/cppa.d
+++ b/compiler/test/runnable_cxx/cppa.d
@@ -2,7 +2,7 @@
 // PERMUTE_ARGS: -g
 // EXTRA_CPP_SOURCES: cppb.cpp
 // EXTRA_FILES: extra-files/cppb.h
-// CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd): -std=c++11
+// CXXFLAGS(linux freebsd osx openbsd netbsd dragonflybsd hurd): -std=c++11
 // druntime isn't linked, this prevents missing symbols '_d_arraybounds_slicep':
 // REQUIRED_ARGS: -checkaction=C
 // TRANSFORM_OUTPUT: remove_lines("warning: vsprintf\(\) is often misused")
diff --git a/compiler/test/runnable_cxx/nonpod_byval.d b/compiler/test/runnable_cxx/nonpod_byval.d
index c7fac46a04..4314d6b3a8 100644
--- a/compiler/test/runnable_cxx/nonpod_byval.d
+++ b/compiler/test/runnable_cxx/nonpod_byval.d
@@ -1,5 +1,5 @@
 // EXTRA_CPP_SOURCES: cpp_nonpod_byval.cpp
-// CXXFLAGS(linux osx freebsd dragonflybsd): -std=c++11
+// CXXFLAGS(linux osx freebsd dragonflybsd hurd): -std=c++11
 
 extern (C) int printf(const(char)*, ...);
 
diff --git a/compiler/test/tools/paths.d b/compiler/test/tools/paths.d
index acb525bda7..1b1ca9d07c 100644
--- a/compiler/test/tools/paths.d
+++ b/compiler/test/tools/paths.d
@@ -27,6 +27,8 @@ else version (Solaris)
     enum os = "solaris";
 else version (SunOS)
     enum os = "solaris";
+else version (Hurd)
+    enum os = "hurd";
 else
     static assert(0, "Unrecognized or unsupported OS.");
 
-- 
2.52.0

Reply via email to