Re: [PATCH] hurd: libgcc unwinding support over signal trampolines

2020-06-17 Thread Thomas Schwinge
Hi!

On 2020-06-08T13:49:55+0200, Samuel Thibault  wrote:
> Samuel Thibault, le lun. 08 juin 2020 13:36:55 +0200, a ecrit:
>> Thomas Schwinge, le lun. 08 juin 2020 12:15:12 +0200, a ecrit:
>> > Which GCC branches would you like this on?
>>
>> Ideally it's be backported to gcc 9 and 10, so that it lands naturally
>> in the Debian packages without having to bother doko.
>
> Actually only gcc 10 would be needed.

Well, it was easy enough to just put it onto all active branches, so I've
now pushed "hurd: libgcc unwinding support over signal trampolines" to
master branch in commit 5e2eebc80d6eeca24745c27a925afdb64292ed22,
releases/gcc-10 branch in commit
a2b187c13919987ca0444ab7c701f9f93ee536c2, releases/gcc-9 branch in commit
cd32b2c51b913eed517e9503009fb3f0822d9cab, releases/gcc-8 branch in commit
9c5787ea072e16f26c9950139c00ae28fddadd72, see attached.


Grüße
 Thomas


-
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter
>From 5e2eebc80d6eeca24745c27a925afdb64292ed22 Mon Sep 17 00:00:00 2001
From: Samuel Thibault 
Date: Fri, 29 May 2020 13:46:50 +0200
Subject: [PATCH] hurd: libgcc unwinding support over signal trampolines

	libgcc/
	* config.host (md_unwind_header) : Set to
	'i386/gnu-unwind.h'
	* config/i386/gnu-unwind.h: New file.

Signed-off-by: Thomas Schwinge 
---
 libgcc/config.host  |   8 ++-
 libgcc/config/i386/gnu-unwind.h | 107 
 2 files changed, 114 insertions(+), 1 deletion(-)
 create mode 100644 libgcc/config/i386/gnu-unwind.h

diff --git a/libgcc/config.host b/libgcc/config.host
index 2cd420971675..044b34d53ccd 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -734,11 +734,17 @@ i[34567]86-*-linux*)
 	tm_file="${tm_file} i386/elf-lib.h"
 	md_unwind_header=i386/linux-unwind.h
 	;;
-i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
+i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-kopensolaris*-gnu)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
 	tm_file="${tm_file} i386/elf-lib.h"
 	;;
+i[34567]86-*-gnu*)
+	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
+	tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
+	tm_file="${tm_file} i386/elf-lib.h"
+	md_unwind_header=i386/gnu-unwind.h
+	;;
 x86_64-*-linux*)
 	extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
 	tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules"
diff --git a/libgcc/config/i386/gnu-unwind.h b/libgcc/config/i386/gnu-unwind.h
new file mode 100644
index ..db47f0ac1d4b
--- /dev/null
+++ b/libgcc/config/i386/gnu-unwind.h
@@ -0,0 +1,107 @@
+/* DWARF2 EH unwinding support for GNU Hurd: x86.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+   Contributed by Samuel Thibault 
+
+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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+.  */
+
+/* Do code reading to identify a signal frame, and set the frame
+   state data appropriately.  See unwind-dw2.c for the structs. */
+
+#ifndef inhibit_libc
+
+#include 
+
+#define MD_FALLBACK_FRAME_STATE_FOR x86_gnu_fallback_frame_state
+
+static _Unwind_Reason_Code
+x86_gnu_fallback_frame_state
+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
+{
+  struct handler_args {
+int signo;
+int sigcode;
+struct sigcontext *scp;
+  } *handler_args;
+  struct sigcontext *scp;
+  unsigned long usp;
+
+/*
+ * i386 sigtramp frame we are looking for follows.
+ * (see glibc/sysdeps/mach/hurd/i386/trampoline.c assembly)
+ *
+ * rpc_wait_trampoline:
+ *   0:	b8 e7 ff ff ff   	mov$-25,%eax   mach_msg_trap
+ *   5:	9a 00 00 00 00 07 00 	lcall  $7,$0
+ *  12:	89 01	movl   %eax, (%ecx)
+ *  14:	89 dc	movl   %ebx, %esp  switch to signal stack
+ *
+ * trampoline:
+ *  16:	ff d2	call   *%edx   call the handler function
+ * RA HERE
+ *  18:	83 c4 0c 	addl   $

Re: [hurd,commited 6/6] htl: Enable more cancellation tests

2020-06-17 Thread Andreas Schwab
../Rules:219: target '/suse/schwab/src/libc/test/nptl/tst-cancelx9' given more 
than once in the same rule

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



Re: [hurd,commited 6/6] htl: Enable more cancellation tests

2020-06-17 Thread Samuel Thibault
Andreas Schwab, le mer. 17 juin 2020 15:26:30 +0200, a ecrit:
> ../Rules:219: target '/suse/schwab/src/libc/test/nptl/tst-cancelx9' given 
> more than once in the same rule

It seems I missed the "remove" part of the move of that commit indeed,
now fixed.

Thanks,
Samuel