summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-12-27 03:54:33 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-12-27 03:54:33 +0000
commit897d0f9d7368cf5f1a527ba30a3477f3bf873283 (patch)
tree072b70ba92e12498df0fc82a5493d8fb778d5162 /bfd
parenta86bc60bf3c7d5f4d8fd3e87e794f06806622a2f (diff)
downloadbinutils-redhat-897d0f9d7368cf5f1a527ba30a3477f3bf873283.tar.gz
* elf32-ppc.c (add_stub_sym): Pass info rather than htab.
Use different names for pic vs non-pic, '.' instead of '_'. (allocate_dynrelocs): Adjust add_stub_sym call.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-ppc.c29
2 files changed, 24 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fc1390125a..5c58b8107b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2005-12-27 Alan Modra <amodra@bigpond.net.au>
+ * elf32-ppc.c (add_stub_sym): Pass info rather than htab.
+ Use different names for pic vs non-pic, '.' instead of '_'.
+ (allocate_dynrelocs): Adjust add_stub_sym call.
+
+2005-12-27 Alan Modra <amodra@bigpond.net.au>
+
* elf.c (bfd_section_from_shdr): Treat invalid reloc sections as
normal sections rather than returning false.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 5b8c955a67..e6de049abe 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -4213,34 +4213,41 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
-/* Generate a symbol to mark plt call stubs, of the form
- xxxxxxxx_plt_call_<callee> where xxxxxxxx is a hex number, usually 0,
- specifying the addend on the plt relocation, or for -fPIC,
- xxxxxxxx.got2_plt_call_<callee>. */
+/* Generate a symbol to mark plt call stubs. For non-PIC code the sym is
+ xxxxxxxx.plt_call32.<callee> where xxxxxxxx is a hex number, usually 0,
+ specifying the addend on the plt relocation. For -fpic code, the sym
+ is xxxxxxxx.plt_pic32.<callee>, and for -fPIC
+ xxxxxxxx.got2.plt_pic32.<callee>. */
static bfd_boolean
add_stub_sym (struct plt_entry *ent,
struct elf_link_hash_entry *h,
- struct ppc_elf_link_hash_table *htab)
+ struct bfd_link_info *info)
{
struct elf_link_hash_entry *sh;
size_t len1, len2, len3;
char *name;
+ const char *stub;
+ struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
+
+ if (info->shared || info->pie)
+ stub = ".plt_pic32.";
+ else
+ stub = ".plt_call32.";
len1 = strlen (h->root.root.string);
- len2 = sizeof ("plt_call_") - 1;
+ len2 = strlen (stub);
len3 = 0;
if (ent->sec)
len3 = strlen (ent->sec->name);
- name = bfd_malloc (len1 + len2 + len3 + 10);
+ name = bfd_malloc (len1 + len2 + len3 + 9);
if (name == NULL)
return FALSE;
sprintf (name, "%08x", (unsigned) ent->addend & 0xffffffff);
if (ent->sec)
memcpy (name + 8, ent->sec->name, len3);
- name[len3 + 8] = '_';
- memcpy (name + len3 + 9, "plt_call_", len2);
- memcpy (name + len3 + 9 + len2, h->root.root.string, len1 + 1);
+ memcpy (name + 8 + len3, stub, len2);
+ memcpy (name + 8 + len3 + len2, h->root.root.string, len1 + 1);
sh = elf_link_hash_lookup (&htab->elf, name, TRUE, FALSE, FALSE);
if (sh == NULL)
return FALSE;
@@ -4361,7 +4368,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
ent->glink_offset = glink_offset;
if (htab->emit_stub_syms
- && !add_stub_sym (ent, h, htab))
+ && !add_stub_sym (ent, h, info))
return FALSE;
}
else