This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] PowerPC: Simplify code for accessing powerpc GOT
- From: Will Schmidt <will_schmidt at vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Cc: willschm at us dot ibm dot com
- Date: Mon, 21 Nov 2011 15:19:18 -0600
- Subject: [PATCH] PowerPC: Simplify code for accessing powerpc GOT
- Reply-to: will_schmidt at vnet dot ibm dot com
Hi,
Add a helper macro called SETUP_GOT_ACCESS. This macro internalizes the
bcl and mflr instructions used to access the powerpc GOT, slightly
simplifies the code, and allows us to override with an alternative
sequence of instructions for sub-architectures if required. (There is
an associated patch for glibc-ports that does this for the ppc476
architecture).
2011-11-21 Will Schmidt <will_schmidt@vnet.ibm.com>
* powerpc/powerpc32/sysdep.h: Define SETUP_GOT_ACCESS() macro.
* powerpc/powerpc32/a2/memcpy.S: Use SETUP_GOT_ACCESS() macro.
* powerpc/powerpc32/dl-start.S: Likewise.
* powerpc/powerpc32/elf/start.S: Likewise.
* powerpc/powerpc32/fpu/__longjmp-common.S: Likewise.
* powerpc/powerpc32/fpu/s_ceil.S: Likewise.
* powerpc/powerpc32/fpu/s_ceilf.S: Likewise.
* powerpc/powerpc32/fpu/s_floor.S: Likewise.
* powerpc/powerpc32/fpu/s_floorf.S: Likewise.
* powerpc/powerpc32/fpu/s_lround.S: Likewise.
* powerpc/powerpc32/fpu/s_rint.S: Likewise.
* powerpc/powerpc32/fpu/s_rintf.S: Likewise.
* powerpc/powerpc32/fpu/s_round.S: Likewise.
* powerpc/powerpc32/fpu/s_roundf.S: Likewise.
* powerpc/powerpc32/fpu/s_trunc.S: Likewise.
* powerpc/powerpc32/fpu/s_truncf.S: Likewise.
* powerpc/powerpc32/fpu/setjmp-common.S: Likewise.
* powerpc/powerpc32/memset.S: Likewise.
* powerpc/powerpc32/power4/fpu/s_llround.S: Likewise.
* powerpc/powerpc32/power4/fpu/w_sqrt.S: Likewise.
* powerpc/powerpc32/power4/fpu/w_sqrtf.S: Likewise.
* powerpc/powerpc32/power5/fpu/w_sqrt.S: Likewise.
* powerpc/powerpc32/power5/fpu/w_sqrtf.S: Likewise.
* powerpc/powerpc32/power7/fpu/s_finite.S: Likewise.
* powerpc/powerpc32/power7/fpu/s_isinf.S: Likewise.
* powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
* unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S: Likewise.
* unix/sysv/linux/powerpc/powerpc32/brk.S: Likewise.
* unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Likewise.
* unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Likewise.
* unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Likewise.
diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index 88cfe71..6820930 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -1,5 +1,6 @@
/* Assembly macros for 32-bit PowerPC.
- Copyright (C) 1999, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2006, 2011
+ 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
@@ -46,6 +47,13 @@
cfi_startproc; \
CALL_MCOUNT
+/* helper macro for accessing the 32-bit powerpc GOT. */
+
+#define SETUP_GOT_ACCESS(regname) \
+ bcl 20,31,1f ; \
+1: ; \
+ mflr (regname)
+
#define EALIGN_W_0 /* No words to insert. */
#define EALIGN_W_1 nop
#define EALIGN_W_2 nop;nop
diff --git a/sysdeps/powerpc/powerpc32/a2/memcpy.S b/sysdeps/powerpc/powerpc32/a2/memcpy.S
index 472f7a3..2673767 100644
--- a/sysdeps/powerpc/powerpc32/a2/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/a2/memcpy.S
@@ -1,5 +1,5 @@
/* Optimized memcpy implementation for PowerPC A2.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Michael Brutman <brutman@us.ibm.com>.
This file is part of the GNU C Library.
@@ -113,9 +113,7 @@ L(dst_aligned):
mflr r0
/* Establishes GOT addressability so we can load __cache_line_size
from static. This value was set from the aux vector during startup. */
- bcl 20,31,1f
-1:
- mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,__cache_line_size-1b@ha
lwz r9,__cache_line_size-1b@l(r9)
mtlr r0
diff --git a/sysdeps/powerpc/powerpc32/dl-start.S b/sysdeps/powerpc/powerpc32/dl-start.S
index ae41f47..9f84a48 100644
--- a/sysdeps/powerpc/powerpc32/dl-start.S
+++ b/sysdeps/powerpc/powerpc32/dl-start.S
@@ -1,5 +1,6 @@
/* Machine-dependent ELF startup code. PowerPC version.
- Copyright (C) 1995-2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2000, 2002, 2004, 2005, 2006, 2011
+ 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
@@ -47,8 +48,7 @@ _dl_start_user:
passed by value!). */
/* Put our GOT pointer in r31, */
- bcl 20,31,1f
-1: mflr r31
+ SETUP_GOT_ACCESS(r31)
addis r31,r31,_GLOBAL_OFFSET_TABLE_-1b@ha
addi r31,r31,_GLOBAL_OFFSET_TABLE_-1b@l
/* the address of _start in r30, */
diff --git a/sysdeps/powerpc/powerpc32/elf/start.S b/sysdeps/powerpc/powerpc32/elf/start.S
index dc89a5e..2a74ee1 100644
--- a/sysdeps/powerpc/powerpc32/elf/start.S
+++ b/sysdeps/powerpc/powerpc32/elf/start.S
@@ -1,5 +1,5 @@
/* Startup code for programs linked with GNU libc.
- Copyright (C) 1998,1999,2000,2001,2002,2003,2009
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2009, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -59,10 +59,8 @@ ENTRY(_start)
/* Set up an initial stack frame, and clear the LR. */
clrrwi r1,r1,4
#ifdef PIC
- bcl 20,31,L(branch)
-L(branch):
+ SETUP_GOT_ACCESS(r13)
li r0,0
- mflr r13
#else
li r0,0
#endif
@@ -73,10 +71,10 @@ L(branch):
start_addresses in r8. Also load the GOT pointer so that new PLT
calls work, like the one to __libc_start_main. */
#ifdef PIC
- addis r30,r13,_GLOBAL_OFFSET_TABLE_-L(branch)@ha
- addis r8,r13,L(start_addresses)-L(branch)@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-L(branch)@l
- lwzu r13,L(start_addresses)-L(branch)@l(r8)
+ addis r30,r13,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addis r8,r13,L(start_addresses)-1b@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
+ lwzu r13,L(start_addresses)-1b@l(r8)
#else
lis r8,L(start_addresses)@ha
lwzu r13,L(start_addresses)@l(r8)
diff --git a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
index e1ac064..f7fca38 100644
--- a/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S
@@ -1,5 +1,6 @@
/* longjmp for PowerPC.
- Copyright (C) 1995-99, 2000, 2003-2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-99, 2000, 2003-2006, 2009, 2011
+ 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
@@ -34,8 +35,7 @@ ENTRY (BP_SYM (__longjmp))
# ifdef PIC
mflr r6
cfi_register (lr,r6)
- bcl 20,31,1f
-1: mflr r5
+ SETUP_GOT_ACCESS(r5)
addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
# ifdef SHARED
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
index 80e72ca..b6accf6 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceil.S
@@ -1,5 +1,5 @@
/* ceil function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,8 +31,7 @@ ENTRY (__ceil)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
index ce6d71e..8799714 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_ceilf.S
@@ -1,5 +1,5 @@
/* float ceil function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,8 +30,7 @@ ENTRY (__ceilf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floor.S b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
index 0dd0dbe..769cb2c 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floor.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floor.S
@@ -1,5 +1,5 @@
/* Floor function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,8 +31,7 @@ ENTRY (__floor)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
index 98a4745..5fe14f2 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_floorf.S
@@ -1,5 +1,5 @@
/* float Floor function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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,8 +30,7 @@ ENTRY (__floorf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_lround.S b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
index 3bf1ffa..56d0dc0 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_lround.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_lround.S
@@ -1,5 +1,5 @@
/* lround function. PowerPC32 version.
- Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2007, 2008, 2011 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
@@ -45,8 +45,7 @@ ENTRY (__lround)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp10,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rint.S b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
index 9313371..7161e89 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rint.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rint.S
@@ -1,5 +1,5 @@
/* Round to int floating-point values. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -33,8 +33,7 @@ ENTRY (__rint)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
index 1e0fbb1..4a2f6dd 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_rintf.S
@@ -1,5 +1,5 @@
/* Round float to int floating-point values. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -29,8 +29,7 @@ ENTRY (__rintf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_round.S b/sysdeps/powerpc/powerpc32/fpu/s_round.S
index 48b346e..37382dc 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_round.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_round.S
@@ -1,5 +1,5 @@
/* round function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -43,8 +43,7 @@ ENTRY (__round)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
addi r9,r9,.LC0-1b@l
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
index 88125aa..a4bccde 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
@@ -1,5 +1,5 @@
/* roundf function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -42,8 +42,7 @@ ENTRY (__roundf )
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
addi r9,r9,.LC0-1b@l
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
index c3c0217..b806d30 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
@@ -1,5 +1,5 @@
/* trunc function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -38,8 +38,7 @@ ENTRY (__trunc)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
index eddef07..2b32798 100644
--- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
@@ -1,5 +1,5 @@
/* truncf function. PowerPC32 version.
- Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2011 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
@@ -37,8 +37,7 @@ ENTRY (__truncf)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfs fp13,.LC0-1b@l(r9)
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
index 131e7a3..8a48feb 100644
--- a/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
+++ b/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
@@ -1,5 +1,5 @@
/* setjmp for PowerPC.
- Copyright (C) 1995-2000, 2003-2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-2000, 2003-2005, 2006, 2011 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
@@ -85,8 +85,7 @@ ENTRY (BP_SYM (__sigsetjmp))
# ifdef PIC
mflr r6
cfi_register(lr,r6)
- bcl 20,31,1f
-1: mflr r5
+ SETUP_GOT_ACCESS(r5)
addis r5,r5,_GLOBAL_OFFSET_TABLE_-1b@ha
addi r5,r5,_GLOBAL_OFFSET_TABLE_-1b@l
mtlr r6
diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S
index b4ce218..43dced4 100644
--- a/sysdeps/powerpc/powerpc32/memset.S
+++ b/sysdeps/powerpc/powerpc32/memset.S
@@ -1,5 +1,6 @@
/* Optimized memset implementation for PowerPC.
- Copyright (C) 1997, 1999, 2000, 2003, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999, 2000, 2003, 2007, 2011
+ 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
@@ -256,8 +257,7 @@ L(checklinesize):
beq L(medium)
/* Establishes GOT addressability so we can load __cache_line_size
from static. This value was set from the aux vector during startup. */
- bcl 20,31,1f
-1: mflr rGOT
+ SETUP_GOT_ACCESS(rGOT)
addis rGOT,rGOT,__cache_line_size-1b@ha
lwz rCLS,__cache_line_size-1b@l(rGOT)
mtlr rTMP
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
index b03e041..29c77a5 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
@@ -1,5 +1,5 @@
/* llround function. PowerPC32 on PowerPC64 version.
- Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2006, 2007, 2008, 2011 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
@@ -53,8 +53,7 @@ ENTRY (__llround)
#ifdef SHARED
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
addi r9,r9,.LC0-1b@l
mtlr r11
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
index c03dfa3..be6ec33 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrt.S
@@ -63,11 +63,9 @@ EALIGN (__sqrt, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
index 050323d..2e4d007 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S
@@ -63,11 +63,9 @@ EALIGN (__sqrtf, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
index 1c0f70d..918f8ff 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
+++ b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrt.S
@@ -63,11 +63,9 @@ EALIGN (__sqrt, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
index e638cc1..5210c11 100644
--- a/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
+++ b/sysdeps/powerpc/powerpc32/power5/fpu/w_sqrtf.S
@@ -63,11 +63,9 @@ EALIGN (__sqrtf, 5, 0)
cfi_offset(lr,20-16)
cfi_offset(r30,8-16)
#ifdef SHARED
- bcl 20,31,.LCF1
-.LCF1:
- mflr r30
- addis r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@ha
- addi r30,r30,_GLOBAL_OFFSET_TABLE_-.LCF1@l
+ SETUP_GOT_ACCESS(r30)
+ addis r30,r30,_GLOBAL_OFFSET_TABLE_-1b@ha
+ addi r30,r30,_GLOBAL_OFFSET_TABLE_-1b@l
lwz r9,_LIB_VERSION@got(30)
lwz r0,0(r9)
#else
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
index 5b0d950..0065bab 100644
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
+++ b/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
@@ -1,5 +1,5 @@
/* finite(). PowerPC32/POWER7 version.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
@@ -35,8 +35,7 @@ ENTRY (__finite)
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfd fp0,.LC0-1b@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
index 2979534..2fffcb8 100644
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
+++ b/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
@@ -1,5 +1,5 @@
/* isinf(). PowerPC32/POWER7 version.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
@@ -35,8 +35,7 @@ ENTRY (__isinf)
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfd fp0,.LC0-1b@l(r9)
diff --git a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
index 852539f..8dd5137 100644
--- a/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
+++ b/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
@@ -1,5 +1,5 @@
/* isnan(). PowerPC32/POWER7 version.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
Contributed by Luis Machado <luisgpm@br.ibm.com>.
This file is part of the GNU C Library.
@@ -35,8 +35,7 @@ ENTRY (__isnan)
mflr r11
cfi_register(lr,r11)
- bcl 20,31,1f
-1: mflr r9
+ SETUP_GOT_ACCESS(r9)
addis r9,r9,.LC0-1b@ha
lfd fp0,.LC0-1b@l(r9)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
index cfd9864..22f8c4a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/____longjmp_chk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2011 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
@@ -29,8 +29,7 @@
#ifdef PIC
# define LOAD_ARG \
- bcl 20,31,1f; \
-1: mflr r3; \
+ SETUP_GOT_ACCESS(r3); \
addis r3,r3,_GLOBAL_OFFSET_TABLE_-1b@ha; \
addi r3,r3,_GLOBAL_OFFSET_TABLE_-1b@l; \
lwz r3,.LC0@got(r3)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
index 4c8c6b4..51d20d7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/brk.S
@@ -1,5 +1,5 @@
/* brk system call for Linux/ppc.
- Copyright (C) 1995-97, 1999, 2000, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995-97, 1999, 2000, 2006, 2011 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
@@ -36,8 +36,7 @@ ENTRY (BP_SYM (__brk))
DO_CALL(SYS_ify(brk))
lwz r6,8(r1)
#ifdef PIC
- bcl 20,31,1f
-1: mflr r5
+ SETUP_GOT_ACCESS(r5)
addis r5,r5,__curbrk-1b@ha
stw r3,__curbrk-1b@l(r5)
#else
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
index 27285ed..1335ad9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
@@ -1,5 +1,5 @@
/* Save current context, powerpc32 common.
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2011 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
@@ -145,8 +145,7 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef __CONTEXT_ENABLE_VRS
# ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
+ SETUP_GOT_ACCESS(r7)
addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
# ifdef SHARED
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
index f304090..f9a7f81 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
@@ -1,5 +1,5 @@
/* Jump to a new context powerpc32 common.
- Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 2009, 2011 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
@@ -73,8 +73,7 @@ ENTRY(__CONTEXT_FUNC_NAME)
#ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
+ SETUP_GOT_ACCESS(r7)
addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
# ifdef SHARED
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
index 62efee2..9501ee6 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
@@ -1,5 +1,5 @@
/* Save current context and jump to a new context.
- Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2008, 2009, 2011 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
@@ -146,8 +146,7 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef PIC
mflr r8
- bcl 20,31,1f
-1: mflr r7
+ SETUP_GOT_ACCESS(r7)
addis r7,r7,_GLOBAL_OFFSET_TABLE_-1b@ha
addi r7,r7,_GLOBAL_OFFSET_TABLE_-1b@l
# ifdef SHARED
@@ -299,10 +298,9 @@ ENTRY(__CONTEXT_FUNC_NAME)
# ifdef PIC
mflr r8
# ifdef HAVE_ASM_PPC_REL16
- bcl 20,31,5f
-5: mflr r7
- addis r7,r7,_GLOBAL_OFFSET_TABLE_-5b@ha
- addi r7,r7,_GLOBAL_OFFSET_TABLE_-5b@l
+ SETUP_GOT_ACCESS(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