gnu: dmd: Support GNU/Hurd.
Changes
4 files changed · +5273 −16
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| gnu/local.mk | modified | +2 | −0 | View file |
| gnu/packages/dlang.scm | modified | +46 | −16 | View file |
| gnu/packages/patches/dmd-hurd.patch | added | +5161 | −0 | View file |
| gnu/packages/patches/phobos-hurd.patch | added | +64 | −0 | View file |
Only the first 600 diff lines are shown. Download the complete patch.
gnu/local.mk
View filediff --git a/gnu/local.mk b/gnu/local.mk
index c8fa40c..49d224a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1199,6 +1199,7 @@ dist_patch_DATA = \
%D%/packages/patches/directfb-davinci-glibc-228-compat.patch \
%D%/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch \
%D%/packages/patches/dkimproxy-add-ipv6-support.patch \
+ %D%/packages/patches/dmd-hurd.patch \
%D%/packages/patches/doc++-gcc-14.patch \
%D%/packages/patches/docbook-utils-documentation-edits.patch \
%D%/packages/patches/docbook-utils-escape-characters.patch \
@@ -2101,6 +2102,7 @@ dist_patch_DATA = \
%D%/packages/patches/pdl-2.100-reproducibility.patch \
%D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch \
%D%/packages/patches/pharo-vm-cmake.patch \
+ %D%/packages/patches/phobos-hurd.patch \
%D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
%D%/packages/patches/plasp-fix-normalization.patch \
%D%/packages/patches/plasp-include-iostream.patch \
gnu/packages/dlang.scm
View filediff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 649a096..6318676 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -351,7 +351,9 @@ integration tests...\n")
(file-name (git-file-name "dmd" version))
(sha256
(base32
- "0qvg2fb73kyng8k1wj482g07ar2qw5laa5fynwx7pdd610n0pjpc"))))
+ "0qvg2fb73kyng8k1wj482g07ar2qw5laa5fynwx7pdd610n0pjpc"))
+ (patches
+ (search-patches "dmd-hurd.patch"))))
(build-system gnu-build-system)
(arguments
(list
@@ -372,7 +374,16 @@ integration tests...\n")
;; Do not build the shared libphobos2.so library, to avoid
;; retaining a reference to gcc:lib.
"SHARED=0"
- "DIFFABLE=1" ;constant timestamp
+ #$@(if (target-hurd?)
+ (list (string-append "DISABLED_TESTS=core/thread/osthread "
+ "std/parallelism " ;; pthread stubs
+ "std/file " ;; rename (NULL, "")
+ "std/socket " ;; ENOPROTOOPT
+ "std/datetime/systime "
+ "std/datetime/timezone " ;; TZDIR
+ "std/net/curl ")) ;; dlopen curl
+ '())
+ "DIFFABLE=1" ;constant timestamp
"VERBOSE=1")
#:modules
`(,@%default-gnu-modules
@@ -470,7 +481,19 @@ integration tests...\n")
"long_backtrace_trunc rt_trap_exceptions "))
""))
(substitute* "dmd/druntime/test/gc/Makefile"
- ((" invariant ") " "))))
+ ((" invariant ") " "))
+
+ #$@(if (target-hurd?)
+ '((for-each
+ delete-file
+ ;; environment differs in LD_ORIGIN_PATH
+ '("dmd/compiler/test/dshell/sameenv.d"
+ ;; Non _GLIBCXX_USE_CXX98_ABI version prints a warning
+ "dmd/compiler/test/runnable_cxx/cppa.d"))
+ ;; Segfault
+ (substitute* "dmd/druntime/test/shared/Makefile"
+ (("loadDR host ") "")))
+ '())))
(delete 'bootstrap)
(delete 'configure)
(replace 'build
@@ -492,7 +515,8 @@ integration tests...\n")
(phase-in-sub-dir 'check "phobos"))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
- (let* ((platform (cond (#$(target-linux?) "linux")))
+ (let* ((platform (cond (#$(target-linux?) "linux")
+ (#$(target-hurd?) "hurd")))
(bits (if #$(target-64bit?) 64 32))
(build-sub-dir (format #f "generated/~a/release/~a"
platform bits))
@@ -536,17 +560,22 @@ integration tests...\n")
(inputs
(list bash-minimal))
(native-inputs
- (list gdmd which
- gdb/pinned ; for tests
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/dlang/phobos")
- (commit (string-append "v" version))))
- (file-name (git-file-name "phobos" version))
- (sha256
- (base32
- "0afi5glnf96242cbnr10ccjvfsgkh4k5y7qnmxv4ph5g0izvi1dc")))))
+ (append
+ (if (target-linux?)
+ ;; gdb tests only on on linux
+ (list gdb/pinned)
+ '())
+ (list gdmd which
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/phobos")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name "phobos" version))
+ (sha256
+ (base32
+ "0afi5glnf96242cbnr10ccjvfsgkh4k5y7qnmxv4ph5g0izvi1dc"))
+ (patches (search-patches "phobos-hurd.patch"))))))
(outputs '("out" "lib" "debug"))
(synopsis "Reference D Programming Language compiler")
(description "@acronym{DMD, Digital Mars D compiler} is the reference
@@ -555,7 +584,8 @@ compiler for the D programming language.")
(home-page "https://github.com/dlang/dmd")
;; As reported by upstream:
;; https://wiki.dlang.org/Compilers#Comparison
- (supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"))
+ (supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"
+ "i586-gnu" "x86_64-gnu"))
;; This variant exists only for bootstrapping purposes.
(properties '((hidden? . #t)))))
gnu/packages/patches/dmd-hurd.patch
View filediff --git a/gnu/packages/patches/dmd-hurd.patch b/gnu/packages/patches/dmd-hurd.patch
new file mode 100644
index 0000000..cd249eb
--- /dev/null
+++ b/gnu/packages/patches/dmd-hurd.patch
@@ -0,0 +1,5161 @@
+Taken from:
+ * https://github.com/dlang/dmd/pull/22787
+
+
+From 049fc0b537bcc921ca66fb07c9ba147c11ea67a8 Mon Sep 17 00:00:00 2001
+From: Yelninei <[email protected]>
+Date: Sat, 21 Mar 2026 15:45:23 +0000
+Subject: [PATCH 1/5] dmd: file: Add PROT_READ to mmap protections.
+
+---
+ compiler/src/dmd/common/file.d | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/compiler/src/dmd/common/file.d b/compiler/src/dmd/common/file.d
+index 203ee27abd..0b4ef3c73e 100644
+--- a/compiler/src/dmd/common/file.d
++++ b/compiler/src/dmd/common/file.d
+@@ -122,7 +122,7 @@ struct FileMapping(Datum)
+
+ if (size > 0 && size != ulong.max && size <= size_t.max)
+ {
+- auto p = mmap(null, cast(size_t) size, is(Datum == const) ? PROT_READ : PROT_WRITE, MAP_SHARED, handle, 0);
++ auto p = mmap(null, cast(size_t) size, is(Datum == const) ? PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, handle, 0);
+ if (p == MAP_FAILED)
+ {
+ fprintf(stderr, "mmap(null, %zu) for \"%s\" failed: %s\n", cast(size_t) size, filename, strerror(errno));
+@@ -383,8 +383,8 @@ struct FileMapping(Datum)
+ }
+ if (size > 0)
+ {
+- auto p = mmap(null, size, PROT_WRITE, MAP_SHARED, handle, 0);
+- if (cast(ssize_t) p == -1)
++ auto p = mmap(null, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle, 0);
++ if (p == MAP_FAILED)
+ {
+ fprintf(stderr, "mmap() failed for \"%s\": %s\n", filename, strerror(errno));
+ exit(1);
+--
+2.52.0
+
+From a28335402798ae7754e3b97dae6d9971243d4b17 Mon Sep 17 00:00:00 2001
+From: Yelninei <[email protected]>
+Date: Sat, 21 Mar 2026 15:42:32 +0000
+Subject: [PATCH 2/5] 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 | 41 +++++++++++++++---------
+ compiler/src/osmodel.mak | 7 ++--
+ 18 files changed, 139 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,
+ }
+
This diff is incomplete. Download the complete patch.
gnu/packages/patches/phobos-hurd.patch
View fileThis diff is incomplete. Download the complete patch.