tags 456879 + patch
thanks

You are in a maze of twisty struct sigcontext (or possibly struct
sigcontext_struct), all alike...

signal.c assumes that on i386, either we HAVE_ASM_SIGCONTEXT_H, or there
is no declaration of sigcontext_struct. This is no longer the case in
current glibc:

* <signal.h> declares struct sigcontext and has #define sigcontext_struct
  sigcontext
* <asm/sigcontext.h> conflicts with <signal.h> because they both declare
  sigcontext, so HAVE_ASM_SIGCONTEXT_H is not defined

So, signal.c needs to avoid declaring sigcontext_struct if we already
got a declaration from <signal.h>.

upstream-maybe.diff is an untested attempt at a fix suitable for upstream use,
which detects the presence of sigcontext_struct in signal.h properly.
m68k could probably benefit from a similar change, just after the last
line I altered.

debian.diff is a less clean fix (it relies on sigcontext_struct being a
#define), but it fixes the FTBFS on i386 without requiring an autoreconf,
so may be less intrusive to apply. Again, m68k could probably benefit
from a similar change, but I don't have an m68k handy to try it on.

    Simon
only in patch2:
unchanged:
--- strace-4.5.15.orig/signal.c
+++ strace-4.5.15/signal.c
@@ -102,7 +102,7 @@
 #include <asm/sigcontext.h>
 #endif /* !IA64 && !X86_64 */
 #else /* !HAVE_ASM_SIGCONTEXT_H */
-#ifdef I386
+#if defined(I386) && !defined(sigcontext_struct)
 struct sigcontext_struct {
 	unsigned short gs, __gsh;
 	unsigned short fs, __fsh;
@@ -127,7 +127,7 @@
 	unsigned long oldmask;
 	unsigned long cr2;
 };
-#else /* !I386 */
+#else /* !defined(I386) || !defined(sigcontext_struct) */
 #ifdef M68K
 struct sigcontext
 {
diff -u strace-4.5.15/configure.ac strace-4.5.15/configure.ac
--- strace-4.5.15/configure.ac
+++ strace-4.5.15/configure.ac
@@ -197,6 +197,7 @@
                  [], [], 
 [#include <stddef.h>
 #include <linux/socket.h>])
+AC_CHECK_TYPES([struct sigcontext_struct],,, [#include <signal.h>])
 AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
 AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
 
only in patch2:
unchanged:
--- strace-4.5.15.orig/signal.c
+++ strace-4.5.15/signal.c
@@ -102,7 +102,7 @@
 #include <asm/sigcontext.h>
 #endif /* !IA64 && !X86_64 */
 #else /* !HAVE_ASM_SIGCONTEXT_H */
-#ifdef I386
+#if defined(I386) && !defined(HAVE_STRUCT_SIGCONTEXT)
 struct sigcontext_struct {
 	unsigned short gs, __gsh;
 	unsigned short fs, __fsh;
@@ -127,7 +127,7 @@
 	unsigned long oldmask;
 	unsigned long cr2;
 };
-#else /* !I386 */
+#else /* !defined(I386) || !defined(HAVE_STRUCT_SIGCONTEXT) */
 #ifdef M68K
 struct sigcontext
 {

Attachment: signature.asc
Description: Digital signature

Reply via email to