aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog33
-rw-r--r--bfd/aout-adobe.c1
-rw-r--r--bfd/aout-target.h3
-rw-r--r--bfd/aout-tic30.c3
-rw-r--r--bfd/bfd-in2.h5
-rw-r--r--bfd/bfd.c12
-rw-r--r--bfd/bout.c1
-rw-r--r--bfd/coff-alpha.c3
-rw-r--r--bfd/coff-mips.c1
-rw-r--r--bfd/coff-rs6000.c1
-rw-r--r--bfd/coff64-rs6000.c2
-rw-r--r--bfd/coffcode.h4
-rw-r--r--bfd/elfxx-target.h3
-rw-r--r--bfd/i386msdos.c1
-rw-r--r--bfd/i386os9k.c2
-rw-r--r--bfd/ieee.c1
-rw-r--r--bfd/libbfd-in.h2
-rw-r--r--bfd/libbfd.c9
-rw-r--r--bfd/libbfd.h8
-rw-r--r--bfd/mach-o-target.c1
-rw-r--r--bfd/nlm-target.h1
-rw-r--r--bfd/oasys.c1
-rw-r--r--bfd/reloc.c26
-rw-r--r--bfd/som.c1
-rw-r--r--bfd/targets.c3
-rw-r--r--bfd/versados.c1
-rw-r--r--bfd/vms-alpha.c5
27 files changed, 124 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b307ecb..e9095b1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,36 @@
+2017-05-10 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
+ (struct bfd_target): New field _bfd_set_reloc.
+ * bfd.c (bfd_set_reloc): Call backend _set_bfd.
+ * reloc.c (_bfd_generic_set_reloc): New function.
+ * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
+ * nlm-target.h (nlm_set_reloc): Likewise.
+ * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
+ * aout-tic30.c (MY_set_reloc): Likewise.
+ * aout-target.h (MY_set_reloc): Likewise.
+ * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
+ * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
+ * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
+ * vms-alpha.c (alpha_vms_set_reloc): Likewise.
+ * aout-adobe.c (aout_32_set_reloc): Likewise.
+ * bout.c (b_out_set_reloc): Likewise.
+ * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
+ * i386os9k.c (aout_32_set_reloc): Likewise.
+ * ieee.c (ieee_set_reloc): Likewise.
+ * oasys.c (oasys_set_reloc): Likewise.
+ * som.c (som_set_reloc): Likewise.
+ * versados.c (versados_set_reloc): Likewise.
+ * coff64-rs6000.c (rs6000_xcoff64_vec): Add
+ _bfd_generic_set_reloc.
+ (rs6000_xcoff64_aix_vec): LIkewise.
+ * libbfd.c (_bfd_norelocs_set_reloc): New function.
+ * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
+ * i386msdos.c (msdos_set_reloc): Define to
+ _bfd_norelocs_set_reloc.
+ * elfcode.h (elf_set_reloc): Define.
+ * bfd-in2.h: Regenerated.
+
2017-05-10 H.J. Lu <hongjiu.lu@intel.com>
PR ld/21481
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index d47dd20..a2c927d 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -474,6 +474,7 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
#define aout_32_bfd_final_link _bfd_generic_final_link
#define aout_32_bfd_link_split_section _bfd_generic_link_split_section
#define aout_32_bfd_link_check_relocs _bfd_generic_link_check_relocs
+#define aout_32_set_reloc _bfd_generic_set_reloc
const bfd_target aout_adobe_vec =
{
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 9f77c95..2e98c4d 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -450,6 +450,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_canonicalize_reloc
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
#endif
+#ifndef MY_set_reloc
+#define MY_set_reloc _bfd_generic_set_reloc
+#endif
#ifndef MY_make_empty_symbol
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
#endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 29dad9f..5db3da7 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -905,6 +905,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
#ifndef MY_canonicalize_reloc
#define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
#endif
+#ifndef MY_set_reloc
+#define MY_set_reloc _bfd_generic_set_reloc
+#endif
#ifndef MY_make_empty_symbol
#define MY_make_empty_symbol NAME (aout, make_empty_symbol)
#endif
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 17a35c0..8617881 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7075,6 +7075,8 @@ long bfd_canonicalize_reloc
void bfd_set_reloc
(bfd *abfd, asection *sec, arelent **rel, unsigned int count);
+#define bfd_set_reloc(abfd, asect, location, count) \
+ BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
int bfd_get_arch_size (bfd *abfd);
@@ -7542,12 +7544,15 @@ typedef struct bfd_target
#define BFD_JUMP_TABLE_RELOCS(NAME) \
NAME##_get_reloc_upper_bound, \
NAME##_canonicalize_reloc, \
+ NAME##_set_reloc, \
NAME##_bfd_reloc_type_lookup, \
NAME##_bfd_reloc_name_lookup
long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
long (*_bfd_canonicalize_reloc)
(bfd *, sec_ptr, arelent **, struct bfd_symbol **);
+ void (*_bfd_set_reloc)
+ (bfd *, sec_ptr, arelent **, unsigned int);
/* See documentation on reloc types. */
reloc_howto_type *
(*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 23a4350..c6fce45 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1064,18 +1064,10 @@ DESCRIPTION
section @var{sec} to the values @var{rel} and @var{count}.
The argument @var{abfd} is ignored.
+.#define bfd_set_reloc(abfd, asect, location, count) \
+. BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
*/
-void
-bfd_set_reloc (bfd *ignore_abfd ATTRIBUTE_UNUSED,
- sec_ptr asect,
- arelent **location,
- unsigned int count)
-{
- asect->orelocation = location;
- asect->reloc_count = count;
-}
-
/*
FUNCTION
bfd_set_file_flags
diff --git a/bfd/bout.c b/bfd/bout.c
index 1d3bf66..0a6f8db 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1392,6 +1392,7 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd,
#define b_out_bfd_define_common_symbol bfd_generic_define_common_symbol
#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define b_out_bfd_link_check_relocs _bfd_generic_link_check_relocs
+#define b_out_set_reloc _bfd_generic_set_reloc
extern const bfd_target bout_le_vec;
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 9ce1975..8ecba2f 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2342,6 +2342,9 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_bfd_define_common_symbol bfd_generic_define_common_symbol
#define _bfd_ecoff_bfd_link_check_relocs _bfd_generic_link_check_relocs
+/* Installing internal relocations in a section is also generic. */
+#define _bfd_ecoff_set_reloc _bfd_generic_set_reloc
+
const bfd_target alpha_ecoff_le_vec =
{
"ecoff-littlealpha", /* name */
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index f872ebe..45c65f8 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1356,6 +1356,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
#define _bfd_ecoff_section_already_linked \
_bfd_coff_section_already_linked
#define _bfd_ecoff_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define _bfd_ecoff_set_reloc _bfd_generic_set_reloc
extern const bfd_target mips_ecoff_be_vec;
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index e2b149b..b49e393 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -3993,6 +3993,7 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
/* For reloc entry points. */
#define _bfd_xcoff_get_reloc_upper_bound coff_get_reloc_upper_bound
#define _bfd_xcoff_canonicalize_reloc coff_canonicalize_reloc
+#define _bfd_xcoff_set_reloc _bfd_generic_set_reloc
#define _bfd_xcoff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
#define _bfd_xcoff_bfd_reloc_name_lookup _bfd_xcoff_reloc_name_lookup
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index e919dcb..56458e0 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2720,6 +2720,7 @@ const bfd_target rs6000_xcoff64_vec =
/* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
+ _bfd_generic_set_reloc,
xcoff64_reloc_type_lookup,
xcoff64_reloc_name_lookup,
@@ -2979,6 +2980,7 @@ const bfd_target rs6000_xcoff64_aix_vec =
/* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
+ _bfd_generic_set_reloc,
xcoff64_reloc_type_lookup,
xcoff64_reloc_name_lookup,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 96a7886..f9d3978 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5439,6 +5439,10 @@ coff_canonicalize_reloc (bfd * abfd,
return section->reloc_count;
}
+#ifndef coff_set_reloc
+#define coff_set_reloc _bfd_generic_set_reloc
+#endif
+
#ifndef coff_reloc16_estimate
#define coff_reloc16_estimate dummy_reloc16_estimate
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 2e24e11..072efaa 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -46,6 +46,9 @@
#ifndef bfd_elfNN_canonicalize_reloc
#define bfd_elfNN_canonicalize_reloc _bfd_elf_canonicalize_reloc
#endif
+#ifndef bfd_elfNN_set_reloc
+#define bfd_elfNN_set_reloc _bfd_generic_set_reloc
+#endif
#ifndef bfd_elfNN_find_nearest_line
#define bfd_elfNN_find_nearest_line _bfd_elf_find_nearest_line
#endif
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index d37d000..5062506 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -176,6 +176,7 @@ msdos_set_section_contents (bfd *abfd,
#define msdos_minisymbol_to_symbol _bfd_nosymbols_minisymbol_to_symbol
#define msdos_canonicalize_reloc _bfd_norelocs_canonicalize_reloc
+#define msdos_set_reloc _bfd_norelocs_set_reloc
#define msdos_get_reloc_upper_bound _bfd_norelocs_get_reloc_upper_bound
#define msdos_32_bfd_link_split_section _bfd_generic_link_split_section
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index fbec96c..7f79b23 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -165,6 +165,8 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define aout_32_get_section_contents_in_window \
_bfd_generic_get_section_contents_in_window
+#define aout_32_set_reloc _bfd_generic_set_reloc
+
#define os9k_bfd_get_relocated_section_contents \
bfd_generic_get_relocated_section_contents
#define os9k_bfd_relax_section bfd_generic_relax_section
diff --git a/bfd/ieee.c b/bfd/ieee.c
index a2d3835..763c2b8 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -3880,6 +3880,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define ieee_bfd_final_link _bfd_generic_final_link
#define ieee_bfd_link_split_section _bfd_generic_link_split_section
#define ieee_bfd_link_check_relocs _bfd_generic_link_check_relocs
+#define ieee_set_reloc _bfd_generic_set_reloc
const bfd_target ieee_vec =
{
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index ad362dc..2d1bf27 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -444,6 +444,8 @@ extern bfd_boolean _bfd_vms_lib_ia64_mkarchive (bfd *abfd);
extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
arelent **, asymbol **);
+extern void _bfd_norelocs_set_reloc (bfd *, asection *,
+ arelent **, unsigned int);
#define _bfd_norelocs_bfd_reloc_type_lookup \
((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
#define _bfd_norelocs_bfd_reloc_name_lookup \
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 46bb232..554234f 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -119,6 +119,15 @@ _bfd_norelocs_canonicalize_reloc (bfd *abfd ATTRIBUTE_UNUSED,
return 0;
}
+void
+_bfd_norelocs_set_reloc (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *sec ATTRIBUTE_UNUSED,
+ arelent **relptr ATTRIBUTE_UNUSED,
+ unsigned int count ATTRIBUTE_UNUSED)
+{
+ /* Do nothing. */
+}
+
bfd_boolean
_bfd_nocore_core_file_matches_executable_p
(bfd *ignore_core_bfd ATTRIBUTE_UNUSED,
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 8bac650..7e58598 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -449,6 +449,8 @@ extern bfd_boolean _bfd_vms_lib_ia64_mkarchive (bfd *abfd);
extern long _bfd_norelocs_get_reloc_upper_bound (bfd *, asection *);
extern long _bfd_norelocs_canonicalize_reloc (bfd *, asection *,
arelent **, asymbol **);
+extern void _bfd_norelocs_set_reloc (bfd *, asection *,
+ arelent **, unsigned int);
#define _bfd_norelocs_bfd_reloc_type_lookup \
((reloc_howto_type *(*) (bfd *, bfd_reloc_code_real_type)) bfd_nullvoidptr)
#define _bfd_norelocs_bfd_reloc_name_lookup \
@@ -3206,6 +3208,12 @@ bfd_byte *bfd_generic_get_relocated_section_contents
bfd_boolean relocatable,
asymbol **symbols);
+void _bfd_generic_set_reloc
+ (bfd *abfd,
+ sec_ptr section,
+ arelent **relptr,
+ unsigned int count);
+
/* Extracted from archures.c. */
extern const bfd_arch_info_type bfd_default_arch_struct;
const bfd_arch_info_type *bfd_default_compatible
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 3a4e72f..c25a743 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -58,6 +58,7 @@
#define bfd_mach_o_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_executable_p
#define bfd_mach_o_core_file_pid _bfd_nocore_core_file_pid
+#define bfd_mach_o_set_reloc _bfd_generic_set_reloc
#define bfd_mach_o_get_dynamic_symtab_upper_bound bfd_mach_o_get_symtab_upper_bound
#define bfd_mach_o_canonicalize_dynamic_symtab bfd_mach_o_canonicalize_symtab
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 4f9e50f..872ee32 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -38,6 +38,7 @@
#define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
#define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
+#define nlm_set_reloc _bfd_generic_set_reloc
#define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
#define nlm_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
#define nlm_set_section_contents nlmNAME (set_section_contents)
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 06491aa..defb25a 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1194,6 +1194,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define oasys_bfd_final_link _bfd_generic_final_link
#define oasys_bfd_link_split_section _bfd_generic_link_split_section
#define oasys_bfd_link_check_relocs _bfd_generic_link_check_relocs
+#define oasys_set_reloc _bfd_generic_set_reloc
const bfd_target oasys_vec =
{
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 12520d1..8dedfe8 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -8258,3 +8258,29 @@ error_return:
free (reloc_vector);
return NULL;
}
+
+/*
+INTERNAL_FUNCTION
+ _bfd_generic_set_reloc
+
+SYNOPSIS
+ void _bfd_generic_set_reloc
+ (bfd *abfd,
+ sec_ptr section,
+ arelent **relptr,
+ unsigned int count);
+
+DESCRIPTION
+ Installs a new set of internal relocations in SECTION.
+*/
+
+
+void _bfd_generic_set_reloc
+ (bfd *abfd ATTRIBUTE_UNUSED,
+ sec_ptr section,
+ arelent **relptr,
+ unsigned int count)
+{
+ section->orelocation = relptr;
+ section->reloc_count = count;
+}
diff --git a/bfd/som.c b/bfd/som.c
index f78b651..496040c 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6759,6 +6759,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
#define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
#define som_find_inliner_info _bfd_nosymbols_find_inliner_info
#define som_bfd_link_check_relocs _bfd_generic_link_check_relocs
+#define som_set_reloc _bfd_generic_set_reloc
const bfd_target hppa_som_vec =
{
diff --git a/bfd/targets.c b/bfd/targets.c
index 5841e8d..2f3ea13 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -418,12 +418,15 @@ BFD_JUMP_TABLE macros.
.#define BFD_JUMP_TABLE_RELOCS(NAME) \
. NAME##_get_reloc_upper_bound, \
. NAME##_canonicalize_reloc, \
+. NAME##_set_reloc, \
. NAME##_bfd_reloc_type_lookup, \
. NAME##_bfd_reloc_name_lookup
.
. long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
. long (*_bfd_canonicalize_reloc)
. (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
+. void (*_bfd_set_reloc)
+. (bfd *, sec_ptr, arelent **, unsigned int);
. {* See documentation on reloc types. *}
. reloc_howto_type *
. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
diff --git a/bfd/versados.c b/bfd/versados.c
index f575522..2efbcff 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -875,6 +875,7 @@ versados_canonicalize_reloc (bfd *abfd,
#define versados_bfd_final_link _bfd_generic_final_link
#define versados_bfd_link_split_section _bfd_generic_link_split_section
#define versados_bfd_link_check_relocs _bfd_generic_link_check_relocs
+#define versados_set_reloc _bfd_generic_set_reloc
const bfd_target m68k_versados_vec =
{
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 4a9881b..ef52120 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -5118,6 +5118,11 @@ alpha_vms_canonicalize_reloc (bfd *abfd, asection *section, arelent **relptr,
*relptr = (arelent *) NULL;
return section->reloc_count;
}
+
+/* Install a new set of internal relocs. */
+
+#define alpha_vms_set_reloc _bfd_generic_set_reloc
+
/* This is just copied from ecoff-alpha, needs to be fixed probably. */