aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config/pa
diff options
context:
space:
mode:
authorJohn David Anglin <danglin@gcc.gnu.org>2015-12-10 01:32:10 +0000
committerJohn David Anglin <danglin@gcc.gnu.org>2015-12-10 01:32:10 +0000
commit1b1b35788470f458bf807baa54c395e580103163 (patch)
tree13ff22e36b3cf484f65489c517a4733f6104977e /libgcc/config/pa
parent49af9ef212fec3344129e82185ea9316fc97a236 (diff)
* config/pa/fptr.c (__canonicalize_funcptr_for_compare): Remove code
to initialize call to __dl_fixup once. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@231486 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/config/pa')
-rw-r--r--libgcc/config/pa/fptr.c70
1 files changed, 28 insertions, 42 deletions
diff --git a/libgcc/config/pa/fptr.c b/libgcc/config/pa/fptr.c
index 1fb0a9f14b2..dd0e15a054c 100644
--- a/libgcc/config/pa/fptr.c
+++ b/libgcc/config/pa/fptr.c
@@ -64,10 +64,10 @@ unsigned int __canonicalize_funcptr_for_compare (fptr_t)
unsigned int
__canonicalize_funcptr_for_compare (fptr_t fptr)
{
- static unsigned int fixup_plabel[2];
- static fixup_t fixup;
- static unsigned int *init_fixup;
- unsigned int *plabel, *got;
+ static unsigned int fixup_plabel[2] __attribute__((used));
+ fixup_t fixup;
+ unsigned int *got, *iptr, *plabel;
+ int i;
/* -1 and page 0 are special. -1 is used in crtend to mark the end of
a list of function pointers. Also return immediately if the plabel
@@ -88,47 +88,33 @@ __canonicalize_funcptr_for_compare (fptr_t fptr)
if (got != &_GLOBAL_OFFSET_TABLE_)
return plabel[0];
- /* Initialize our plabel for calling fixup if we haven't done so already.
- We can't rely on static initialization so we check that any previous
- initialization was done for the current got address. This code needs
- to be thread safe but we don't have to be too careful as the result
- is invariant. */
- if (init_fixup != got)
+ /* Find the first "bl" branch in the offset search list. This is a
+ call to _dl_fixup or a magic branch to fixup at the beginning of the
+ trampoline template. The fixup function does the actual runtime
+ resolution of function descriptors. We only look for "bl" branches
+ with a 17-bit pc-relative displacement. */
+ for (i = 0; i < NOFFSETS; i++)
{
- int i;
- unsigned int *iptr;
-
- /* Find the first "bl" branch in the offset search list. This is a
- call to fixup or a magic branch to fixup at the beginning of the
- trampoline template. The fixup function does the actual runtime
- resolution of function descriptors. We only look for "bl" branches
- with a 17-bit pc-relative displacement. */
- for (i = 0; i < NOFFSETS; i++)
- {
- iptr = (unsigned int *) (got[-2] + fixup_branch_offset[i]);
- if ((*iptr & 0xfc00e000) == 0xe8000000)
- break;
- }
-
- /* This should not happen... */
- if (i == NOFFSETS)
- return ~0;
-
- /* Extract the 17-bit displacement from the instruction. */
- iptr += SIGN_EXTEND (GET_FIELD (*iptr, 19, 28) |
- GET_FIELD (*iptr, 29, 29) << 10 |
- GET_FIELD (*iptr, 11, 15) << 11 |
- GET_FIELD (*iptr, 31, 31) << 16, 17);
-
- /* Build a plabel for an indirect call to fixup. */
- fixup_plabel[0] = (unsigned int) iptr + 8; /* address of fixup */
- fixup_plabel[1] = got[-1]; /* ltp for fixup */
- fixup = (fixup_t) ((int) fixup_plabel | 3);
-
- /* Save address of the global offset table. */
- init_fixup = got;
+ iptr = (unsigned int *) (got[-2] + fixup_branch_offset[i]);
+ if ((*iptr & 0xfc00e000) == 0xe8000000)
+ break;
}
+ /* This should not happen... */
+ if (i == NOFFSETS)
+ return ~0;
+
+ /* Extract the 17-bit displacement from the instruction. */
+ iptr += SIGN_EXTEND (GET_FIELD (*iptr, 19, 28) |
+ GET_FIELD (*iptr, 29, 29) << 10 |
+ GET_FIELD (*iptr, 11, 15) << 11 |
+ GET_FIELD (*iptr, 31, 31) << 16, 17);
+
+ /* Build a plabel for an indirect call to _dl_fixup. */
+ fixup_plabel[0] = (unsigned int) iptr + 8; /* address of fixup */
+ fixup_plabel[1] = got[-1]; /* ltp for fixup */
+ fixup = (fixup_t) ((int) fixup_plabel | 3);
+
/* Call fixup to resolve the function address. got[1] contains the
link_map pointer and plabel[1] the relocation offset. */
fixup ((struct link_map *) got[1], plabel[1]);