+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
#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 =
{
#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
#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
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);
#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);
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
#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;
#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 */
#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;
/* 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
/* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
+ _bfd_generic_set_reloc,
xcoff64_reloc_type_lookup,
xcoff64_reloc_name_lookup,
/* Reloc */
coff_get_reloc_upper_bound,
coff_canonicalize_reloc,
+ _bfd_generic_set_reloc,
xcoff64_reloc_type_lookup,
xcoff64_reloc_name_lookup,
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
#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
#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
#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
#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 =
{
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 \
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,
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 \
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
#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
#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)
#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 =
{
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;
+}
#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 =
{
.#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);
#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 =
{
*relptr = (arelent *) NULL;
return section->reloc_count;
}
+
+/* Install a new set of internal relocs. */
+
+#define alpha_vms_set_reloc _bfd_generic_set_reloc
+
\f
/* This is just copied from ecoff-alpha, needs to be fixed probably. */