]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
or1k: Fix incorrect value in PLT GOT entries, causing infinite loop
authorStafford Horne <shorne@gmail.com>
Fri, 23 Aug 2019 13:25:55 +0000 (22:25 +0900)
committerStafford Horne <shorne@gmail.com>
Fri, 23 Aug 2019 13:25:55 +0000 (22:25 +0900)
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.

bfd/ChangeLog
bfd/elf32-or1k.c

index 00afa81398d28ffe6253257b4a221d21e8ba177e..981e0cd4e9228d1c6254e66a249b8617022b7058 100644 (file)
@@ -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
index c2069a3180ea5fab4bad8c66dc74ed4559ed06aa..0d1336ceaccdc2a861c9bbb45b20c0931df0e0d2 100644 (file)
@@ -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;