diff options
author | Alan Modra <amodra@gmail.com> | 2010-08-12 09:19:19 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2010-08-12 09:19:19 -0700 |
commit | bebff237c522e4e8e23204ca1e5104896389158e (patch) | |
tree | a4edee831e0476277cc372a46fa8281ab0bc229a /sysdeps/powerpc/powerpc64/sysdep.h | |
parent | 026373745eab50a683536d950cb7e17dc98c4259 (diff) | |
download | glibc-bebff237c522e4e8e23204ca1e5104896389158e.tar.gz glibc-bebff237c522e4e8e23204ca1e5104896389158e.tar.xz glibc-bebff237c522e4e8e23204ca1e5104896389158e.zip |
PowerPC64 ABI fixes
Diffstat (limited to 'sysdeps/powerpc/powerpc64/sysdep.h')
-rw-r--r-- | sysdeps/powerpc/powerpc64/sysdep.h | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index 2745d7eb71..5fc6e4f2f3 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -27,14 +27,28 @@ .macro SAVE_ARG NARG .if \NARG SAVE_ARG \NARG-1 - std 2+\NARG,-72+8*(\NARG)(1) + std 2+\NARG,40+8*(\NARG)(1) .endif .endm .macro REST_ARG NARG .if \NARG REST_ARG \NARG-1 - ld 2+\NARG,40+8*(\NARG)(1) + ld 2+\NARG,112+40+8*(\NARG)(1) + .endif + .endm + + .macro CFI_SAVE_ARG NARG + .if \NARG + CFI_SAVE_ARG \NARG-1 + cfi_offset(2+\NARG,40+8*(\NARG)) + .endif + .endm + + .macro CFI_REST_ARG NARG + .if \NARG + CFI_REST_ARG \NARG-1 + cfi_restore(2+\NARG) .endif .endm @@ -46,11 +60,20 @@ SAVE_ARG \NARG std r0,16(r1) stdu r1,-112(r1) + cfi_adjust_cfa_offset(112) + cfi_offset(lr,16) + CFI_SAVE_ARG \NARG bl JUMPTARGET (_mcount) +#ifndef SHARED + nop +#endif ld r0,128(r1) REST_ARG \NARG - addi r1,r1,112 mtlr r0 + addi r1,r1,112 + cfi_adjust_cfa_offset(-112) + cfi_restore(lr) + CFI_REST_ARG \NARG #endif .endm @@ -198,9 +221,37 @@ LT_LABELSUFFIX(name,_name_end): ; \ ENTRY (name) \ DO_CALL (SYS_ify (syscall_name)); +#ifdef SHARED +#define TAIL_CALL_SYSCALL_ERROR \ + b JUMPTARGET(__syscall_error) +#else +/* Static version might be linked into a large app with a toc exceeding + 64k. We can't put a toc adjusting stub on a plain branch, so can't + tail call __syscall_error. */ +#define TAIL_CALL_SYSCALL_ERROR \ + .ifdef .Local_syscall_error; \ + b .Local_syscall_error; \ + .else; \ +.Local_syscall_error: \ + mflr 0; \ + std 0,16(1); \ + stdu 1,-112(1); \ + cfi_adjust_cfa_offset(112); \ + cfi_offset(lr,16); \ + bl JUMPTARGET(__syscall_error); \ + nop; \ + ld 0,112+16(1); \ + addi 1,1,112; \ + cfi_adjust_cfa_offset(-112); \ + mtlr 0; \ + cfi_restore(lr); \ + blr; \ + .endif +#endif + #define PSEUDO_RET \ bnslr+; \ - b JUMPTARGET(__syscall_error) + TAIL_CALL_SYSCALL_ERROR #define ret PSEUDO_RET |