]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Modify get_reloc_section for targets that map .got.plt to .got
authorAlan Modra <amodra@gmail.com>
Tue, 7 Apr 2015 12:53:21 +0000 (22:23 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 7 Apr 2015 13:52:11 +0000 (23:22 +0930)
Fixes tic6x testsuite failures due to .rela.plt having a zero sh_info.
I considered passing link_info to get_reloc_section so we could
directly return the .got.plt output section, but we need the fallback
to name lookup anyway for objcopy.

bfd/
* elf.c (_bfd_elf_get_reloc_section): Allow for .got.plt being
mapped to output .got section.
ld/testsuite/
* ld-arm/tls-gdesc-nlazy.g: Adjust for readelf note.
* ld-tic6x/shlib-1.rd: Expect corrected .rela.plt sh_info.
* ld-tic6x/shlib-1b.rd: Likewise.
* ld-tic6x/shlib-1r.rd: Likewise.
* ld-tic6x/shlib-1rb.rd: Likewise.
* ld-tic6x/shlib-app-1.rd: Likewise.
* ld-tic6x/shlib-app-1b.rd: Likewise.
* ld-tic6x/shlib-app-1r.rd: Likewise.
* ld-tic6x/shlib-app-1rb.rd: Likewise.
* ld-tic6x/shlib-noindex.rd: Likewise.

13 files changed:
bfd/ChangeLog
bfd/elf.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/tls-gdesc-nlazy.g
ld/testsuite/ld-tic6x/shlib-1.rd
ld/testsuite/ld-tic6x/shlib-1b.rd
ld/testsuite/ld-tic6x/shlib-1r.rd
ld/testsuite/ld-tic6x/shlib-1rb.rd
ld/testsuite/ld-tic6x/shlib-app-1.rd
ld/testsuite/ld-tic6x/shlib-app-1b.rd
ld/testsuite/ld-tic6x/shlib-app-1r.rd
ld/testsuite/ld-tic6x/shlib-app-1rb.rd
ld/testsuite/ld-tic6x/shlib-noindex.rd

index 47635858b9c8eafc6a9e45ae5c813ab80c95e03f..192d9aa04c418b685c22ccb8bf1ca5149840ac64 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-07  Alan Modra  <amodra@gmail.com>
+
+       * elf.c (_bfd_elf_get_reloc_section): Allow for .got.plt being
+       mapped to output .got section.
+
 2015-04-07  Alan Modra  <amodra@gmail.com>
 
        * elf32-ppc.c (struct ppc_elf_link_hash_entry): Add has_addr16_ha
index bb5f1c6852da23466afba9068c3a77c247990c6b..5fad4f171de72f59d121b2c95093df41e1f55d15 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3102,7 +3102,15 @@ _bfd_elf_get_reloc_section (asection *reloc_sec)
   abfd = reloc_sec->owner;
   if (get_elf_backend_data (abfd)->want_got_plt
       && strcmp (name, ".plt") == 0)
-    name = ".got.plt";
+    {
+      /* .got.plt is a linker created input section.  It may be mapped
+        to some other output section.  Try two likely sections.  */
+      name = ".got.plt";
+      reloc_sec = bfd_get_section_by_name (abfd, name);
+      if (reloc_sec != NULL)
+       return reloc_sec;
+      name = ".got";
+    }
 
   reloc_sec = bfd_get_section_by_name (abfd, name);
   return reloc_sec;
index 5036af1f03015645c404b42ffa9c420b52e6a8ac..49a74f732c8359fc612fe8907be38049297b5032 100644 (file)
@@ -1,3 +1,16 @@
+2015-04-07  Alan Modra  <amodra@gmail.com>
+
+       * ld-arm/tls-gdesc-nlazy.g: Adjust for readelf note.
+       * ld-tic6x/shlib-1.rd: Expect corrected .rela.plt sh_info.
+       * ld-tic6x/shlib-1b.rd: Likewise.
+       * ld-tic6x/shlib-1r.rd: Likewise.
+       * ld-tic6x/shlib-1rb.rd: Likewise.
+       * ld-tic6x/shlib-app-1.rd: Likewise.
+       * ld-tic6x/shlib-app-1b.rd: Likewise.
+       * ld-tic6x/shlib-app-1r.rd: Likewise.
+       * ld-tic6x/shlib-app-1rb.rd: Likewise.
+       * ld-tic6x/shlib-noindex.rd: Likewise.
+
 2015-04-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-elf/compress.exp: Remove is_zlib_supported check.
index 4b53a9819b5dffe8a83067cf90a1efea32e5318a..f36ed1dcb6e87a720cee706aa273822759692aa8 100644 (file)
@@ -1,4 +1,5 @@
 
 Hex dump of section '.got':
+#...
   0x[0-9a-f]+ [0-9a-f]+ 00000000 00000000 00000000 ................
   0x[0-9a-f]+ 00000000 00000000 00000000          ............
index 581832620611d203b81dc0129dc11d0f4b5d6960..3d253d2280648cc65a9029b23d3934650eed8355 100644 (file)
@@ -9,7 +9,7 @@ Section Headers:
   \[ 4\] \.rela\.got         RELA            00008140 001140 000024 0c  AI  2  10  4
   \[ 5\] \.rela\.neardata    RELA            00008164 001164 000018 0c  AI  2  11  4
   \[ 6\] \.dynamic          DYNAMIC         0000817c 00117c 0000a8 08  WA  3   0  4
-  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2   8  4
+  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2  10  4
   \[ 8\] \.plt              PROGBITS        10000020 002020 000060 18  AX  0   0 32
   \[ 9\] \.text             PROGBITS        10000080 002080 000080 00  AX  0   0 32
   \[10\] \.got              PROGBITS        10000100 002100 000028 00  WA  0   0  4
index 581832620611d203b81dc0129dc11d0f4b5d6960..3d253d2280648cc65a9029b23d3934650eed8355 100644 (file)
@@ -9,7 +9,7 @@ Section Headers:
   \[ 4\] \.rela\.got         RELA            00008140 001140 000024 0c  AI  2  10  4
   \[ 5\] \.rela\.neardata    RELA            00008164 001164 000018 0c  AI  2  11  4
   \[ 6\] \.dynamic          DYNAMIC         0000817c 00117c 0000a8 08  WA  3   0  4
-  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2   8  4
+  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2  10  4
   \[ 8\] \.plt              PROGBITS        10000020 002020 000060 18  AX  0   0 32
   \[ 9\] \.text             PROGBITS        10000080 002080 000080 00  AX  0   0 32
   \[10\] \.got              PROGBITS        10000100 002100 000028 00  WA  0   0  4
index 581832620611d203b81dc0129dc11d0f4b5d6960..3d253d2280648cc65a9029b23d3934650eed8355 100644 (file)
@@ -9,7 +9,7 @@ Section Headers:
   \[ 4\] \.rela\.got         RELA            00008140 001140 000024 0c  AI  2  10  4
   \[ 5\] \.rela\.neardata    RELA            00008164 001164 000018 0c  AI  2  11  4
   \[ 6\] \.dynamic          DYNAMIC         0000817c 00117c 0000a8 08  WA  3   0  4
-  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2   8  4
+  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2  10  4
   \[ 8\] \.plt              PROGBITS        10000020 002020 000060 18  AX  0   0 32
   \[ 9\] \.text             PROGBITS        10000080 002080 000080 00  AX  0   0 32
   \[10\] \.got              PROGBITS        10000100 002100 000028 00  WA  0   0  4
index 581832620611d203b81dc0129dc11d0f4b5d6960..3d253d2280648cc65a9029b23d3934650eed8355 100644 (file)
@@ -9,7 +9,7 @@ Section Headers:
   \[ 4\] \.rela\.got         RELA            00008140 001140 000024 0c  AI  2  10  4
   \[ 5\] \.rela\.neardata    RELA            00008164 001164 000018 0c  AI  2  11  4
   \[ 6\] \.dynamic          DYNAMIC         0000817c 00117c 0000a8 08  WA  3   0  4
-  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2   8  4
+  \[ 7\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2  10  4
   \[ 8\] \.plt              PROGBITS        10000020 002020 000060 18  AX  0   0 32
   \[ 9\] \.text             PROGBITS        10000080 002080 000080 00  AX  0   0 32
   \[10\] \.got              PROGBITS        10000100 002100 000028 00  WA  0   0  4
index db1c560097bf8be53590f9e56961c8c7d8aff8e5..9c62d6b2c7ca7377f95a55ded44aff5dd7ee49d2 100644 (file)
@@ -10,7 +10,7 @@ Section Headers:
   \[ 5\] \.rela\.neardata    RELA            00008154 001154 000018 0c  AI  2  12  4
   \[ 6\] \.rela\.bss         RELA            0000816c 00116c 00000c 0c  AI  2  13  4
   \[ 7\] \.dynamic          DYNAMIC         00008178 001178 0000b8 08  WA  3   0  4
-  \[ 8\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2   9  4
+  \[ 8\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2  11  4
   \[ 9\] \.plt              PROGBITS        10000020 002020 000040 18  AX  0   0 32
   \[10\] \.text             PROGBITS        10000060 002060 000040 00  AX  0   0 32
   \[11\] \.got              PROGBITS        100000a0 0020a0 000020 00  WA  0   0  4
index 086f21abb18ecc22e0cc4ee8899ea8edfd6ea698..8b5f5fa9f9c7c1c7a2e701dc2fad7496e86a2524 100644 (file)
@@ -10,7 +10,7 @@ Section Headers:
   \[ 5\] \.rela\.neardata    RELA            00008154 001154 000018 0c  AI  2  12  4
   \[ 6\] \.rela\.bss         RELA            0000816c 00116c 00000c 0c  AI  2  13  4
   \[ 7\] \.dynamic          DYNAMIC         00008178 001178 0000b8 08  WA  3   0  4
-  \[ 8\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2   9  4
+  \[ 8\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2  11  4
   \[ 9\] \.plt              PROGBITS        10000020 002020 000040 18  AX  0   0 32
   \[10\] \.text             PROGBITS        10000060 002060 000040 00  AX  0   0 32
   \[11\] \.got              PROGBITS        100000a0 0020a0 000020 00  WA  0   0  4
index f09738cbcbad5f3a6dbc9efeb7a294dcb6e23d4b..a4737f510af4e9e971cfba71f2e8f8d3bf04edfd 100644 (file)
@@ -9,7 +9,7 @@ Section Headers:
   \[ 4\] \.rela\.got         RELA            0000810c 00110c 000018 0c  AI  2  10  4
   \[ 5\] \.rela\.bss         RELA            00008124 001124 00000c 0c  AI  2  12  4
   \[ 6\] \.dynamic          DYNAMIC         00008130 001130 0000b8 08  WA  3   0  4
-  \[ 7\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2   8  4
+  \[ 7\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2  10  4
   \[ 8\] \.plt              PROGBITS        10000020 002020 000040 18  AX  0   0 32
   \[ 9\] \.text             PROGBITS        10000060 002060 000040 00  AX  0   0 32
   \[10\] \.got              PROGBITS        100000a0 0020a0 000020 00  WA  0   0  4
index a49fc05ce9a5ee15ddc91fb7473bfcfd9c30b107..7d70d9e01b9dff62a5bf5c7c959630b447cf5bdf 100644 (file)
@@ -9,7 +9,7 @@ Section Headers:
   \[ 4\] \.rela\.got         RELA            00008110 001110 000018 0c  AI  2  10  4
   \[ 5\] \.rela\.bss         RELA            00008128 001128 00000c 0c  AI  2  12  4
   \[ 6\] \.dynamic          DYNAMIC         00008134 001134 0000b8 08  WA  3   0  4
-  \[ 7\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2   8  4
+  \[ 7\] \.rela\.plt         RELA            10000000 002000 00000c 0c  AI  2  10  4
   \[ 8\] \.plt              PROGBITS        10000020 002020 000040 18  AX  0   0 32
   \[ 9\] \.text             PROGBITS        10000060 002060 000040 00  AX  0   0 32
   \[10\] \.got              PROGBITS        100000a0 0020a0 000020 00  WA  0   0  4
index 62d237b5e4d82e77f3fa9e77dcd231e4f030c299..2a9389c7b4c6f034bafb312232f6d434f2c2cff7 100644 (file)
@@ -10,7 +10,7 @@ Section Headers:
   \[ 5\] \.rela\.got         RELA            0000814c 00114c 000024 0c  AI  2  11  4
   \[ 6\] \.rela\.neardata    RELA            00008170 001170 000018 0c  AI  2  12  4
   \[ 7\] \.dynamic          DYNAMIC         00008188 001188 0000b0 08  WA  3   0  4
-  \[ 8\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2   9  4
+  \[ 8\] \.rela\.plt         RELA            10000000 002000 000018 0c  AI  2  11  4
   \[ 9\] \.plt              PROGBITS        10000020 002020 000060 18  AX  0   0 32
   \[10\] \.text             PROGBITS        10000080 002080 000080 00  AX  0   0 32
   \[11\] \.got              PROGBITS        10000100 002100 000028 00  WA  0   0  4