summaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2008-03-01 06:52:32 +0000
committerAlan Modra <amodra@bigpond.net.au>2008-03-01 06:52:32 +0000
commit1ad2d585091bec2b467e03825cf4797937f300fc (patch)
treef24753c57e6900a217109f1c0fc50c182a1e453b /bfd/elf32-ppc.c
parentb43fdf288c9e4194734e7bbb214e6ff218a50374 (diff)
downloadgdb-1ad2d585091bec2b467e03825cf4797937f300fc.tar.gz
* elf64-ppc.c (build_plt_stub): Add relocs on plt call stubs if emitrelocations. (get_relocs): New function, split out from.. (ppc_build_one_stub): ..here. Add relocs on plt_branch stubs if emitrelocations. Remove indx temp. (ppc_size_one_stub): Count new stub relocs. (ppc64_elf_size_stubs): Count new glink reloc. (ppc64_elf_build_stubs): Emit glink reloc if emitrelocations. (ppc64_elf_finish_dynamic_sections): Output glink relocs. * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Describe non-pic glink code. ld/testsuite/ * ld-powerpc/relbrlt.d: Update. Also check .branch_lt section.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r--bfd/elf32-ppc.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 5e81a2f20e1..47a2e79169f 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -7534,7 +7534,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
* bctr
*
* # A table of branches, one for each plt entry.
- * # The idea is that the plt call stub loads ctr (and r11) with these
+ * # The idea is that the plt call stub loads ctr and r11 with these
* # addresses, so (r11 - res_0) gives the plt index * 4.
* res_0: b PLTresolve
* res_1: b PLTresolve
@@ -7580,6 +7580,28 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
NOP
};
+ /*
+ * Non-PIC glink code is a little simpler.
+ *
+ * # ith PLT code stub.
+ * lis 11,(plt+(i-1)*4)@ha
+ * lwz 11,(plt+(i-1)*4)@l(11)
+ * mtctr 11
+ * bctr
+ *
+ * The branch table is the same, then comes
+ *
+ * PLTresolve:
+ * lis 12,(got+4)@ha
+ * addis 11,11,(-res_0)@ha
+ * lwz 0,(got+4)@l(12) # got[1] address of dl_runtime_resolve
+ * addi 11,11,(-res_0)@l # r11 = index * 4
+ * mtctr 0
+ * add 0,11,11
+ * lwz 12,(got+8)@l(12) # got[2] contains the map address
+ * add 11,0,11 # r11 = index * 12 = reloc offset.
+ * bctr
+ */
static const unsigned int plt_resolve[] =
{
LIS_12,