aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-12-11 06:01:46 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-12-11 06:01:46 -0800
commit209d1499de79eb23191f5761166180b80feb900a (patch)
tree9676ee68cb7fe6d0d35926dda1bca56f83e23855
parent69799d67e8872dcd3feee81ed2ff0fc47beb52d7 (diff)
downloadbinutils-209d1499de79eb23191f5761166180b80feb900a.zip
binutils-209d1499de79eb23191f5761166180b80feb900a.tar.gz
binutils-209d1499de79eb23191f5761166180b80feb900a.tar.bz2
xc16x: Add elf32_xc16x_rtype_to_howto
Add elf32_xc16x_rtype_to_howto to get reloc_howto_type pointer from ELF32_R_TYPE. * elf32-xc16x.c (elf32_xc16x_rtype_to_howto): New function. (elf32_xc16x_relocate_section): Call elf32_xc16x_rtype_to_howto instead of xc16x_reloc_type_lookup to get reloc_howto_type.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-xc16x.c11
2 files changed, 16 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index aa8be34..b88fe7e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-11 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-xc16x.c (elf32_xc16x_rtype_to_howto): New function.
+ (elf32_xc16x_relocate_section): Call elf32_xc16x_rtype_to_howto
+ instead of xc16x_reloc_type_lookup to get reloc_howto_type.
+
2018-12-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23958
diff --git a/bfd/elf32-xc16x.c b/bfd/elf32-xc16x.c
index 66fe33d..b94cadf 100644
--- a/bfd/elf32-xc16x.c
+++ b/bfd/elf32-xc16x.c
@@ -220,6 +220,15 @@ xc16x_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
return NULL;
}
+static reloc_howto_type *
+elf32_xc16x_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, unsigned r_type)
+{
+ if (r_type < ARRAY_SIZE (xc16x_elf_howto_table))
+ return & xc16x_elf_howto_table[r_type];
+
+ return NULL;
+}
+
/* For a particular operand this function is
called to finalise the type of relocation. */
@@ -388,7 +397,7 @@ elf32_xc16x_relocate_section (bfd *output_bfd,
or sections discarded by a linker script, we just want the
section contents cleared. Avoid any special processing. */
reloc_howto_type *howto;
- howto = xc16x_reloc_type_lookup (input_bfd, r_type);
+ howto = elf32_xc16x_rtype_to_howto (input_bfd, r_type);
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
}