aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-03-01 06:52:52 +0000
committerAlan Modra <amodra@gmail.com>2008-03-01 06:52:52 +0000
commit176a0d42d0d0a1e4957bb5bf3f5186dc6669a6e7 (patch)
tree472e191c756f8766e3b69af362cb45592ab5c027 /bfd/elf32-ppc.c
parentc03374d554a6d5f326a0d356a2e0918961bc1cfb (diff)
downloadgdb-176a0d42d0d0a1e4957bb5bf3f5186dc6669a6e7.zip
gdb-176a0d42d0d0a1e4957bb5bf3f5186dc6669a6e7.tar.gz
gdb-176a0d42d0d0a1e4957bb5bf3f5186dc6669a6e7.tar.bz2
bfd/
* 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 5e81a2f..47a2e79 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,