From 37fb1dc05733e0f3d7eca64820dc5c2c25f2a6d9 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 16 May 2012 22:40:23 +0200 Subject: Avoid runtime GOT relocations in ld.so on powerpc --- sysdeps/powerpc/powerpc64/__longjmp-common.S | 8 +++++++- sysdeps/powerpc/powerpc64/dl-machine.h | 10 +++++----- sysdeps/powerpc/powerpc64/dl-trampoline.S | 6 +++--- sysdeps/powerpc/powerpc64/setjmp-common.S | 8 +++++++- 4 files changed, 22 insertions(+), 10 deletions(-) (limited to 'sysdeps/powerpc/powerpc64') diff --git a/sysdeps/powerpc/powerpc64/__longjmp-common.S b/sysdeps/powerpc/powerpc64/__longjmp-common.S index 2ff9078ec2..716b8ab7b0 100644 --- a/sysdeps/powerpc/powerpc64/__longjmp-common.S +++ b/sysdeps/powerpc/powerpc64/__longjmp-common.S @@ -1,5 +1,5 @@ /* longjmp for PowerPC64. - Copyright (C) 1995, 1996,1997,1999-2006,2009 Free Software Foundation, Inc. + Copyright (C) 1995-2012 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 @@ -31,7 +31,13 @@ .section ".toc","aw" .LC__dl_hwcap: # ifdef SHARED +# ifdef IS_IN_rtld + /* Inside ld.so we use the local alias to avoid runtime GOT + relocations. */ + .tc _rtld_local_ro[TC],_rtld_local_ro +# else .tc _rtld_global_ro[TC],_rtld_global_ro +# endif # else .tc _dl_hwcap[TC],_dl_hwcap # endif diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index 7c04757117..a964a29e38 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -1,6 +1,6 @@ /* Machine-dependent ELF dynamic relocation inline functions. PowerPC64 version. - Copyright 1995-2005, 2006, 2008, 2010, 2011 Free Software Foundation, Inc. + Copyright 1995-2012 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 @@ -161,8 +161,8 @@ BODY_PREFIX "_start:\n" \ " .popsection\n" \ " .pushsection \".toc\",\"aw\"\n" \ DL_STARTING_UP_DEF \ -".LC__rtld_global:\n" \ -" .tc _rtld_global[TC],_rtld_global\n" \ +".LC__rtld_local:\n" \ +" .tc _rtld_local[TC],_rtld_local\n" \ ".LC__dl_argc:\n" \ " .tc _dl_argc[TC],_dl_argc\n" \ ".LC__dl_argv:\n" \ @@ -181,7 +181,7 @@ BODY_PREFIX "_dl_start_user:\n" \ /* the address of _start in r30. */ \ " mr 30,3\n" \ /* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28. */ \ -" ld 28,.LC__rtld_global@toc(2)\n" \ +" ld 28,.LC__rtld_local@toc(2)\n" \ " ld 29,.LC__dl_argc@toc(2)\n" \ " ld 27,.LC__dl_argv@toc(2)\n" \ /* _dl_init (_dl_loaded, _dl_argc, _dl_argv, _dl_argv+_dl_argc+1). */ \ @@ -734,7 +734,7 @@ elf_machine_rela (struct link_map *map, _dl_error_printf ("%s: Symbol `%s' has different size" \ " in shared object," \ " consider re-linking\n", - _dl_argv[0] ?: "", + rtld_progname ?: "", strtab + refsym->st_name); } memcpy (reloc_addr_arg, (char *) value, diff --git a/sysdeps/powerpc/powerpc64/dl-trampoline.S b/sysdeps/powerpc/powerpc64/dl-trampoline.S index 266efe38fe..7bdabe0171 100644 --- a/sysdeps/powerpc/powerpc64/dl-trampoline.S +++ b/sysdeps/powerpc/powerpc64/dl-trampoline.S @@ -1,5 +1,5 @@ /* PLT trampolines. PPC64 version. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005-2012 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 @@ -169,7 +169,7 @@ END(_dl_runtime_resolve) .section ".toc","aw" .LC__dl_hwcap: # ifdef SHARED - .tc _rtld_global_ro[TC],_rtld_global_ro + .tc _rtld_local_ro[TC],_rtld_local_ro # else .tc _dl_hwcap[TC],_dl_hwcap # endif @@ -217,7 +217,7 @@ EALIGN(_dl_profile_resolve, 4, 0) std r0,FRAME_SIZE+8(r1) ld r12,.LC__dl_hwcap@toc(r2) #ifdef SHARED - /* Load _rtld-global._dl_hwcap. */ + /* Load _rtld_local_ro._dl_hwcap. */ ld r12,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET(r12) #else ld r12,0(r12) /* Load extern _dl_hwcap. */ diff --git a/sysdeps/powerpc/powerpc64/setjmp-common.S b/sysdeps/powerpc/powerpc64/setjmp-common.S index 1a1326e367..bf8bb76f98 100644 --- a/sysdeps/powerpc/powerpc64/setjmp-common.S +++ b/sysdeps/powerpc/powerpc64/setjmp-common.S @@ -1,5 +1,5 @@ /* setjmp for PowerPC64. - Copyright (C) 1995-2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 1995-2012 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 @@ -30,7 +30,13 @@ .section ".toc","aw" .LC__dl_hwcap: # ifdef SHARED +# ifdef IS_IN_rtld + /* Inside ld.so we use the local alias to avoid runtime GOT + relocations. */ + .tc _rtld_local_ro[TC],_rtld_local_ro +# else .tc _rtld_global_ro[TC],_rtld_global_ro +# endif # else .tc _dl_hwcap[TC],_dl_hwcap # endif -- cgit v1.2.3