summaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Weigand <Ulrich.Weigand@de.ibm.com>2013-12-04 06:55:03 -0600
committerAdhemerval Zanella <azanella@linux.vnet.ibm.com>2013-12-04 07:41:39 -0600
commit8b8a692cfd7d80f1ee7c8b9ab356a259367dd187 (patch)
tree7740d5d71feed939fb59df34e1f3535fb14e990f /nptl
parent122b66defdb9e4ded3ccc5c2b290f0520c6fa3cd (diff)
PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
This updates glibc for the changes in the ELFv2 relating to the stack frame layout. These are described in more detail here: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html Specifically, the "compiler and linker doublewords" were removed, which has the effect that the save slot for the TOC register is now at offset 24 rather than 40 to the stack pointer. In addition, a function may now no longer necessarily assume that its caller has set up a 64-byte register save area its use. To address the first change, the patch goes through all assembler files and replaces immediate offsets in instructions accessing the ABI-defined stack slots by symbolic offsets. Those already were defined in ucontext_i.sym and used in some of the context routines, but that doesn't really seem like the right place for those defines. The patch instead defines those symbolic offsets in sysdeps.h, in two variants for the old and new ABI, and uses them systematically in all assembler files, not just the context routines. The second change only affected a few assembler files that used the save area to temporarily store some registers. In those cases where this happens within a leaf function, this patch changes the code to store those registers to the "red zone" below the stack pointer. Otherwise, the functions already allocate a stack frame, and the patch changes them to add extra space in these frames as temporary space for the ELFv2 ABI.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog13
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h60
2 files changed, 47 insertions, 26 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 9f4063016f..64dc17f254 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,16 @@
+2013-12-04 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
+ (CANCEL_FRAMESIZE, CANCEL_PARM_SAVE): New macros to save parameters
+ into our own stack frame instead of the caller's.
+ (PSEUDO): Use them. Use symbolic stack frame offsets.
+ (DOCARGS_1, UNDOCARGS_1): Use CANCEL_PARM_SAVE.
+ (DOCARGS_2, UNDOCARGS_2): Likewise.
+ (DOCARGS_3, UNDOCARGS_3): Likewise.
+ (DOCARGS_4, UNDOCARGS_4): Likewise.
+ (DOCARGS_5, UNDOCARGS_5): Likewise.
+ (DOCARGS_6, UNDOCARGS_6): Likewise.
+
2013-11-26 Ondřej Bílka <neleai@seznam.cz>
* sysdeps/i386/tls.h: Use __glibc_reserved instead __unused.
* sysdeps/x86_64/tls.h: Likewise.
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
index 51e021df59..d711dc6cf1 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
@@ -31,6 +31,14 @@
# define DASHDASHPFX(str) __##str
# endif
+#if _CALL_ELF == 2
+#define CANCEL_FRAMESIZE (FRAME_MIN_SIZE+16+48)
+#define CANCEL_PARM_SAVE (FRAME_MIN_SIZE+16)
+#else
+#define CANCEL_FRAMESIZE (FRAME_MIN_SIZE+16)
+#define CANCEL_PARM_SAVE (CANCEL_FRAMESIZE+FRAME_PARM_SAVE)
+#endif
+
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.section ".text"; \
@@ -44,52 +52,52 @@
PSEUDO_RET; \
.size DASHDASHPFX(syscall_name##_nocancel),.-DASHDASHPFX(syscall_name##_nocancel); \
.Lpseudo_cancel: \
- stdu 1,-128(1); \
- cfi_adjust_cfa_offset (128); \
+ stdu 1,-CANCEL_FRAMESIZE(1); \
+ cfi_adjust_cfa_offset (CANCEL_FRAMESIZE); \
mflr 9; \
- std 9,128+16(1); \
- cfi_offset (lr, 16); \
+ std 9,CANCEL_FRAMESIZE+FRAME_LR_SAVE(1); \
+ cfi_offset (lr, FRAME_LR_SAVE); \
DOCARGS_##args; /* save syscall args around CENABLE. */ \
CENABLE; \
- std 3,112(1); /* store CENABLE return value (MASK). */ \
+ std 3,FRAME_MIN_SIZE(1); /* store CENABLE return value (MASK). */ \
UNDOCARGS_##args; /* restore syscall args. */ \
DO_CALL (SYS_ify (syscall_name)); \
mfcr 0; /* save CR/R3 around CDISABLE. */ \
- std 3,120(1); \
- std 0,128+8(1); \
- cfi_offset (cr, 8); \
- ld 3,112(1); /* pass MASK to CDISABLE. */ \
+ std 3,FRAME_MIN_SIZE+8(1); \
+ std 0,CANCEL_FRAMESIZE+FRAME_CR_SAVE(1); \
+ cfi_offset (cr, FRAME_CR_SAVE); \
+ ld 3,FRAME_MIN_SIZE(1); /* pass MASK to CDISABLE. */ \
CDISABLE; \
- ld 9,128+16(1); \
- ld 0,128+8(1); /* restore CR/R3. */ \
- ld 3,120(1); \
+ ld 9,CANCEL_FRAMESIZE+FRAME_LR_SAVE(1); \
+ ld 0,CANCEL_FRAMESIZE+FRAME_CR_SAVE(1); /* restore CR/R3. */ \
+ ld 3,FRAME_MIN_SIZE+8(1); \
mtlr 9; \
mtcr 0; \
- addi 1,1,128; \
- cfi_adjust_cfa_offset (-128); \
+ addi 1,1,CANCEL_FRAMESIZE; \
+ cfi_adjust_cfa_offset (-CANCEL_FRAMESIZE); \
cfi_restore (lr); \
cfi_restore (cr)
# define DOCARGS_0
# define UNDOCARGS_0
-# define DOCARGS_1 std 3,128+48(1); DOCARGS_0
-# define UNDOCARGS_1 ld 3,128+48(1); UNDOCARGS_0
+# define DOCARGS_1 std 3,CANCEL_PARM_SAVE(1); DOCARGS_0
+# define UNDOCARGS_1 ld 3,CANCEL_PARM_SAVE(1); UNDOCARGS_0
-# define DOCARGS_2 std 4,128+56(1); DOCARGS_1
-# define UNDOCARGS_2 ld 4,128+56(1); UNDOCARGS_1
+# define DOCARGS_2 std 4,CANCEL_PARM_SAVE+8(1); DOCARGS_1
+# define UNDOCARGS_2 ld 4,CANCEL_PARM_SAVE+8(1); UNDOCARGS_1
-# define DOCARGS_3 std 5,128+64(1); DOCARGS_2
-# define UNDOCARGS_3 ld 5,128+64(1); UNDOCARGS_2
+# define DOCARGS_3 std 5,CANCEL_PARM_SAVE+16(1); DOCARGS_2
+# define UNDOCARGS_3 ld 5,CANCEL_PARM_SAVE+16(1); UNDOCARGS_2
-# define DOCARGS_4 std 6,128+72(1); DOCARGS_3
-# define UNDOCARGS_4 ld 6,128+72(1); UNDOCARGS_3
+# define DOCARGS_4 std 6,CANCEL_PARM_SAVE+24(1); DOCARGS_3
+# define UNDOCARGS_4 ld 6,CANCEL_PARM_SAVE+24(1); UNDOCARGS_3
-# define DOCARGS_5 std 7,128+80(1); DOCARGS_4
-# define UNDOCARGS_5 ld 7,128+80(1); UNDOCARGS_4
+# define DOCARGS_5 std 7,CANCEL_PARM_SAVE+32(1); DOCARGS_4
+# define UNDOCARGS_5 ld 7,CANCEL_PARM_SAVE+32(1); UNDOCARGS_4
-# define DOCARGS_6 std 8,128+88(1); DOCARGS_5
-# define UNDOCARGS_6 ld 8,128+88(1); UNDOCARGS_5
+# define DOCARGS_6 std 8,CANCEL_PARM_SAVE+40(1); DOCARGS_5
+# define UNDOCARGS_6 ld 8,CANCEL_PARM_SAVE+40(1); UNDOCARGS_5
# ifdef IS_IN_libpthread
# ifdef SHARED