aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2019-08-23 22:25:55 +0900
committerStafford Horne <shorne@gmail.com>2019-08-23 22:25:55 +0900
commit09f7b0de537d465fc8ed9f9433e348c1bc78aab2 (patch)
tree02ac5237b3809beaeaa499a4bfa1098e4d94b00a
parenta7ba389645d178c43100ec47e513389ae8bf8f93 (diff)
downloadgdb-09f7b0de537d465fc8ed9f9433e348c1bc78aab2.zip
gdb-09f7b0de537d465fc8ed9f9433e348c1bc78aab2.tar.gz
gdb-09f7b0de537d465fc8ed9f9433e348c1bc78aab2.tar.bz2
or1k: Fix incorrect value in PLT GOT entries, causing infinite loop
The PLT GOT entry should point to the first PLT entry which contains the runtime linker function. It was pointing back to the symbol PLT entry causing an infinite loop. I found this when testing the OpenRISC glibc port which uses the runtime dynamic linker. It seems other libc's we use so far have not been making use of the initial PLT GOT entries. bfd/ChangeLog: * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for PLT GOT entries.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-or1k.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 00afa81..981e0cd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-23 Stafford Horne <shorne@gmail.com>
+
+ * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for
+ PLT GOT entries.
+
2019-08-23 Nick Clifton <nickc@redhat.com>
PR 24456
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index c2069a3..0d1336c 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -2377,8 +2377,11 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
or1k_write_plt_entry (output_bfd, splt->contents + h->plt.offset,
plt0, plt1, plt2, OR1K_JR(12));
- /* Fill in the entry in the global offset table. */
- bfd_put_32 (output_bfd, plt_addr, sgot->contents + got_offset);
+ /* Fill in the entry in the global offset table. We initialize it to
+ point to the top of the plt. This is done to lazy lookup the actual
+ symbol as the first plt entry will be setup by libc to call the
+ runtime dynamic linker. */
+ bfd_put_32 (output_bfd, plt_base_addr, sgot->contents + got_offset);
/* Fill in the entry in the .rela.plt section. */
rela.r_offset = got_addr;