aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiulio Benetti <giulio.benetti@benettiengineering.com>2021-07-16 15:03:07 +0100
committerNick Clifton <nickc@redhat.com>2021-07-16 15:03:07 +0100
commit05a1dd47cc9b6fcc8ec112bd0b68b36567ccbb39 (patch)
tree014584304436abfb9e44be2f796e4005655dad69
parentc58830e49d917dcc80c520b22638a1902ce8f932 (diff)
downloadgdb-05a1dd47cc9b6fcc8ec112bd0b68b36567ccbb39.zip
gdb-05a1dd47cc9b6fcc8ec112bd0b68b36567ccbb39.tar.gz
gdb-05a1dd47cc9b6fcc8ec112bd0b68b36567ccbb39.tar.bz2
or1k: fix pc-relative relocation against dynamic on PC relative 26 bit relocation.
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().
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-or1k.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ff44a7e..6fea91a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 4ae7f32..4f90925 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -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: