or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation.
authorGiulio Benetti <giulio.benetti@benettiengineering.com>
Fri, 16 Jul 2021 14:03:07 +0000 (15:03 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 16 Jul 2021 14:03:07 +0000 (15:03 +0100)
bfd * elf32-or1k.c (or1k_elf_relocate_section): Use a separate entry
in switch case R_OR1K_INSN_REL_26 where we need to check for
!SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().

bfd/ChangeLog
bfd/elf32-or1k.c

index ff44a7e76fbf6a582e63022db6ba1c3aebb04629..6fea91afbe847dd6f1f2943c0c4e0d8f4d902e0b 100644 (file)
@@ -1,3 +1,9 @@
+2021-07-16  Giulio Benetti  <giulio.benetti@benettiengineering.com>
+
+       * elf32-or1k.c (or1k_elf_relocate_section): Use a separate entry
+       in switch case R_OR1K_INSN_REL_26 where we need to check for
+       !SYMBOL_CALLS_LOCAL() instead of !SYMBOL_REFERENCES_LOCAL().
+
 2021-07-14  ClĂ©ment Chigot  <clement.chigot@atos.net>
 
        * libxcoff.h (struct xcoff_dwsect_name): Add DWARF name.
index 4ae7f324d33f6b0af3d0465145da4a52cbb2429f..4f9092539f5053a9596bf802ce30cf8a3e52ba4e 100644 (file)
@@ -1543,6 +1543,18 @@ or1k_elf_relocate_section (bfd *output_bfd,
          break;
 
        case R_OR1K_INSN_REL_26:
+         /* For a non-shared link, these will reference plt or call the
+            version of actual object.  */
+         if (bfd_link_pic (info) && !SYMBOL_CALLS_LOCAL (info, h))
+           {
+             _bfd_error_handler
+               (_("%pB: pc-relative relocation against dynamic symbol %s"),
+                input_bfd, name);
+             ret_val = false;
+             bfd_set_error (bfd_error_bad_value);
+           }
+         break;
+
        case R_OR1K_PCREL_PG21:
        case R_OR1K_LO13:
        case R_OR1K_SLO13: