strace: Apply an upstream patch to fix sa_restorer problems

Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.

This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named
'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named
'sa_restorer'

* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.

Upstream commit:
  c3a5c01051/

Fixes:
  http://autobuild.buildroot.net/results/93e/93e54d8aecc5c178cc3465eb9fd5415461325285/

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Vicente Olivert Riera 2014-09-18 11:06:45 +01:00 committed by Peter Korsgaard
parent 2d0d3aae76
commit 6976dda8c7

View File

@ -0,0 +1,107 @@
Add a patch to fix the sa_restorer problems in strace.
This patch has been applied upstream:
https://sourceforge.net/p/strace/code/ci/c3a5c01051ba29a9f421f4d45d96bbc32df2b796/
Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
From c3a5c01051ba29a9f421f4d45d96bbc32df2b796 Mon Sep 17 00:00:00 2001
From: Vicente Olivert Riera <vincent@gentoo.org>
Date: Thu, 11 Sep 2014 20:05:18 +0100
Subject: [PATCH] sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently
Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.
This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'
* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.
Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
---
signal.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/signal.c b/signal.c
index 74e0fd9..5855d13 100644
--- a/signal.c
+++ b/signal.c
@@ -559,8 +559,10 @@ struct old_sigaction {
void (*__sa_handler)(int);
unsigned long sa_mask;
unsigned long sa_flags;
- void (*sa_restorer)(void);
#endif /* !MIPS */
+#ifdef SA_RESTORER
+ void (*sa_restorer)(void);
+#endif
};
struct old_sigaction32 {
@@ -568,7 +570,9 @@ struct old_sigaction32 {
uint32_t __sa_handler;
uint32_t sa_mask;
uint32_t sa_flags;
+#ifdef SA_RESTORER
uint32_t sa_restorer;
+#endif
};
static void
@@ -594,7 +598,9 @@ decode_old_sigaction(struct tcb *tcp, long addr)
memset(&sa, 0, sizeof(sa));
sa.__sa_handler = (void*)(uintptr_t)sa32.__sa_handler;
sa.sa_flags = sa32.sa_flags;
+#ifdef SA_RESTORER
sa.sa_restorer = (void*)(uintptr_t)sa32.sa_restorer;
+#endif
sa.sa_mask = sa32.sa_mask;
}
} else
@@ -1138,10 +1144,10 @@ struct new_sigaction
#else
void (*__sa_handler)(int);
unsigned long sa_flags;
-# if !defined(ALPHA) && !defined(HPPA) && !defined(IA64)
- void (*sa_restorer)(void);
-# endif /* !ALPHA && !HPPA && !IA64 */
#endif /* !MIPS */
+#ifdef SA_RESTORER
+ void (*sa_restorer)(void);
+#endif
/* Kernel treats sa_mask as an array of longs. */
unsigned long sa_mask[NSIG / sizeof(long) ? NSIG / sizeof(long) : 1];
};
@@ -1150,7 +1156,9 @@ struct new_sigaction32
{
uint32_t __sa_handler;
uint32_t sa_flags;
+#ifdef SA_RESTORER
uint32_t sa_restorer;
+#endif
uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
};
@@ -1176,7 +1184,9 @@ decode_new_sigaction(struct tcb *tcp, long addr)
memset(&sa, 0, sizeof(sa));
sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
sa.sa_flags = sa32.sa_flags;
+#ifdef SA_RESTORER
sa.sa_restorer = (void*)(unsigned long)sa32.sa_restorer;
+#endif
/* Kernel treats sa_mask as an array of longs.
* For 32-bit process, "long" is uint32_t, thus, for example,
* 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
--
1.7.1