about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-11-21 13:36:01 -0500
committerRich Felker <dalias@aerifal.cx>2012-11-21 13:36:01 -0500
commit57a0b82441e8d03a93965e2a373588721374ed78 (patch)
treeae44f418e9294e787fcbccaa3e3abf50aefe2468
parent7bdf11c2c611a5d8a5171c188461ff267fd555b6 (diff)
downloadmusl-57a0b82441e8d03a93965e2a373588721374ed78.tar.gz
musl-57a0b82441e8d03a93965e2a373588721374ed78.tar.xz
musl-57a0b82441e8d03a93965e2a373588721374ed78.zip
make powerpc signal.h namespace-clean for posix/isoc
also handle the non-GNUC case where alignment attribute is not available
by simply omitting it. this will not cause problems except for
inclusion of mcontex_t/ucontext_t in application-defined structures,
since the natural alignment of the uc_mcontext member relative to the
start of ucontext_t is already correct. and shame on whoever designed
this for making it impossible to satisfy the ABI requirements without
GNUC extensions.
-rw-r--r--arch/powerpc/bits/signal.h51
1 files changed, 32 insertions, 19 deletions
diff --git a/arch/powerpc/bits/signal.h b/arch/powerpc/bits/signal.h
index c304450b..a5c311ba 100644
--- a/arch/powerpc/bits/signal.h
+++ b/arch/powerpc/bits/signal.h
@@ -1,6 +1,21 @@
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
 
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+struct sigcontext
+{
+	unsigned long _unused[4];
+	int signal;
+	unsigned long handler;
+	unsigned long oldmask;
+	void *regs;
+	gregset_t gp_regs;
+	fpregset_t fp_regs;
+	vrregset_t *v_regs;
+	long vmx_reserve[33+33+32+1]; /* 33=34 for ppc64 */
+};
+
 typedef unsigned long gregset_t[48];
 
 typedef struct {
@@ -19,9 +34,25 @@ typedef struct {
 typedef struct {
 	gregset_t gregs;
 	fpregset_t fpregs;
-	vrregset_t vrregs __attribute__((__aligned__(16)));
+	vrregset_t vrregs
+#ifdef __GNUC__
+	__attribute__((__aligned__(16)))
+#endif
+	;
 } mcontext_t;
 
+#else
+
+typedef struct {
+	long __regs[48+68+4*32+4]
+#ifdef __GNUC__
+	__attribute__((__aligned__(16)))
+#endif
+	;
+} mcontext_t;
+
+#endif
+
 typedef struct __ucontext {
 	unsigned long uc_flags;
 	struct __ucontext *uc_link;
@@ -47,24 +78,6 @@ typedef struct __ucontext {
 #define SA_RESETHAND  0x80000000U
 #define SA_RESTORER   0x04000000U
 
-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-
-struct sigcontext
-{
-	unsigned long _unused[4];
-	int signal;
-	unsigned long handler;
-	unsigned long oldmask;
-	void *regs; /* originally struct pt_regs _user *regs,
-			pt_regs is defined in arch/powerpc/include/asm/ptrace.h */
-	gregset_t gp_regs;
-	fpregset_t fp_regs;
-	vrregset_t *v_regs;
-	long vmx_reserve[33+33+32+1]; /* 33=34 for ppc64 */
-};
-#define NSIG      64
-#endif
-
 #endif
 
 #define SIGHUP    1