all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 67824@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#67824] [PATCH core-updates v2 7/9] gnu: glibc: Add patch for ‘ucontext’ on x86_64-gnu (GNU/Hurd).
Date: Mon, 18 Dec 2023 17:30:18 +0100	[thread overview]
Message-ID: <2f3b64b9d967b4eea5cbdb32c859f4e3ac3b1a83.1702916397.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1702916397.git.ludo@gnu.org>

Suggested by Sergey Bugaev.

* gnu/packages/patches/glibc-2.38-hurd-ucontext.patch: New file.
* gnu/packages/base.scm (glibc)[source]: Use it.
* gnu/local.mk (dist_patch_DATA): Add it.

Change-Id: Ib74e93f2414eda2ec4b3e01fc2bb67b02838fabb
---
 gnu/local.mk                                  |  1 +
 gnu/packages/base.scm                         |  1 +
 .../patches/glibc-2.38-hurd-ucontext.patch    | 87 +++++++++++++++++++
 3 files changed, 89 insertions(+)
 create mode 100644 gnu/packages/patches/glibc-2.38-hurd-ucontext.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ff2f82a23a..e92cf871ad 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1320,6 +1320,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch	\
   %D%/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch	\
   %D%/packages/patches/glibc-2.37-versioned-locpath.patch	\
+  %D%/packages/patches/glibc-2.38-hurd-ucontext.patch		\
   %D%/packages/patches/glibc-2.38-ldd-x86_64.patch		\
   %D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch	\
   %D%/packages/patches/glibc-hurd-getauxval.patch		\
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index eab9ff411d..e2a952cc42 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -813,6 +813,7 @@ (define-public glibc
                                      "glibc-supported-locales.patch"
                                      "glibc-2.37-hurd-clock_t_centiseconds.patch"
                                      "glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch"
+                                     "glibc-2.38-hurd-ucontext.patch"
                                      "glibc-hurd-mach-print.patch"
                                      "glibc-hurd-gettyent.patch"
                                      "glibc-hurd-getauxval.patch"))))
diff --git a/gnu/packages/patches/glibc-2.38-hurd-ucontext.patch b/gnu/packages/patches/glibc-2.38-hurd-ucontext.patch
new file mode 100644
index 0000000000..03a6132666
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.38-hurd-ucontext.patch
@@ -0,0 +1,87 @@
+commit 29d4591b07a4da53320e949557c6946c62c26bde
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Thu Sep 28 00:07:18 2023 +0200
+
+    hurd: Drop REG_GSFS and REG_ESDS from x86_64's ucontext
+    
+    These are useless on x86_64, and __NGREG was actually wrong with them.
+
+diff --git a/sysdeps/mach/hurd/x86/trampoline.c b/sysdeps/mach/hurd/x86/trampoline.c
+index 6318c9528a..bc3f15e1e0 100644
+--- a/sysdeps/mach/hurd/x86/trampoline.c
++++ b/sysdeps/mach/hurd/x86/trampoline.c
+@@ -79,8 +79,8 @@ static void fill_ucontext (ucontext_t *uc, const struct sigcontext *sc)
+ 
+   /* Registers.  */
+ #ifdef __x86_64__
+-  memcpy (&uc->uc_mcontext.gregs[REG_GSFS], &sc->sc_gs,
+-          (REG_ERR - REG_GSFS) * sizeof (long));
++  memcpy (&uc->uc_mcontext.gregs[REG_R8], &sc->sc_r8,
++          (REG_ERR - REG_R8) * sizeof (long));
+ #else
+   memcpy (&uc->uc_mcontext.gregs[REG_GS], &sc->sc_gs,
+           (REG_TRAPNO - REG_GS) * sizeof (int));
+diff --git a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h
+index 6396054463..7facc587b8 100644
+--- a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h
++++ b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h
+@@ -59,13 +59,7 @@ struct sigcontext
+        }
+        trampoline.c knows this, so it must be changed if this changes.  */
+ 
+-#define sc_i386_thread_state sc_gs /* Beginning of correspondence.  */
+-    /* Segment registers.  */
+-    int sc_gs;
+-    int sc_fs;
+-    int sc_es;
+-    int sc_ds;
+-
++#define sc_i386_thread_state sc_r8 /* Beginning of correspondence.  */
+     long sc_r8;
+     long sc_r9;
+     long sc_r10;
+diff --git a/sysdeps/mach/x86/thread_state.h b/sysdeps/mach/x86/thread_state.h
+index 8c419515f9..e237e46cb2 100644
+--- a/sysdeps/mach/x86/thread_state.h
++++ b/sysdeps/mach/x86/thread_state.h
+@@ -34,12 +34,13 @@
+ #define PC rip
+ #define SP ursp
+ #define SYSRETURN rax
++#define MACHINE_THREAD_STATE_FIX_NEW(ts) do { \
++	asm ("mov %%cs, %w0" : "=q" ((ts)->cs)); \
++} while(0)
+ #else
+ #define PC eip
+ #define SP uesp
+ #define SYSRETURN eax
+-#endif
+-
+ #define MACHINE_THREAD_STATE_FIX_NEW(ts) do { \
+ 	asm ("mov %%cs, %w0" : "=q" ((ts)->cs)); \
+ 	asm ("mov %%ds, %w0" : "=q" ((ts)->ds)); \
+@@ -47,6 +48,7 @@
+ 	asm ("mov %%fs, %w0" : "=q" ((ts)->fs)); \
+ 	asm ("mov %%gs, %w0" : "=q" ((ts)->gs)); \
+ } while(0)
++#endif
+ 
+ struct machine_thread_all_state
+   {
+diff --git a/sysdeps/x86_64/sys/ucontext.h b/sysdeps/x86_64/sys/ucontext.h
+index d73a893795..f1b6be77a7 100644
+--- a/sysdeps/x86_64/sys/ucontext.h
++++ b/sysdeps/x86_64/sys/ucontext.h
+@@ -47,11 +47,7 @@ typedef greg_t gregset_t[__NGREG];
+ /* Number of each register in the `gregset_t' array.  */
+ enum
+ {
+-  REG_GSFS = 0,		/* Actually int gs, fs.  */
+-# define REG_GSFS	REG_GSFS
+-  REG_ESDS,		/* Actually int es, ds.  */
+-# define REG_ESDS	REG_ESDS
+-  REG_R8,
++  REG_R8 = 0,
+ # define REG_R8		REG_R8
+   REG_R9,
+ # define REG_R9		REG_R9
-- 
2.41.0





  parent reply	other threads:[~2023-12-18 16:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-14 10:51 [bug#67824] [PATCH core-updates 0/6] Run builds in C.UTF-8 locale Ludovic Courtès
2023-12-14 13:37 ` [bug#67824] [PATCH core-updates 1/6] packages: Remove reference to ‘glibc-utf8-locales’ in ‘patch-and-repack’ Ludovic Courtès
2023-12-14 13:37 ` [bug#67824] [PATCH core-updates 2/6] build-system/gnu: Change default locale to C.UTF-8 Ludovic Courtès
2023-12-14 13:37 ` [bug#67824] [PATCH core-updates 3/6] gnu: commencement: Remove ‘glibc-utf8-locales’ from ‘%final-inputs’ Ludovic Courtès
2023-12-14 13:37 ` [bug#67824] [PATCH core-updates 4/6] profiles: Use C.UTF-8 instead of ‘glibc-utf8-locales’ where possible Ludovic Courtès
2023-12-14 13:37 ` [bug#67824] [PATCH core-updates 5/6] packages: Output and error ports are line-buffered in ‘patch-and-repack’ Ludovic Courtès
2023-12-14 13:37 ` [bug#67824] [PATCH core-updates 6/6] gnu: glibc-utf8-locales: Add the C.UTF-8 locale Ludovic Courtès
2023-12-16  8:49 ` [bug#67824] [PATCH core-updates 0/6] Run builds in " Janneke Nieuwenhuizen
2023-12-16 11:27   ` Ludovic Courtès
2023-12-16 16:47   ` Ludovic Courtès
2023-12-18 16:30 ` [bug#67824] [PATCH core-updates v2 0/9] " Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 1/9] packages: Remove reference to ‘glibc-utf8-locales’ in ‘patch-and-repack’ Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 2/9] build-system/gnu: Change default locale to C.UTF-8 Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 3/9] gnu: commencement: Remove ‘glibc-utf8-locales’ from ‘%final-inputs’ Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 4/9] profiles: Use C.UTF-8 instead of ‘glibc-utf8-locales’ where possible Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 5/9] packages: Output and error ports are line-buffered in ‘patch-and-repack’ Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 6/9] gnu: glibc-utf8-locales: Add the C.UTF-8 locale Ludovic Courtès
2023-12-18 16:30   ` Ludovic Courtès [this message]
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 8/9] build-system/gnu: Turn PID 1 into an “init”-style process by default Ludovic Courtès
2023-12-18 16:30   ` [bug#67824] [PATCH core-updates v2 9/9] gnu: glib: Skip test that fails with glibc 2.38 Ludovic Courtès
2023-12-19 22:54   ` bug#67824: [PATCH core-updates v2 0/9] Run builds in C.UTF-8 locale Ludovic Courtès
2023-12-20  7:20     ` [bug#67824] " Janneke Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f3b64b9d967b4eea5cbdb32c859f4e3ac3b1a83.1702916397.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=67824@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.