aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorPasha <pasha@member.fsf.org>2024-02-29 19:30:30 +0000
committerPasha <pasha@member.fsf.org>2024-02-29 19:30:30 +0000
commit84d199451cf33734003c00c043a1480920f5563b (patch)
tree4655f03b3637184bfb363b4e86d376756e85c9e3 /patches
downloadcross-hurd-84d199451cf33734003c00c043a1480920f5563b.tar.gz
cross-hurd-84d199451cf33734003c00c043a1480920f5563b.tar.bz2
initial commit
Diffstat (limited to 'patches')
-rw-r--r--patches/dash/dash-path-max.patch12
-rw-r--r--patches/gcc/hurd-amd64.diff127
-rw-r--r--patches/gcc/hurd-multiarch.diff16
-rw-r--r--patches/gcc/hurd-multilib-multiarch.diff23
-rw-r--r--patches/glibc/local-clock_gettime_MONOTONIC.diff133
-rw-r--r--patches/glibc/local-static_pthread_setcancelstate.diff87
-rw-r--r--patches/glibc/submitted-AF_LINK.diff29
-rw-r--r--patches/glibc/tg-bits_atomic.h_multiple_threads.diff279
-rw-r--r--patches/glibc/tg-mach-hurd-link.diff32
-rw-r--r--patches/glibc/tg-unlockpt-chroot.diff22
-rw-r--r--patches/glibc/unsubmitted-getaux_at_secure.diff30
-rw-r--r--patches/glibc/unsubmitted-prof-eintr.diff21
-rw-r--r--patches/gnumach/50_initrd.patch326
-rw-r--r--patches/gnumach/79_dde-debian.patch274
-rw-r--r--patches/grep/gnulib-hurd-x86_64.patch50
-rw-r--r--patches/hurd/link-rump.patch13
-rw-r--r--patches/libgpg-error/hurd-amd64.patch54
-rw-r--r--patches/shadow/shadow-utmp.patch11
18 files changed, 1539 insertions, 0 deletions
diff --git a/patches/dash/dash-path-max.patch b/patches/dash/dash-path-max.patch
new file mode 100644
index 0000000..bc6924d
--- /dev/null
+++ b/patches/dash/dash-path-max.patch
@@ -0,0 +1,12 @@
+diff -Naur dash-0.5.12/src/expand.c cross-hurd/src/dash-0.5.12/src/expand.c
+--- dash-0.5.12.old/src/expand.c 2022-12-11 01:29:21.000000000 -0500
++++ dash-0.5.12/src/expand.c 2023-05-25 00:26:17.332804650 -0400
+@@ -84,6 +84,8 @@
+ #define RMESCAPE_GROW 0x8 /* Grow strings instead of stalloc */
+ #define RMESCAPE_HEAP 0x10 /* Malloc strings instead of stalloc */
+
++#define PATH_MAX 4096
++
+ /* Add CTLESC when necessary. */
+ #define QUOTES_ESC (EXP_FULL | EXP_CASE)
+
diff --git a/patches/gcc/hurd-amd64.diff b/patches/gcc/hurd-amd64.diff
new file mode 100644
index 0000000..0899c3d
--- /dev/null
+++ b/patches/gcc/hurd-amd64.diff
@@ -0,0 +1,127 @@
+commit 5707e9db9c398d311defc80c5b7822c9a07ead60
+Author: Samuel Thibault <samuel.thibault@gnu.org>
+Date: Sat May 6 13:50:36 2023 +0200
+
+ hurd: Add multilib paths for gnu-x86_64
+
+ We need the multilib paths in gcc to find e.g. glibc crt files on
+ Debian. This is essentially based on t-linux64 version.
+
+ gcc/ChangeLog:
+
+ * config/i386/t-gnu64: New file.
+ * config.gcc [x86_64-*-gnu*]: Add i386/t-gnu64 to
+ tmake_file.
+
+commit c768917402d4cba69a92c737e56e177f5b8ab0df
+Author: Samuel Thibault <samuel.thibault@gnu.org>
+Date: Sat May 6 13:55:44 2023 +0200
+
+ hurd: Ad default-pie and static-pie support
+
+ This fixes the Hurd spec in the default-pie case, and adds static-pie
+ support.
+
+ gcc/ChangeLog:
+
+ * config/i386/gnu.h: Use PIE_SPEC, add static-pie case.
+ * config/i386/gnu64.h: Use PIE_SPEC, add static-pie case.
+
+diff --git a/gcc/config.gcc b/gcc/config.gcc
+index 3000379cafc..e62849c1230 100644
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -5973,6 +5973,9 @@ case ${target} in
+ visium-*-*)
+ target_cpu_default2="TARGET_CPU_$with_cpu"
+ ;;
++ x86_64-*-gnu*)
++ tmake_file="$tmake_file i386/t-gnu64"
++ ;;
+ esac
+
+ t=
+diff --git a/src/gcc/config/i386/t-gnu64 b/src/gcc/config/i386/t-gnu64
+new file mode 100644
+index 00000000000..23ee6823d65
+--- /dev/null
++++ b/gcc/config/i386/t-gnu64
+@@ -0,0 +1,38 @@
++# Copyright (C) 2002-2023 Free Software Foundation, Inc.
++#
++# This file is part of GCC.
++#
++# GCC is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3, or (at your option)
++# any later version.
++#
++# GCC is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# along with GCC; see the file COPYING3. If not see
++# <http://www.gnu.org/licenses/>.
++
++# On Debian, Ubuntu and other derivative distributions, the 32bit libraries
++# are found in /lib32 and /usr/lib32, /lib64 and /usr/lib64 are symlinks to
++# /lib and /usr/lib, while other distributions install libraries into /lib64
++# and /usr/lib64. The LSB does not enforce the use of /lib64 and /usr/lib64,
++# it doesn't tell anything about the 32bit libraries on those systems. Set
++# MULTILIB_OSDIRNAMES according to what is found on the target.
++
++# To support i386, x86-64 and x32 libraries, the directory structrue
++# should be:
++#
++# /lib has i386 libraries.
++# /lib64 has x86-64 libraries.
++# /libx32 has x32 libraries.
++#
++comma=,
++MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
++MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
++MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
++MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
+
+
+diff --git a/gcc/config/i386/gnu.h b/gcc/config/i386/gnu.h
+index 8dc6d9ee4e3..e776144f96c 100644
+--- a/gcc/config/i386/gnu.h
++++ b/gcc/config/i386/gnu.h
+@@ -27,12 +27,12 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
+ #undef STARTFILE_SPEC
+ #if defined HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
+
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+diff --git a/gcc/config/i386/gnu64.h b/gcc/config/i386/gnu64.h
+index a411f0e802a..332372fa067 100644
+--- a/gcc/config/i386/gnu64.h
++++ b/gcc/config/i386/gnu64.h
+@@ -31,10 +31,10 @@ along with GCC. If not, see <http://www.gnu.org/licenses/>.
+ #undef STARTFILE_SPEC
+ #if defined HAVE_LD_PIE
+ #define STARTFILE_SPEC \
+- "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};pie:Scrt1.o%s;static:crt0.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ "%{!shared: %{pg|p|profile:%{static-pie:grcrt0.o%s;static:gcrt0.o%s;:gcrt1.o%s};static-pie:rcrt0.o%s;static:crt0.o%s;" PIE_SPEC ":Scrt1.o%s;:crt1.o%s}} \
++ crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
+ #else
+ #define STARTFILE_SPEC \
+ "%{!shared: %{pg|p|profile:%{static:gcrt0.o%s;:gcrt1.o%s};static:crt0.o%s;:crt1.o%s}} \
+- crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
++ crti.o%s %{static:crtbeginT.o%s;shared|static-pie|" PIE_SPEC ":crtbeginS.o%s;:crtbegin.o%s}"
+ #endif
diff --git a/patches/gcc/hurd-multiarch.diff b/patches/gcc/hurd-multiarch.diff
new file mode 100644
index 0000000..82271f0
--- /dev/null
+++ b/patches/gcc/hurd-multiarch.diff
@@ -0,0 +1,16 @@
+--- a/gcc/config/i386/t-gnu64 2023-05-06 22:43:39.395795420 +0200
++++ b/gcc/config/i386/t-gnu64 2023-05-06 22:43:39.395795420 +0200
+@@ -36,3 +36,13 @@
+ MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
+ MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-gnu)
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
++
++ifneq (,$(findstring x86_64,$(target)))
++ ifneq (,$(findstring biarchx32.h,$(tm_include_list)))
++ MULTIARCH_DIRNAME = $(call if_multiarch,x86_64-gnux32)
++ else
++ MULTIARCH_DIRNAME = $(call if_multiarch,x86_64-gnu)
++ endif
++else
++ MULTIARCH_DIRNAME = $(call if_multiarch,i386-gnu)
++endif
diff --git a/patches/gcc/hurd-multilib-multiarch.diff b/patches/gcc/hurd-multilib-multiarch.diff
new file mode 100644
index 0000000..8173450
--- /dev/null
+++ b/patches/gcc/hurd-multilib-multiarch.diff
@@ -0,0 +1,23 @@
+--- a/gcc/config/i386/t-gnu64 2023-05-06 22:43:39.395795420 +0200
++++ b/gcc/config/i386/t-gnu64 2023-05-06 22:43:39.395795420 +0200
+@@ -33,9 +33,19 @@
+ comma=,
+ MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+ MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
++ifneq (,$(findstring gnux32,$(target)))
+ MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../lib$(call if_multiarch,:x86_64-gnux32)
++else ifneq (,$(findstring x86_64,$(target)))
++MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib32$(call if_multiarch,:i386-gnu)
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
++else
++MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-gnu)
++MULTILIB_OSDIRNAMES+= m32=../lib$(call if_multiarch,:i386-gnu)
++MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-gnux32)
++endif
+
+ ifneq (,$(findstring x86_64,$(target)))
+ ifneq (,$(findstring biarchx32.h,$(tm_include_list)))
diff --git a/patches/glibc/local-clock_gettime_MONOTONIC.diff b/patches/glibc/local-clock_gettime_MONOTONIC.diff
new file mode 100644
index 0000000..3207a94
--- /dev/null
+++ b/patches/glibc/local-clock_gettime_MONOTONIC.diff
@@ -0,0 +1,133 @@
+Use the realtime clock for the monotonic clock. This is of course not a proper
+implementation (which is being done in Mach), but will permit to fix at least
+the iceweasel stack.
+
+vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
+_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
+former.
+
+---
+ sysdeps/mach/hurd/bits/posix_opt.h | 2 +-
+ sysdeps/unix/clock_gettime.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+Index: glibc-2.27/sysdeps/mach/clock_gettime.c
+===================================================================
+--- glibc-2.27.orig/sysdeps/mach/clock_gettime.c
++++ glibc-2.27/sysdeps/mach/clock_gettime.c
+@@ -31,6 +31,10 @@ __clock_gettime (clockid_t clock_id, str
+ switch (clock_id) {
+
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
++ case CLOCK_MONOTONIC_RAW:
++ case CLOCK_REALTIME_COARSE:
++ case CLOCK_MONOTONIC_COARSE:
+ {
+ /* __host_get_time can only fail if passed an invalid host_t.
+ __mach_host_self could theoretically fail (producing an
+Index: glibc-2.27/rt/timer_create.c
+===================================================================
+--- glibc-2.27.orig/rt/timer_create.c
++++ glibc-2.27/rt/timer_create.c
+@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct
+ return -1;
+ }
+
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_MONOTONIC_RAW && clock_id != CLOCK_REALTIME_COARSE && clock_id != CLOCK_MONOTONIC_COARSE)
+ {
+ __set_errno (EINVAL);
+ return -1;
+Index: glibc-2.27/sysdeps/mach/hurd/bits/posix_opt.h
+===================================================================
+--- glibc-2.27.orig/sysdeps/mach/hurd/bits/posix_opt.h
++++ glibc-2.27/sysdeps/mach/hurd/bits/posix_opt.h
+@@ -163,10 +163,10 @@
+ #define _POSIX_THREAD_PROCESS_SHARED -1
+
+ /* The monotonic clock might be available. */
+-#define _POSIX_MONOTONIC_CLOCK 0
++#define _POSIX_MONOTONIC_CLOCK 200809L
+
+-/* The clock selection interfaces are available. */
+-#define _POSIX_CLOCK_SELECTION 200809L
++/* The clock selection interfaces are not really available yet. */
++#define _POSIX_CLOCK_SELECTION -1
+
+ /* Advisory information interfaces could be available in future. */
+ #define _POSIX_ADVISORY_INFO 0
+Index: glibc-upstream/sysdeps/posix/clock_getres.c
+===================================================================
+--- glibc-upstream.orig/sysdeps/posix/clock_getres.c
++++ glibc-upstream/sysdeps/posix/clock_getres.c
+@@ -52,6 +52,10 @@ __clock_getres (clockid_t clock_id, stru
+ switch (clock_id)
+ {
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
++ case CLOCK_MONOTONIC_RAW:
++ case CLOCK_REALTIME_COARSE:
++ case CLOCK_MONOTONIC_COARSE:
+ retval = realtime_getres (res);
+ break;
+
+--- ./sysdeps/mach/clock_nanosleep.c.original 2020-07-21 00:31:35.226113142 +0200
++++ ./sysdeps/mach/clock_nanosleep.c 2020-07-21 00:31:49.026185761 +0200
+@@ -62,7 +62,7 @@
+ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
+ struct timespec *rem)
+ {
+- if (clock_id != CLOCK_REALTIME
++ if ((clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_MONOTONIC_RAW && clock_id != CLOCK_REALTIME_COARSE && clock_id != CLOCK_MONOTONIC_COARSE)
+ || !valid_nanoseconds (req->tv_nsec)
+ || (flags != 0 && flags != TIMER_ABSTIME))
+ return EINVAL;
+Index: glibc-2.32/hurd/hurdlock.c
+===================================================================
+--- glibc-2.32.orig/hurd/hurdlock.c
++++ glibc-2.32/hurd/hurdlock.c
+@@ -47,7 +47,7 @@ int
+ __lll_abstimed_wait (void *ptr, int val,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ int mlsec = compute_reltime (tsp, clk);
+@@ -59,7 +59,7 @@ int
+ __lll_abstimed_wait_intr (void *ptr, int val,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ int mlsec = compute_reltime (tsp, clk);
+@@ -79,7 +79,7 @@ int
+ __lll_abstimed_xwait (void *ptr, int lo, int hi,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ int mlsec = compute_reltime (tsp, clk);
+@@ -91,7 +91,7 @@ int
+ __lll_abstimed_lock (void *ptr,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ if (__lll_trylock (ptr) == 0)
+@@ -177,7 +177,7 @@ __lll_robust_abstimed_lock (void *ptr,
+ int wait_time = 25;
+ unsigned int val;
+
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ while (1)
diff --git a/patches/glibc/local-static_pthread_setcancelstate.diff b/patches/glibc/local-static_pthread_setcancelstate.diff
new file mode 100644
index 0000000..18684a0
--- /dev/null
+++ b/patches/glibc/local-static_pthread_setcancelstate.diff
@@ -0,0 +1,87 @@
+since the move of libpthread functions to libc, glibc dropped the use
+of __libc_ptf_call. But htl hasn't made the move yet, so we have to use
+__libc_ptf_call there for now.
+
+Index: glibc-2.36/misc/error.c
+===================================================================
+--- glibc-2.36.orig/misc/error.c
++++ glibc-2.36/misc/error.c
+@@ -240,7 +240,8 @@ __error_internal (int status, int errnum
+ /* We do not want this call to be cut short by a thread
+ cancellation. Therefore disable cancellation for now. */
+ int state = PTHREAD_CANCEL_ENABLE;
+- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
++ __libc_ptf_call (__pthread_setcancelstate,
++ (PTHREAD_CANCEL_DISABLE, &state), 0);
+ #endif
+
+ flush_stdout ();
+@@ -262,7 +263,7 @@ __error_internal (int status, int errnum
+
+ #ifdef _LIBC
+ _IO_funlockfile (stderr);
+- __pthread_setcancelstate (state, NULL);
++ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
+ #endif
+ }
+
+@@ -306,7 +307,9 @@ __error_at_line_internal (int status, in
+ /* We do not want this call to be cut short by a thread
+ cancellation. Therefore disable cancellation for now. */
+ int state = PTHREAD_CANCEL_ENABLE;
+- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
++ __libc_ptf_call (__pthread_setcancelstate,
++ (PTHREAD_CANCEL_DISABLE, &state),
++ 0);
+ #endif
+
+ flush_stdout ();
+@@ -336,7 +339,7 @@ __error_at_line_internal (int status, in
+
+ #ifdef _LIBC
+ _IO_funlockfile (stderr);
+- __pthread_setcancelstate (state, NULL);
++ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
+ #endif
+ }
+
+Index: glibc-2.36/libio/iopopen.c
+===================================================================
+--- glibc-2.36.orig/libio/iopopen.c
++++ glibc-2.36/libio/iopopen.c
+@@ -281,9 +281,10 @@ _IO_new_proc_close (FILE *fp)
+ do
+ {
+ int state;
+- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
++ __libc_ptf_call (__pthread_setcancelstate,
++ (PTHREAD_CANCEL_DISABLE, &state), 0);
+ wait_pid = __waitpid (((_IO_proc_file *) fp)->pid, &wstatus, 0);
+- __pthread_setcancelstate (state, NULL);
++ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
+ }
+ while (wait_pid == -1 && errno == EINTR);
+ if (wait_pid == -1)
+Index: glibc-2.36/stdlib/fmtmsg.c
+===================================================================
+--- glibc-2.36.orig/stdlib/fmtmsg.c
++++ glibc-2.36/stdlib/fmtmsg.c
+@@ -124,7 +124,8 @@ fmtmsg (long int classification, const c
+ /* We do not want this call to be cut short by a thread
+ cancellation. Therefore disable cancellation for now. */
+ int state = PTHREAD_CANCEL_ENABLE;
+- __pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &state);
++ __libc_ptf_call (__pthread_setcancelstate,
++ (PTHREAD_CANCEL_DISABLE, &state), 0);
+
+ __libc_lock_lock (lock);
+
+@@ -193,7 +194,7 @@ fmtmsg (long int classification, const c
+
+ __libc_lock_unlock (lock);
+
+- __pthread_setcancelstate (state, NULL);
++ __libc_ptf_call (__pthread_setcancelstate, (state, NULL), 0);
+
+ return result;
+ }
diff --git a/patches/glibc/submitted-AF_LINK.diff b/patches/glibc/submitted-AF_LINK.diff
new file mode 100644
index 0000000..e95a987
--- /dev/null
+++ b/patches/glibc/submitted-AF_LINK.diff
@@ -0,0 +1,29 @@
+Hurd: comment PF_LINK/AF_LINK defines
+
+Comment out the PF_LINK and AF_LINK defines, since they are usually associated
+with struct sockaddr_dl, which is not available on Hurd.
+
+2012-06-22 Pino Toscano <toscano.pino@tiscali.it>
+
+ * sysdeps/mach/hurd/bits/socket.h (PF_LINK): Comment out.
+ (AF_LINK): Likewise.
+--- a/sysdeps/mach/hurd/bits/socket.h
++++ b/sysdeps/mach/hurd/bits/socket.h
+@@ -97,7 +97,7 @@ enum __socket_type
+ #define PF_HYLINK 15 /* NSC Hyperchannel protocol. */
+ #define PF_APPLETALK 16 /* Don't use this. */
+ #define PF_ROUTE 17 /* Internal Routing Protocol. */
+-#define PF_LINK 18 /* Link layer interface. */
++/* #define PF_LINK 18 Link layer interface. */
+ #define PF_XTP 19 /* eXpress Transfer Protocol (no AF). */
+ #define PF_COIP 20 /* Connection-oriented IP, aka ST II. */
+ #define PF_CNT 21 /* Computer Network Technology. */
+@@ -130,7 +130,7 @@ enum __socket_type
+ #define AF_HYLINK PF_HYLINK
+ #define AF_APPLETALK PF_APPLETALK
+ #define AF_ROUTE PF_ROUTE
+-#define AF_LINK PF_LINK
++/* #define AF_LINK PF_LINK */
+ #ifdef __USE_MISC
+ # define pseudo_AF_XTP PF_XTP
+ #endif
diff --git a/patches/glibc/tg-bits_atomic.h_multiple_threads.diff b/patches/glibc/tg-bits_atomic.h_multiple_threads.diff
new file mode 100644
index 0000000..bc52b29
--- /dev/null
+++ b/patches/glibc/tg-bits_atomic.h_multiple_threads.diff
@@ -0,0 +1,279 @@
+From: Thomas Schwinge <thomas@schwinge.name>
+Subject: [PATCH] bits_atomic.h_multiple_threads
+
+TODO. bits/atomic.h for GNU Hurd.
+
+Source: Debian, eglibc-2.10/debian/patches/hurd-i386/local-atomic-no-multiple_threads.diff, r3536.
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+We always at least start the sigthread anyway. For now, let's avoid forking
+the file (which would mean having to maintain it).
+
+Need to override sysdeps/i386/i486/bits/atomic.h to remove Linuxisms.
+
+---
+ sysdeps/i386/atomic-machine.h | 107 +++++++++++++++---------------------------
+ 1 file changed, 37 insertions(+), 70 deletions(-)
+
+Index: glibc-2.23/sysdeps/x86/atomic-machine.h
+===================================================================
+--- glibc-2.23.orig/sysdeps/x86/atomic-machine.h
++++ glibc-2.23/sysdeps/x86/atomic-machine.h
+@@ -66,35 +66,26 @@ typedef uintmax_t uatomic_max_t;
+
+ #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \
+ ({ __typeof (*mem) ret; \
+- __asm __volatile ("cmpl $0, %%" SEG_REG ":%P5\n\t" \
+- "je 0f\n\t" \
+- "lock\n" \
+- "0:\tcmpxchgb %b2, %1" \
++ __asm __volatile ("lock\n" \
++ "\tcmpxchgb %b2, %1" \
+ : "=a" (ret), "=m" (*mem) \
+- : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval)); \
+ ret; })
+
+ #define __arch_c_compare_and_exchange_val_16_acq(mem, newval, oldval) \
+ ({ __typeof (*mem) ret; \
+- __asm __volatile ("cmpl $0, %%" SEG_REG ":%P5\n\t" \
+- "je 0f\n\t" \
+- "lock\n" \
+- "0:\tcmpxchgw %w2, %1" \
++ __asm __volatile ("lock\n" \
++ "\tcmpxchgw %w2, %1" \
+ : "=a" (ret), "=m" (*mem) \
+- : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval)); \
+ ret; })
+
+ #define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+ ({ __typeof (*mem) ret; \
+- __asm __volatile ("cmpl $0, %%" SEG_REG ":%P5\n\t" \
+- "je 0f\n\t" \
+- "lock\n" \
+- "0:\tcmpxchgl %2, %1" \
++ __asm __volatile ("lock\n" \
++ "\tcmpxchgl %2, %1" \
+ : "=a" (ret), "=m" (*mem) \
+- : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval)); \
+ ret; })
+
+ #ifdef __x86_64__
+@@ -210,24 +195,20 @@ typedef uintmax_t uatomic_max_t;
+ if (sizeof (*mem) == 1) \
+ __asm __volatile (lock "xaddb %b0, %1" \
+ : "=q" (__result), "=m" (*mem) \
+- : "0" (__addval), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "0" (__addval), "m" (*mem)); \
+ else if (sizeof (*mem) == 2) \
+ __asm __volatile (lock "xaddw %w0, %1" \
+ : "=r" (__result), "=m" (*mem) \
+- : "0" (__addval), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "0" (__addval), "m" (*mem)); \
+ else if (sizeof (*mem) == 4) \
+ __asm __volatile (lock "xaddl %0, %1" \
+ : "=r" (__result), "=m" (*mem) \
+- : "0" (__addval), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "0" (__addval), "m" (*mem)); \
+ else if (__HAVE_64B_ATOMICS) \
+ __asm __volatile (lock "xaddq %q0, %1" \
+ : "=r" (__result), "=m" (*mem) \
+ : "0" ((int64_t) cast_to_integer (__addval)), \
+- "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ "m" (*mem)); \
+ else \
+ __result = do_exchange_and_add_val_64_acq (pfx, (mem), __addval); \
+ __result; })
+@@ -238,7 +220,7 @@ typedef uintmax_t uatomic_max_t;
+ __sync_fetch_and_add (mem, value)
+
+ #define __arch_exchange_and_add_cprefix \
+- "cmpl $0, %%" SEG_REG ":%P4\n\tje 0f\n\tlock\n0:\t"
++ "lock\n\t"
+
+ #define catomic_exchange_and_add(mem, value) \
+ __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c, \
+@@ -254,24 +236,20 @@ typedef uintmax_t uatomic_max_t;
+ else if (sizeof (*mem) == 1) \
+ __asm __volatile (lock "addb %b1, %0" \
+ : "=m" (*mem) \
+- : IBR_CONSTRAINT (value), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : IBR_CONSTRAINT (value), "m" (*mem)); \
+ else if (sizeof (*mem) == 2) \
+ __asm __volatile (lock "addw %w1, %0" \
+ : "=m" (*mem) \
+- : "ir" (value), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (value), "m" (*mem)); \
+ else if (sizeof (*mem) == 4) \
+ __asm __volatile (lock "addl %1, %0" \
+ : "=m" (*mem) \
+- : "ir" (value), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (value), "m" (*mem)); \
+ else if (__HAVE_64B_ATOMICS) \
+ __asm __volatile (lock "addq %q1, %0" \
+ : "=m" (*mem) \
+ : "ir" ((int64_t) cast_to_integer (value)), \
+- "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ "m" (*mem)); \
+ else \
+ do_add_val_64_acq (apfx, (mem), (value)); \
+ } while (0)
+@@ -283,7 +262,7 @@ typedef uintmax_t uatomic_max_t;
+ __arch_add_body (LOCK_PREFIX, atomic, __arch, mem, value)
+
+ #define __arch_add_cprefix \
+- "cmpl $0, %%" SEG_REG ":%P3\n\tje 0f\n\tlock\n0:\t"
++ "lock\n\t"
+
+ #define catomic_add(mem, value) \
+ __arch_add_body (__arch_add_cprefix, atomic, __arch_c, mem, value)
+@@ -332,23 +311,19 @@ typedef uintmax_t uatomic_max_t;
+ if (sizeof (*mem) == 1) \
+ __asm __volatile (lock "incb %b0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else if (sizeof (*mem) == 2) \
+ __asm __volatile (lock "incw %w0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else if (sizeof (*mem) == 4) \
+ __asm __volatile (lock "incl %0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else if (__HAVE_64B_ATOMICS) \
+ __asm __volatile (lock "incq %q0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else \
+ do_add_val_64_acq (pfx, mem, 1); \
+ } while (0)
+@@ -359,7 +335,7 @@ typedef uintmax_t uatomic_max_t;
+ #define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, __arch, mem)
+
+ #define __arch_increment_cprefix \
+- "cmpl $0, %%" SEG_REG ":%P2\n\tje 0f\n\tlock\n0:\t"
++ "lock\n\t"
+
+ #define catomic_increment(mem) \
+ __arch_increment_body (__arch_increment_cprefix, __arch_c, mem)
+@@ -389,23 +365,19 @@ typedef uintmax_t uatomic_max_t;
+ if (sizeof (*mem) == 1) \
+ __asm __volatile (lock "decb %b0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else if (sizeof (*mem) == 2) \
+ __asm __volatile (lock "decw %w0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else if (sizeof (*mem) == 4) \
+ __asm __volatile (lock "decl %0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "m" (*mem)); \
+ else if (__HAVE_64B_ATOMICS) \
+ __asm __volatile (lock "decq %q0" \
+ : "=m" (*mem) \
+- : "m" (*mem), \
++ : "m" (*mem)); \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
+ else \
+ do_add_val_64_acq (pfx, mem, -1); \
+ } while (0)
+@@ -416,7 +389,7 @@ typedef uintmax_t uatomic_max_t;
+ #define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, __arch, mem)
+
+ #define __arch_decrement_cprefix \
+- "cmpl $0, %%" SEG_REG ":%P2\n\tje 0f\n\tlock\n0:\t"
++ "lock\n\t"
+
+ #define catomic_decrement(mem) \
+ __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem)
+@@ -487,29 +460,25 @@ typedef uintmax_t uatomic_max_t;
+ if (sizeof (*mem) == 1) \
+ __asm __volatile (lock "andb %b1, %0" \
+ : "=m" (*mem) \
+- : IBR_CONSTRAINT (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : IBR_CONSTRAINT (mask), "m" (*mem)); \
+ else if (sizeof (*mem) == 2) \
+ __asm __volatile (lock "andw %w1, %0" \
+ : "=m" (*mem) \
+- : "ir" (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (mask), "m" (*mem)); \
+ else if (sizeof (*mem) == 4) \
+ __asm __volatile (lock "andl %1, %0" \
+ : "=m" (*mem) \
+- : "ir" (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (mask), "m" (*mem)); \
+ else if (__HAVE_64B_ATOMICS) \
+ __asm __volatile (lock "andq %q1, %0" \
+ : "=m" (*mem) \
+- : "ir" (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (mask), "m" (*mem)); \
+ else \
+ __atomic_link_error (); \
+ } while (0)
+
+ #define __arch_cprefix \
+- "cmpl $0, %%" SEG_REG ":%P3\n\tje 0f\n\tlock\n0:\t"
++ "lock\n\t"
+
+ #define atomic_and(mem, mask) __arch_and_body (LOCK_PREFIX, mem, mask)
+
+@@ -516,23 +486,19 @@ typedef uintmax_t uatomic_max_t;
+ if (sizeof (*mem) == 1) \
+ __asm __volatile (lock "orb %b1, %0" \
+ : "=m" (*mem) \
+- : IBR_CONSTRAINT (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : IBR_CONSTRAINT (mask), "m" (*mem)); \
+ else if (sizeof (*mem) == 2) \
+ __asm __volatile (lock "orw %w1, %0" \
+ : "=m" (*mem) \
+- : "ir" (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (mask), "m" (*mem)); \
+ else if (sizeof (*mem) == 4) \
+ __asm __volatile (lock "orl %1, %0" \
+ : "=m" (*mem) \
+- : "ir" (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (mask), "m" (*mem)); \
+ else if (__HAVE_64B_ATOMICS) \
+ __asm __volatile (lock "orq %q1, %0" \
+ : "=m" (*mem) \
+- : "ir" (mask), "m" (*mem), \
+- "i" (offsetof (tcbhead_t, multiple_threads))); \
++ : "ir" (mask), "m" (*mem)); \
+ else \
+ __atomic_link_error (); \
+ } while (0)
diff --git a/patches/glibc/tg-mach-hurd-link.diff b/patches/glibc/tg-mach-hurd-link.diff
new file mode 100644
index 0000000..6ee98ed
--- /dev/null
+++ b/patches/glibc/tg-mach-hurd-link.diff
@@ -0,0 +1,32 @@
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Subject: [PATCH] Add -lmachuser -lhurduser to libc.so on GNU/Hurd.
+
+http://lists.gnu.org/archive/html/bug-hurd/2011-03/msg00112.html
+
+2011-03-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
+
+ * Makerules ($(inst_libdir)/libc.so): Add -lmachuser -lhurduser to
+ libc.so on GNU/Hurd.
+
+It's still unclear what we want to aim for.
+
+---
+ Makerules | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/Makerules b/Makerules
+index 53eabfaba8..b0f5e1b3a0 100644
+--- a/Makerules
++++ b/Makerules
+@@ -1066,6 +1066,9 @@ $(inst_libdir)/libc.so: $(common-objpfx)format.lds \
+ '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
+ ' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \
+ ) > $@.new
++ifeq ($(patsubst gnu%,,$(config-os)),)
++ echo 'INPUT ( AS_NEEDED ( -lmachuser -lhurduser ) )' >> $@.new
++endif
+ mv -f $@.new $@
+
+ endif
+--
+tg: (7bb5f8a836..) t/mach-hurd-link (depends on: baseline)
diff --git a/patches/glibc/tg-unlockpt-chroot.diff b/patches/glibc/tg-unlockpt-chroot.diff
new file mode 100644
index 0000000..a8f0d17
--- /dev/null
+++ b/patches/glibc/tg-unlockpt-chroot.diff
@@ -0,0 +1,22 @@
+From: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Subject: [PATCH] Fix pty path in chroot
+
+when e.g. using a chroot, the pty path is not so short.
+
+---
+ sysdeps/unix/bsd/unlockpt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: eglibc-2.16/sysdeps/unix/bsd/unlockpt.c
+===================================================================
+--- eglibc-2.16.orig/sysdeps/unix/bsd/unlockpt.c 2012-07-23 00:23:14.000000000 +0200
++++ eglibc-2.16/sysdeps/unix/bsd/unlockpt.c 2012-07-23 00:24:55.000000000 +0200
+@@ -27,7 +27,7 @@
+ int
+ unlockpt (int fd)
+ {
+- char buf[sizeof (_PATH_TTY) + 2];
++ char buf[1024]; /* XXX */
+
+ /* BSD doesn't have a lock, but it does have `revoke'. */
+ if (__ptsname_r (fd, buf, sizeof (buf)))
diff --git a/patches/glibc/unsubmitted-getaux_at_secure.diff b/patches/glibc/unsubmitted-getaux_at_secure.diff
new file mode 100644
index 0000000..0ecd5f7
--- /dev/null
+++ b/patches/glibc/unsubmitted-getaux_at_secure.diff
@@ -0,0 +1,30 @@
+FIXME: sysdeps/mach/hurd/i386/init-first.c should instead pass an auxv
+to __libc_start_main
+
+Index: glibc-2.33/misc/getauxval.c
+===================================================================
+--- glibc-2.33.orig/misc/getauxval.c
++++ glibc-2.33/misc/getauxval.c
+@@ -19,6 +19,7 @@
+ #include <errno.h>
+ #include <ldsodefs.h>
+ #include <stdbool.h>
++#include <unistd.h>
+
+ bool
+ __getauxval2 (unsigned long int type, unsigned long int *result)
+@@ -27,6 +28,14 @@ __getauxval2 (unsigned long int type, un
+ ElfW(auxv_t) *p;
+ #endif
+
++#ifdef AT_SECURE
++ if (type == AT_SECURE)
++ {
++ *result = __libc_enable_secure;
++ return true;
++ }
++#endif
++
+ if (type == AT_HWCAP)
+ {
+ *result = GLRO(dl_hwcap);
diff --git a/patches/glibc/unsubmitted-prof-eintr.diff b/patches/glibc/unsubmitted-prof-eintr.diff
new file mode 100644
index 0000000..1b0808c
--- /dev/null
+++ b/patches/glibc/unsubmitted-prof-eintr.diff
@@ -0,0 +1,21 @@
+When profiling ext2fs, the shutdown stops all RPC, which thus interrupts this
+open, and we have to retry here.
+
+TODO: is open really supposed to expose such EINTR? Should the generic gmon
+loop around EINTR (since there might be signals happening indeed)
+
+diff --git a/gmon/gmon.c b/gmon/gmon.c
+index 6439ed1caa..507ad0c9fc 100644
+--- a/gmon/gmon.c
++++ b/gmon/gmon.c
+@@ -390,8 +390,10 @@ write_gmon (void)
+
+ if (fd == -1)
+ {
++ do
+ fd = __open_nocancel ("gmon.out", O_CREAT | O_TRUNC | O_WRONLY
+ | O_NOFOLLOW | O_CLOEXEC, 0666);
++ while (fd < 0 && errno == EINTR);
+ if (fd < 0)
+ {
+ char buf[300];
diff --git a/patches/gnumach/50_initrd.patch b/patches/gnumach/50_initrd.patch
new file mode 100644
index 0000000..4b0226e
--- /dev/null
+++ b/patches/gnumach/50_initrd.patch
@@ -0,0 +1,326 @@
+Jérémie Koenig <jk@jk.fr.eu.org>
+Add ramdisk support for d-i.
+
+Index: gnumach/Makefrag.am
+===================================================================
+--- gnumach.orig/Makefrag.am
++++ gnumach/Makefrag.am
+@@ -324,6 +324,8 @@ libkernel_a_SOURCES += \
+ device/net_io.c \
+ device/net_io.h \
+ device/param.h \
++ device/ramdisk.c \
++ device/ramdisk.h \
+ device/subrs.c \
+ device/subrs.h \
+ device/tty.h
+Index: gnumach/i386/i386at/conf.c
+===================================================================
+--- gnumach.orig/i386/i386at/conf.c
++++ gnumach/i386/i386at/conf.c
+@@ -31,6 +31,7 @@
+ #include <device/conf.h>
+ #include <kern/mach_clock.h>
+ #include <i386at/model_dep.h>
++#include <device/ramdisk.h>
+
+ #define timename "time"
+
+@@ -138,6 +139,8 @@ struct dev_ops dev_name_list[] =
+ nodev_info },
+ #endif /* MACH_HYP */
+
++ RAMDISK_DEV_OPS,
++
+ #ifdef MACH_KMSG
+ { kmsgname, kmsgopen, kmsgclose, kmsgread,
+ nulldev_write, kmsggetstat, nulldev_setstat, nomap,
+Index: gnumach/kern/boot_script.c
+===================================================================
+--- gnumach.orig/kern/boot_script.c
++++ gnumach/kern/boot_script.c
+@@ -90,12 +90,20 @@ prompt_resume_task (struct cmd *cmd, con
+ return boot_script_prompt_task_resume (cmd);
+ }
+
++/* Create an initial ramdisk */
++static int
++ramdisk_create (struct cmd *cmd, long *val)
++{
++ return boot_script_ramdisk_create (cmd, (char **) val);
++}
++
+ /* List of builtin symbols. */
+ static struct sym builtin_symbols[] =
+ {
+ { "task-create", VAL_FUNC, (long) create_task, VAL_TASK, 0 },
+ { "task-resume", VAL_FUNC, (long) resume_task, VAL_NONE, 1 },
+ { "prompt-task-resume", VAL_FUNC, (long) prompt_resume_task, VAL_NONE, 1 },
++ { "ramdisk-create", VAL_FUNC, (long) ramdisk_create, VAL_STR, 0 },
+ };
+ #define NUM_BUILTIN (sizeof (builtin_symbols) / sizeof (builtin_symbols[0]))
+
+Index: gnumach/kern/bootstrap.c
+===================================================================
+--- gnumach.orig/kern/bootstrap.c
++++ gnumach/kern/bootstrap.c
+@@ -51,6 +51,7 @@
+ #include <vm/vm_user.h>
+ #include <vm/pmap.h>
+ #include <device/device_port.h>
++#include <device/ramdisk.h>
+
+ #if MACH_KDB
+ #include <machine/db_machdep.h>
+@@ -849,6 +850,23 @@ boot_script_free (void *ptr, unsigned in
+ }
+
+ int
++boot_script_ramdisk_create (struct cmd *cmd, char **name)
++{
++ struct multiboot_module *mod = cmd->hook;
++ vm_size_t size = mod->mod_end - mod->mod_start;
++ kern_return_t rc;
++ int no;
++
++ rc = ramdisk_create (size, (void *) phystokv (mod->mod_start), &no);
++ if (rc != KERN_SUCCESS)
++ return BOOT_SCRIPT_MACH_ERROR;
++
++ *name = boot_script_malloc (RAMDISK_NAMESZ);
++ sprintf(*name, RAMDISK_NAME "%d", no);
++ return 0;
++}
++
++int
+ boot_script_task_create (struct cmd *cmd)
+ {
+ kern_return_t rc = task_create_kernel(TASK_NULL, FALSE, &cmd->task);
+Index: gnumach/device/ramdisk.c
+===================================================================
+--- /dev/null
++++ gnumach/device/ramdisk.c
+@@ -0,0 +1,160 @@
++#include <mach/vm_param.h>
++#include <machine/vm_param.h>
++#include <vm/vm_kern.h>
++#include <vm/vm_user.h>
++#include <device/device_types.h>
++#include <device/ds_routines.h>
++#include <device/conf.h>
++#include <device/ramdisk.h>
++#include <kern/printf.h>
++#include <string.h>
++
++static struct ramdisk {
++ void *data;
++ vm_size_t size;
++} ramdisk[RAMDISK_MAX];
++
++static int ramdisk_num = 0;
++
++/* Initial ramdisks are created from the boot scripts */
++int ramdisk_create(vm_size_t size, const void *initdata, int *out_no)
++{
++ struct ramdisk *rd = &ramdisk[ramdisk_num];
++ int err;
++
++ if(ramdisk_num >= RAMDISK_MAX)
++ return -1;
++
++ /* allocate the memory */
++ rd->size = round_page(size);
++ err = kmem_alloc(kernel_map, (vm_offset_t *) &rd->data, rd->size);
++ if(err != KERN_SUCCESS)
++ return err;
++
++ /* initialize */
++ if(initdata)
++ memcpy(rd->data, initdata, rd->size);
++ else
++ memset(rd->data, 0, rd->size);
++
++ /* report */
++ if(out_no) *out_no = ramdisk_num;
++ printf("%s%d: %lu bytes @%p\n", RAMDISK_NAME, ramdisk_num,
++ (unsigned long) rd->size, rd->data);
++
++ ramdisk_num++;
++ return KERN_SUCCESS;
++}
++
++/* On d_open() we just check whether the ramdisk exists */
++int ramdisk_open(dev_t dev, int mode, io_req_t ior)
++{
++ return (dev < ramdisk_num) ? D_SUCCESS : D_NO_SUCH_DEVICE;
++}
++
++/* d_getstat() is used to query the device characteristics */
++int ramdisk_getstat(dev_t dev, dev_flavor_t flavor, dev_status_t status,
++ mach_msg_type_number_t *status_count)
++{
++ switch(flavor) {
++ case DEV_GET_SIZE:
++ status[DEV_GET_SIZE_DEVICE_SIZE] = ramdisk[dev].size;
++ status[DEV_GET_SIZE_RECORD_SIZE] = RAMDISK_BLOCKSZ;
++ *status_count = DEV_GET_SIZE_COUNT;
++ return D_SUCCESS;
++
++ case DEV_GET_RECORDS:
++ status[DEV_GET_RECORDS_DEVICE_RECORDS]
++ = ramdisk[dev].size / RAMDISK_BLOCKSZ;
++ status[DEV_GET_RECORDS_RECORD_SIZE] = RAMDISK_BLOCKSZ;
++ *status_count = DEV_GET_RECORDS_COUNT;
++ return D_SUCCESS;
++ }
++ return D_INVALID_OPERATION;
++}
++
++/* TODO: implement freeramdisk with setstat() ? */
++
++/* Check the given io request and compute a pointer to the ramdisk data and the
++ * amount to be handled. */
++static int ramdisk_ioreq(int dev, io_req_t ior, void **data, int *amt)
++{
++ vm_offset_t ofs = ior->io_recnum * RAMDISK_BLOCKSZ;
++ if(ofs >= ramdisk[dev].size)
++ return D_INVALID_RECNUM;
++
++ *data = (char*) ramdisk[dev].data + ofs;
++ *amt = ior->io_count;
++ if(ofs + *amt > ramdisk[dev].size)
++ *amt = ramdisk[dev].size - ofs;
++
++ return KERN_SUCCESS;
++}
++
++/* Copy data from a vm_map_copy by mapping it temporarily. */
++static int mem_map_cpy(void *dst, vm_map_copy_t src, int amt)
++{
++ vm_offset_t srcaddr;
++ int err;
++
++ err = vm_map_copyout(device_io_map, &srcaddr, src);
++ if (err != KERN_SUCCESS)
++ return err;
++
++ memcpy(dst, (void *) srcaddr, amt);
++ vm_deallocate(device_io_map, srcaddr, amt);
++ return KERN_SUCCESS;
++}
++
++int ramdisk_read(dev_t dev, io_req_t ior)
++{
++ void *data;
++ int amt, err;
++
++ err = ramdisk_ioreq(dev, ior, &data, &amt);
++ if(err != KERN_SUCCESS)
++ return err;
++
++ err = device_read_alloc (ior, ior->io_count);
++ if (err != KERN_SUCCESS)
++ return err;
++
++ memcpy(ior->io_data, data, amt);
++ ior->io_residual = ior->io_count - amt;
++
++ return D_SUCCESS;
++}
++
++int ramdisk_write(dev_t dev, io_req_t ior)
++{
++ void *data;
++ int amt, err;
++
++ err = ramdisk_ioreq(dev, ior, &data, &amt);
++ if(err != KERN_SUCCESS)
++ return err;
++
++ if (!(ior->io_op & IO_INBAND)) {
++ /* Out-of-band data is transmitted as a vm_map_copy */
++ err = mem_map_cpy(data, (vm_map_copy_t) ior->io_data, amt);
++ if(err != KERN_SUCCESS)
++ return err;
++ } else {
++ /* In-band data can be accessed directly */
++ memcpy(data, ior->io_data, amt);
++ }
++
++ ior->io_residual = ior->io_count - amt;
++ return D_SUCCESS;
++}
++
++vm_offset_t ramdisk_mmap(dev_t dev, vm_offset_t off, vm_prot_t prot)
++{
++ if(dev >= ramdisk_num)
++ return -1;
++ if(off >= ramdisk[dev].size)
++ return -1;
++
++ return pmap_phys_to_frame(kvtophys((vm_offset_t) ramdisk[dev].data + off));
++}
++
+Index: gnumach/device/ramdisk.h
+===================================================================
+--- /dev/null
++++ gnumach/device/ramdisk.h
+@@ -0,0 +1,47 @@
++#ifndef _KERN_RAMDISK_H_
++#define _KERN_RAMDISK_H_
++
++#include <vm/pmap.h>
++#include <device/io_req.h>
++#include <device/conf.h>
++
++/* Maximum number of ramdisk devices */
++#define RAMDISK_MAX 4
++
++/* The block size used (userspace requires 512) */
++#define RAMDISK_BLOCKSZ 512
++
++/* Name associated to the ramdisk major */
++#define RAMDISK_NAME "rd"
++#define RAMDISK_NAMESZ (sizeof RAMDISK_NAME + sizeof (int) * 3 + 1)
++
++/* Create a new ramdisk of the given size. On success, if out_no and/or out_ptr
++ * are not NULL, the device number and pointer to the ramdisk's data are stored
++ * there. Returns D_SUCCESS or D_NO_MEMORY. */
++int ramdisk_create(vm_size_t size, const void *initdata, int *out_no);
++
++/* Device operations */
++int ramdisk_open(dev_t, int, io_req_t);
++int ramdisk_getstat(dev_t, dev_flavor_t, dev_status_t, mach_msg_type_number_t *);
++int ramdisk_read(dev_t, io_req_t);
++int ramdisk_write(dev_t, io_req_t);
++vm_offset_t ramdisk_mmap(dev_t, vm_offset_t, vm_prot_t);
++
++/* dev_ops initializer to be used from <machine>/conf.c */
++#define RAMDISK_DEV_OPS { \
++ .d_name = RAMDISK_NAME, \
++ .d_open = ramdisk_open, \
++ .d_close = nulldev_close, \
++ .d_read = ramdisk_read, \
++ .d_write = ramdisk_write, \
++ .d_getstat = ramdisk_getstat, \
++ .d_setstat = nulldev_setstat, \
++ .d_mmap = ramdisk_mmap, \
++ .d_async_in = nodev_async_in, \
++ .d_reset = nulldev_reset, \
++ .d_port_death = nulldev_portdeath, \
++ .d_subdev = 0, \
++ .d_dev_info = nodev_info, \
++ }
++
++#endif
+Index: gnumach/kern/bootstrap.h
+===================================================================
+--- gnumach.orig/kern/bootstrap.h
++++ gnumach/kern/bootstrap.h
+@@ -22,5 +22,6 @@
+ #include <kern/boot_script.h>
+
+ void bootstrap_create(void);
++int boot_script_ramdisk_create(struct cmd *cmd, char **name);
+
+ #endif /* _KERN_BOOTSTRAP_H_ */
diff --git a/patches/gnumach/79_dde-debian.patch b/patches/gnumach/79_dde-debian.patch
new file mode 100644
index 0000000..b6a0f17
--- /dev/null
+++ b/patches/gnumach/79_dde-debian.patch
@@ -0,0 +1,274 @@
+This contains a compatibility layer for netdde and rump still using the experimental irq/alloc_contig support. It is the output of
+
+git diff master master-user_level_drivers-debian
+
+(master was 6054cda4de2341b9a77ec4421411725f3684006b and
+master-user_level_drivers-debian was 19283fdffa782b2e485ef39e0de1574006ec4a1a at
+the time)
+
+When dropping this, break netdde (<< 0.0.20200330-5),
+hurd-libs0.3 (<< hurd_1:0.9.git20200718-1+b1)
+
+---
+ Makefrag.am | 1
+ device/ds_routines.c | 64 +++++++++++++++++++++++++++++++++++++++-
+ device/intr.c | 16 ++++++----
+ device/intr.h | 3 +
+ include/mach/experimental.defs | 38 +++++++++++++++++++++++
+ linux/dev/drivers/block/genhd.c | 4 +-
+ vm/vm_user.c | 14 ++++++++
+ 7 files changed, 130 insertions(+), 10 deletions(-)
+
+--- a/Makefrag.am
++++ b/Makefrag.am
+@@ -362,7 +362,6 @@ include_device_HEADERS = \
+ include/device/disk_status.h \
+ include/device/input.h \
+ include/device/net_status.h \
+- include/device/notify.defs \
+ include/device/notify.h \
+ include/device/tape_status.h \
+ include/device/tty_status.h
+--- a/device/ds_routines.c
++++ b/device/ds_routines.c
+@@ -354,7 +354,7 @@ ds_device_intr_register (device_t dev, i
+ if (! name_equal(mdev->dev_ops->d_name, 3, "irq"))
+ return D_INVALID_OPERATION;
+
+- user_intr_t *e = insert_intr_entry (&irqtab, id, receive_port);
++ user_intr_t *e = insert_intr_entry (&irqtab, id, receive_port, 0);
+ if (!e)
+ return D_NO_MEMORY;
+
+@@ -371,6 +371,52 @@ ds_device_intr_register (device_t dev, i
+ #endif /* MACH_XEN */
+ }
+
++static ipc_port_t intr_receive_ports[16];
++io_return_t
++experimental_device_intr_register (ipc_port_t master_port, int line,
++ int id, int flags, ipc_port_t receive_port)
++{
++#ifdef MACH_XEN
++ return D_INVALID_OPERATION;
++#else /* MACH_XEN */
++ io_return_t ret;
++ /* Open must be called on the master device port. */
++ if (master_port != master_device_port)
++ return D_INVALID_OPERATION;
++
++ /* XXX: move to arch-specific */
++ if (line < 0 || line >= 16)
++ return D_INVALID_OPERATION;
++
++ if (flags != 0x04000000)
++ return D_INVALID_OPERATION;
++
++ user_intr_t *user_intr = insert_intr_entry (&irqtab, line, receive_port, 1);
++ if (!user_intr)
++ return D_NO_MEMORY;
++
++ // TODO The original port should be replaced
++ // when the same device driver calls it again,
++ // in order to handle the case that the device driver crashes and restarts.
++ ret = install_user_intr_handler (&irqtab, line, 0, user_intr);
++
++ if (ret == 0)
++ {
++ /* If the port is installed successfully, increase its reference by 1.
++ * Thus, the port won't be destroyed after its task is terminated. */
++ ip_reference (receive_port);
++
++ intr_receive_ports[line] = receive_port;
++ /* For now netdde calls device_intr_enable once after registration. Assume
++ * it does so for now. When we move to IRQ acknowledgment convention we will
++ * change this. */
++ __disable_irq (line);
++ }
++
++ return ret;
++#endif /* MACH_XEN */
++}
++
+ kern_return_t
+ ds_device_intr_ack (device_t dev, ipc_port_t receive_port)
+ {
+@@ -399,6 +445,22 @@ ds_device_intr_ack (device_t dev, ipc_po
+ #endif /* MACH_XEN */
+ }
+
++kern_return_t
++experimental_device_intr_enable(ipc_port_t master_port, int line, char status)
++{
++#ifdef MACH_XEN
++ return D_INVALID_OPERATION;
++#else /* MACH_XEN */
++ if (master_port != master_device_port)
++ return D_INVALID_OPERATION;
++
++ if (status != 1)
++ return D_INVALID_OPERATION;
++
++ return irq_acknowledge(intr_receive_ports[line]);
++#endif /* MACH_XEN */
++}
++
+ boolean_t
+ ds_notify (mach_msg_header_t *msg)
+ {
+--- a/device/intr.c
++++ b/device/intr.c
+@@ -25,7 +25,7 @@
+ #ifndef MACH_XEN
+
+ queue_head_t main_intr_queue;
+-static boolean_t deliver_intr (int id, ipc_port_t dst_port);
++static boolean_t deliver_intr (int id, mach_msg_id_t msgh_id, ipc_port_t dst_port);
+
+ #ifndef LINUX_DEV
+ #define SA_SHIRQ 0x04000000
+@@ -122,7 +122,7 @@ deliver_user_intr (struct irqdev *dev, i
+ * This entry exists in the queue until
+ * the corresponding interrupt port is removed.*/
+ user_intr_t *
+-insert_intr_entry (struct irqdev *dev, int id, ipc_port_t dst_port)
++insert_intr_entry (struct irqdev *dev, int id, ipc_port_t dst_port, int compat)
+ {
+ user_intr_t *e, *new, *ret;
+ int free = 0;
+@@ -146,7 +146,11 @@ insert_intr_entry (struct irqdev *dev, i
+ new->id = id;
+ new->dst_port = dst_port;
+ new->interrupts = 0;
+- new->n_unacked = 0;
++ new->compat = compat;
++ if (compat)
++ new->n_unacked = 1;
++ else
++ new->n_unacked = 0;
+
+ queue_enter (dev->intr_queue, new, user_intr_t *, chain);
+ out:
+@@ -268,7 +272,7 @@ intr_thread (void)
+ irqtab.tot_num_intr--;
+
+ splx (s);
+- deliver_intr (id, dst_port);
++ deliver_intr (id, e->compat ? 424242 : DEVICE_INTR_NOTIFY, dst_port);
+ s = splhigh ();
+ }
+ }
+@@ -307,7 +311,7 @@ intr_thread (void)
+ }
+
+ static boolean_t
+-deliver_intr (int id, ipc_port_t dst_port)
++deliver_intr (int id, mach_msg_id_t msgh_id, ipc_port_t dst_port)
+ {
+ ipc_kmsg_t kmsg;
+ device_intr_notification_t *n;
+@@ -331,7 +335,7 @@ deliver_intr (int id, ipc_port_t dst_por
+ m->msgh_seqno = DEVICE_NOTIFY_MSGH_SEQNO;
+ m->msgh_local_port = MACH_PORT_NULL;
+ m->msgh_remote_port = MACH_PORT_NULL;
+- m->msgh_id = DEVICE_INTR_NOTIFY;
++ m->msgh_id = msgh_id;
+
+ t->msgt_name = MACH_MSG_TYPE_INTEGER_32;
+ t->msgt_size = 32;
+--- a/device/intr.h
++++ b/device/intr.h
+@@ -36,6 +36,7 @@ typedef struct {
+ int n_unacked; /* Number of times irqs were disabled for this */
+ ipc_port_t dst_port; /* Notification port */
+ int id; /* Mapping to machine dependent irq_t array elem */
++ int compat;
+ } user_intr_t;
+
+ struct irqdev {
+@@ -52,7 +53,7 @@ struct irqdev {
+ extern queue_head_t main_intr_queue;
+ extern int install_user_intr_handler (struct irqdev *dev, int id, unsigned long flags, user_intr_t *e);
+ extern int deliver_user_intr (struct irqdev *dev, int id, user_intr_t *e);
+-extern user_intr_t *insert_intr_entry (struct irqdev *dev, int id, ipc_port_t receive_port);
++extern user_intr_t *insert_intr_entry (struct irqdev *dev, int id, ipc_port_t receive_port, int compat);
+
+ void intr_thread (void);
+ kern_return_t irq_acknowledge (ipc_port_t receive_port);
+--- a/include/mach/experimental.defs
++++ b/include/mach/experimental.defs
+@@ -13,3 +13,41 @@ subsystem
+ serverprefix experimental_;
+
+ /* This is free for experimenting RPCs, with no backward compatibility guarantees. */
++
++type notify_port_t = MACH_MSG_TYPE_MOVE_SEND_ONCE
++ ctype: mach_port_t;
++
++skip; /*simpleroutine mach_intr_notify(
++ notify : notify_port_t;
++ name : int);*/
++
++routine device_intr_register(
++ master_port : mach_port_t;
++ in line : int;
++ in id : int;
++ in flags : int;
++ in receive_port : mach_port_send_t
++ );
++
++/*
++ * enable/disable the specified line.
++ */
++/* XXX: Naming a function taht can disable something "xxx_enable" is confusing. */
++/* Is the disable part actually used at all? AIUI, the kernel IRQ handler
++should always disable the line; and the userspace driver only has to
++reenable it, after acknowledging and handling the interrupt...
++*/
++routine device_intr_enable(
++ master_port : mach_port_t;
++ line : int;
++ status : char);
++
++/*
++ * This routine is for compatibility with old userland drivers.
++ */
++routine vm_allocate_contiguous(
++ host_priv : host_priv_t;
++ target_task : vm_task_t;
++ out vaddr : vm_address_t;
++ out paddr : vm_address_t;
++ size : vm_size_t);
+--- a/linux/dev/drivers/block/genhd.c
++++ b/linux/dev/drivers/block/genhd.c
+@@ -1060,7 +1060,9 @@ void device_setup(void)
+ scsi_dev_init();
+ #endif
+ #ifdef CONFIG_INET
+- net_dev_init();
++ extern char *kernel_cmdline;
++ if (!strstr(kernel_cmdline, " nonetdev"))
++ net_dev_init();
+ #endif
+ #ifndef MACH
+ console_map_init();
+--- a/vm/vm_user.c
++++ b/vm/vm_user.c
+@@ -688,3 +688,17 @@ kern_return_t vm_allocate_contiguous(
+
+ return KERN_SUCCESS;
+ }
++
++kern_return_t experimental_vm_allocate_contiguous(host_priv, map, result_vaddr, result_paddr, size)
++ host_t host_priv;
++ vm_map_t map;
++ vm_address_t *result_vaddr;
++ vm_address_t *result_paddr;
++ vm_size_t size;
++{
++ rpc_phys_addr_t paddr;
++ kern_return_t ret;
++ ret = vm_allocate_contiguous(host_priv, map, result_vaddr, &paddr, size, 0, ~0ULL, 0);
++ *result_paddr = paddr;
++ return ret;
++}
diff --git a/patches/grep/gnulib-hurd-x86_64.patch b/patches/grep/gnulib-hurd-x86_64.patch
new file mode 100644
index 0000000..c5ffd1f
--- /dev/null
+++ b/patches/grep/gnulib-hurd-x86_64.patch
@@ -0,0 +1,50 @@
+From acb36717d8dd76b5cb755edc53aa5cea7f24db01 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <bruno@clisp.org>
+Date: Fri, 12 May 2023 21:28:47 +0200
+Subject: sigsegv: Add tentative support for Hurd/x86_64.
+
+Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.
+
+* lib/sigsegv.c: Update from libsigsegv/src/fault-hurd-i386.h.
+---
+ ChangeLog | 6 ++++++
+ lib/sigsegv.c | 20 +++++++++++++++++---
+ 2 files changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/lib/sigsegv.c b/lib/sigsegv.c
+index 5e943e4..aadba4e 100644
+--- a/lib/sigsegv.c
++++ b/lib/sigsegv.c
+@@ -365,12 +365,26 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
+ # define SIGSEGV_FAULT_ADDRESS (unsigned long) code
+ # define SIGSEGV_FAULT_CONTEXT scp
+
+-# if defined __i386__
++# if defined __x86_64__
++/* 64 bit registers */
++
++/* scp points to a 'struct sigcontext' (defined in
++ glibc/sysdeps/mach/hurd/x86_64/bits/sigcontext.h).
++ The registers, at the moment the signal occurred, get pushed on the stack
++ through gnumach/x86_64/locore.S:alltraps and then copied into the struct
++ through glibc/sysdeps/mach/hurd/x86/trampoline.c. */
++/* sc_rsp is unused (not set by gnumach/x86_64/locore.S:alltraps). We need
++ to use sc_ursp. */
++# define SIGSEGV_FAULT_STACKPOINTER scp->sc_ursp
++
++# elif defined __i386__
++/* 32 bit registers */
+
+ /* scp points to a 'struct sigcontext' (defined in
+ glibc/sysdeps/mach/hurd/i386/bits/sigcontext.h).
+- The registers of this struct get pushed on the stack through
+- gnumach/i386/i386/locore.S:trapall. */
++ The registers, at the moment the signal occurred, get pushed on the stack
++ through gnumach/i386/i386/locore.S:alltraps and then copied into the struct
++ through glibc/sysdeps/mach/hurd/x86/trampoline.c. */
+ /* Both sc_esp and sc_uesp appear to have the same value.
+ It appears more reliable to use sc_uesp because it is labelled as
+ "old esp, if trapped from user". */
+--
+cgit v1.1
+
diff --git a/patches/hurd/link-rump.patch b/patches/hurd/link-rump.patch
new file mode 100644
index 0000000..7375edf
--- /dev/null
+++ b/patches/hurd/link-rump.patch
@@ -0,0 +1,13 @@
+diff --git a/configure.ac b/configure.ac
+index dd2481b0..6e754a7a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -239,7 +239,7 @@ AS_IF([test "x$with_rump" != xno], [
+ # Save
+ oldLIBS="$LIBS"
+
+- LIBS="$oldLIBS -lrump"
++ LIBS="$oldLIBS -lrump -lrumpuser -lrumpvfs -lrumpvfs_fifofs -lrumpnet -lrumpnet_net -lrumpnet_local"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <hurd.h>
diff --git a/patches/libgpg-error/hurd-amd64.patch b/patches/libgpg-error/hurd-amd64.patch
new file mode 100644
index 0000000..23bf744
--- /dev/null
+++ b/patches/libgpg-error/hurd-amd64.patch
@@ -0,0 +1,54 @@
+Index: libgpg-error-1.46/src/Makefile.am
+===================================================================
+--- libgpg-error-1.46.orig/src/Makefile.am
++++ libgpg-error-1.46/src/Makefile.am
+@@ -67,6 +67,7 @@ lock_obj_pub = \
+ syscfg/lock-obj-pub.sparc-unknown-linux-gnu.h \
+ syscfg/lock-obj-pub.sparc64-unknown-linux-gnu.h \
+ syscfg/lock-obj-pub.x86_64-apple-darwin.h \
++ syscfg/lock-obj-pub.x86_64-unknown-gnu.h \
+ syscfg/lock-obj-pub.x86_64-unknown-kfreebsd-gnu.h \
+ syscfg/lock-obj-pub.x86_64-unknown-linux-gnu.h \
+ syscfg/lock-obj-pub.x86_64-unknown-linux-gnux32.h \
+Index: libgpg-error-1.46/src/mkheader.c
+===================================================================
+--- libgpg-error-1.46.orig/src/mkheader.c
++++ libgpg-error-1.46/src/mkheader.c
+@@ -108,6 +108,8 @@ canon_host_triplet (const char *triplet,
+ {"x86_64-pc-linux-gnuhardened1", "x86_64-unknown-linux-gnu" },
+ {"x86_64-pc-linux-gnu" },
+
++ {"x86_64-pc-gnu"},
++
+ {"powerpc-unknown-linux-gnuspe", "powerpc-unknown-linux-gnu" },
+
+ {"arm-unknown-linux-gnueabihf", "arm-unknown-linux-gnueabi" },
+Index: libgpg-error-1.46/src/syscfg/lock-obj-pub.x86_64-unknown-gnu.h
+===================================================================
+--- /dev/null
++++ libgpg-error-1.46/src/syscfg/lock-obj-pub.x86_64-unknown-gnu.h
+@@ -0,0 +1,24 @@
++## lock-obj-pub.x86_64-pc-gnu.h
++## File created by gen-posix-lock-obj - DO NOT EDIT
++## To be included by mkheader into gpg-error.h
++
++typedef struct
++{
++ long _vers;
++ union {
++ volatile char _priv[32];
++ long _x_align;
++ long *_xp_align;
++ } u;
++} gpgrt_lock_t;
++
++#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
++ 0,0,0,0,0,0,0,0, \
++ 0,0,0,0,0,0,0,0, \
++ 0,0,0,0,0,0,0,0}}}
++##
++## Local Variables:
++## mode: c
++## buffer-read-only: t
++## End:
++##
diff --git a/patches/shadow/shadow-utmp.patch b/patches/shadow/shadow-utmp.patch
new file mode 100644
index 0000000..db5e479
--- /dev/null
+++ b/patches/shadow/shadow-utmp.patch
@@ -0,0 +1,11 @@
+diff -Naur build-i686/native/shadow-4.14.2.copy/lib/user_busy.c src/shadow-4.14.2/lib/user_busy.c
+--- shadow-4.14.2.copy/lib/user_busy.c 2023-11-27 23:37:31.067406127 -0500
++++ shadow-4.14.2/lib/user_busy.c 2023-11-27 23:37:08.507284180 -0500
+@@ -17,6 +17,7 @@
+ #include <dirent.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include <utmp.h>
+ #include "defines.h"
+ #include "prototypes.h"
+ #ifdef ENABLE_SUBIDS