From 99c7f8700ddf5120fe930e0d330f85ad6e421581 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 17 Jun 2005 23:11:35 +0000 Subject: * sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_runtime_setup): Handle prelinked libraries and binaries with new style PLT. 2005-06-07 Jakub Jelinek * elf/elf.h (R_PPC_REL16, R_PPC_REL16_LO, R_PPC_REL16_HI, R_PPC_REL16_HA): Define. 2005-06-14 Alan Modra * config.h.in (HAVE_ASM_PPC_REL16): Add. * elf/elf.h (DT_PPC_GOT, DT_PPC_NUM): Define. * elf/tls-macros.h (PowerPC32): Include config.h. Add variants of TLS_IE, TLS_LD and TLS_GD for new PLT/GOT layout. * sysdeps/powerpc/powerpc32/configure.in: New file, * sysdeps/powerpc/powerpc32/dl-dtprocnum.h: New file. * sysdeps/powerpc/powerpc32/dl-machine.h (DT_PPC): Define. (ppc_got): New inline function. (elf_machine_dynamic): Use ppc_got. Add attribute const. (elf_machine_load_address): Add attribute const. Don't use int vars. Use bcl rather than bl to save trashing branch target stack. Use elf_machine_dynamic rather than duplicating code here. (elf_machine_runtime_setup): New inline function replacing define. Handle new PLT. (elf_machine_fixup_plt): Handle new PLT. (elf_machine_rela): Likewise. * sysdeps/powerpc/powerpc32/sysdep.h: Include config.h. (CALL_MCOUNT): Don't set up counter vars. * sysdeps/powerpc/powerpc32/ppc-mcount.S: Correct comment. * sysdeps/powerpc/powerpc32/elf/start.S (start_addressesp): Don't define when HAVE_ASM_PPC_REL16. (_start): Add HAVE_ASM_PPC_REL16 code. * sysdeps/powerpc/powerpc32/dl-start.S (_dl_start_user): Don't bl into the GOT when HAVE_ASM_PPC_REL16. * sysdeps/powerpc/powerpc32/memset.S (memset): Likewise. * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S (__longjmp): Ditto. * sysdeps/powerpc/powerpc32/fpu/s_ceil.S (__ceil): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_ceilf.S (__ceilf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floor.S (__floor): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_floorf.S (__floorf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_lround.S (__lround): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rint.S (__rint): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_rintf.S (__rintf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_round.S (__round): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_roundf.S (__roundf): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_trunc.S (__trunc): Likewise. * sysdeps/powerpc/powerpc32/fpu/s_truncf.S (__truncf): Likewise. * sysdeps/powerpc/powerpc32/fpu/setjmp-common.S (__sigsetjmp): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S (__brk): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S (__getcontext): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S (__setcontext): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S (__swapcontext): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S (stackblock): Comment. (__socket): Bomb if NARGS >= 7. Invoke CGOTSETUP and CGOTRESTORE. 2005-06-17 Ulrich Drepper * sysdeps/posix/sigignore.c: Include to tell the compiler to use __GI_memset. * sysdeps/posix/signal.c: Likewise. * sysdeps/posix/sigset.c: Likewise. * sysdeps/posix/sysv_signal.c: Likewise. * sysdeps/unix/sysv/linux/sleep.c: Likewise. * sysdeps/unix/sysv/linux/sysctl.c: Likewise. * sysdeps/unix/sysv/linux/system.c: Likewise. --- sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S | 8 ++++++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S | 7 +++++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S | 7 +++++++ sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S | 10 ++++------ sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S | 14 ++++++++++++++ sysdeps/unix/sysv/linux/sleep.c | 3 ++- sysdeps/unix/sysv/linux/sysctl.c | 3 ++- sysdeps/unix/sysv/linux/system.c | 3 ++- 8 files changed, 46 insertions(+), 9 deletions(-) (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S index a737322e2a..21ad98e501 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S @@ -34,11 +34,19 @@ ENTRY (BP_SYM (__brk)) lwz r6,8(r1) #ifdef PIC mflr r4 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r5 + addis r5,r5,__curbrk-1b@ha + mtlr r4 + stw r3,__curbrk-1b@l(r5) +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r5 lwz r5,__curbrk@got(r5) mtlr r4 stw r3,0(r5) +# endif #else lis r4,__curbrk@ha stw r3,__curbrk@l(r4) diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S index 4e6cf4b352..10211458d5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext.S @@ -129,8 +129,15 @@ ENTRY(__getcontext) #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S index b7a82a0182..eff60f9bbf 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext.S @@ -58,8 +58,15 @@ ENTRY(__setcontext) #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S index c52ad9babf..72170c95c0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S @@ -39,6 +39,8 @@ #define NARGS 3 #endif +/* 0(r1) and 4(r1) are reserved by the ABI, 8(r1), 12(r1), 16(r1) are used + for temp saves. 44(r1) is used to save r30. */ #define stackblock 20 #ifndef __socket @@ -69,12 +71,6 @@ ENTRY(__socket) stw r8,20+stackblock(r1) #endif #if NARGS >= 7 - stw r9,24+stackblock(r1) -#endif -#if NARGS >= 8 - stw r10,28+stackblock(r1) -#endif -#if NARGS >= 9 #error too many arguments! #endif @@ -94,6 +90,7 @@ ENTRY(__socket) mflr r9 stw r9,52(r1) cfi_offset (lr, 4) + CGOTSETUP CENABLE stw r3,16(r1) li r3,P(SOCKOP_,socket) @@ -107,6 +104,7 @@ ENTRY(__socket) lwz r4,52(r1) lwz r0,12(r1) lwz r3,8(r1) + CGOTRESTORE mtlr r4 mtcr r0 addi r1,r1,48 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S index 0c84d48d10..6e46abadb0 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext.S @@ -130,8 +130,15 @@ ENTRY(__swapcontext) stfd fp0,_UC_FREGS+(32*8)(r3) #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 @@ -272,8 +279,15 @@ L(no_vec): #ifdef PIC mflr r8 +# ifdef HAVE_ASM_PPC_REL16 + bcl 20,31,1f +1: mflr r7 + addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha + addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l +# else bl _GLOBAL_OFFSET_TABLE_@local-4 mflr r7 +# endif # ifdef SHARED lwz r7,_rtld_global_ro@got(r7) mtlr r8 diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c index d94e4f62fd..0e41a11338 100644 --- a/sysdeps/unix/sysv/linux/sleep.c +++ b/sysdeps/unix/sysv/linux/sleep.c @@ -1,5 +1,5 @@ /* Implementation of the POSIX sleep function using nanosleep. - Copyright (C) 1996, 1997, 1998, 1999, 2003 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -21,6 +21,7 @@ #include #include #include +#include /* For the real memset prototype. */ #include #include diff --git a/sysdeps/unix/sysv/linux/sysctl.c b/sysdeps/unix/sysv/linux/sysctl.c index 7e601acf2c..637fca5968 100644 --- a/sysdeps/unix/sysv/linux/sysctl.c +++ b/sysdeps/unix/sysv/linux/sysctl.c @@ -1,5 +1,5 @@ /* Read or write system information. Linux version. - Copyright (C) 1996-1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1996-2000,2002,2003,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ 02111-1307 USA. */ #include +#include /* For the real memset prototype. */ #include #include diff --git a/sysdeps/unix/sysv/linux/system.c b/sysdeps/unix/sysv/linux/system.c index 3fdff04c22..c5b389ea29 100644 --- a/sysdeps/unix/sysv/linux/system.c +++ b/sysdeps/unix/sysv/linux/system.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,6 +18,7 @@ #include #include +#include /* For the real memset prototype. */ #include #include #include -- cgit 1.4.1