]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Fri, 6 May 2011 10:27:39 +0000 (10:27 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Fri, 6 May 2011 10:27:39 +0000 (10:27 +0000)
* elf32-arm.c (cortex_a8_erratum_scan): If the stub is a Thumb
branch to a PLT entry, redirect it to the PLT's Thumb entry point.

ld/testsuite/
* ld-arm/cortex-a8-fix-b-plt.s, ld-arm/cortex-a8-fix-b-plt.d,
ld-arm/cortex-a8-fix-bcc-plt.s, ld-arm/cortex-a8-fix-bcc-plt.d,
ld-arm/cortex-a8-fix-bl-plt.s, ld-arm/cortex-a8-fix-bl-plt.d,
ld-arm/cortex-a8-fix-blx-plt.s, ld-arm/cortex-a8-fix-blx-plt.d,
ld-arm/cortex-a8-fix-plt.ld: New tests.
* ld-arm/arm-elf.exp: Run them.

bfd/ChangeLog
bfd/elf32-arm.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-elf.exp

index 6dee35066942932e26c0e07f88136f59ce38667e..97cc25fc3ba4d6670fd8f44b3c1bb381f0f758c1 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-06  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * elf32-arm.c (cortex_a8_erratum_scan): If the stub is a Thumb
+       branch to a PLT entry, redirect it to the PLT's Thumb entry point.
+
 2011-05-04  Alan Modra  <amodra@gmail.com>
 
        PR ld/12727
index ffe8f60a4392b816dd97a51acabeb9a128c900d7..e03ce0e0a740b263fc30bb15d7408fbc0b915408 100644 (file)
@@ -4110,6 +4110,7 @@ cortex_a8_erratum_scan (bfd *input_bfd,
                   bfd_vma target;
                   enum elf32_arm_stub_type stub_type = arm_stub_none;
                   struct a8_erratum_reloc key, *found;
+                  bfd_boolean use_plt = FALSE;
 
                   key.from = base_vma + i;
                   found = (struct a8_erratum_reloc *)
@@ -4121,7 +4122,6 @@ cortex_a8_erratum_scan (bfd *input_bfd,
                    {
                      char *error_message = NULL;
                      struct elf_link_hash_entry *entry;
-                     bfd_boolean use_plt = FALSE;
 
                      /* We don't care about the error returned from this
                         function, only if there is glue or not.  */
@@ -4224,6 +4224,12 @@ cortex_a8_erratum_scan (bfd *input_bfd,
                         offset =
                          (bfd_signed_vma) (found->destination - pc_for_insn);
 
+                      /* If the stub will use a Thumb-mode branch to a
+                         PLT target, redirect it to the preceding Thumb
+                         entry point.  */
+                      if (stub_type != arm_stub_a8_veneer_blx && use_plt)
+                        offset -= PLT_THUMB_STUB_SIZE;
+
                       target = pc_for_insn + offset;
 
                       /* The BLX stub is ARM-mode code.  Adjust the offset to
index aa44f2f2c7dce9a5e9098f773dede62e004df3ea..be7772955f2c32e39c076dfe3bd681a2cdde33de 100644 (file)
@@ -1,3 +1,12 @@
+2011-05-06  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * ld-arm/cortex-a8-fix-b-plt.s, ld-arm/cortex-a8-fix-b-plt.d,
+       ld-arm/cortex-a8-fix-bcc-plt.s, ld-arm/cortex-a8-fix-bcc-plt.d,
+       ld-arm/cortex-a8-fix-bl-plt.s, ld-arm/cortex-a8-fix-bl-plt.d,
+       ld-arm/cortex-a8-fix-blx-plt.s, ld-arm/cortex-a8-fix-blx-plt.d,
+       ld-arm/cortex-a8-fix-plt.ld: New tests.
+       * ld-arm/arm-elf.exp: Run them.
+
 2011-04-27  Alan Modra  <amodra@gmail.com>
 
        Backport from mainline.
index 80f521ec48f0a3ad862d157247d515dcff758c0e..0b1cdaaa2ad025723be462cc544442851e49bc04 100644 (file)
@@ -166,18 +166,38 @@ set armelftests {
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "-EL" {cortex-a8-fix-b.s}
      {{objdump -dr cortex-a8-fix-b.d}}
      "cortex-a8-fix-b"}
+    {"Cortex-A8 erratum fix, b.w to PLT"
+     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "-EL"
+     {cortex-a8-fix-b-plt.s}
+     {{objdump -dr cortex-a8-fix-b-plt.d}}
+     "cortex-a8-fix-b-plt"}
     {"Cortex-A8 erratum fix, bl.w"
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "-EL" {cortex-a8-fix-bl.s}
      {{objdump -dr cortex-a8-fix-bl.d}}
      "cortex-a8-fix-bl"}
+    {"Cortex-A8 erratum fix, bl.w to PLT"
+     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "-EL"
+     {cortex-a8-fix-bl-plt.s}
+     {{objdump -dr cortex-a8-fix-bl-plt.d}}
+     "cortex-a8-fix-bl-plt"}
     {"Cortex-A8 erratum fix, bcc.w"
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "-EL" {cortex-a8-fix-bcc.s}
      {{objdump -dr cortex-a8-fix-bcc.d}}
      "cortex-a8-fix-bcc"}
+    {"Cortex-A8 erratum fix, bcc.w to PLT"
+     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "-EL"
+     {cortex-a8-fix-bcc-plt.s}
+     {{objdump -dr cortex-a8-fix-bcc-plt.d}}
+     "cortex-a8-fix-bcc-plt"}
     {"Cortex-A8 erratum fix, blx.w"
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "-EL" {cortex-a8-fix-blx.s}
      {{objdump -dr cortex-a8-fix-blx.d}}
      "cortex-a8-fix-blx"}
+    {"Cortex-A8 erratum fix, blx.w to PLT"
+     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "-EL"
+     {cortex-a8-fix-blx-plt.s}
+     {{objdump -dr cortex-a8-fix-blx-plt.d}}
+     "cortex-a8-fix-blx-plt"}
     {"Cortex-A8 erratum fix, relocate b.w to ARM"
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "-EL" {cortex-a8-arm-target.s cortex-a8-fix-b-rel.s}
      {{objdump -dr cortex-a8-fix-b-rel-arm.d}}