diff options
author | Nick Clifton <nickc@redhat.com> | 2016-04-21 15:43:00 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-04-21 15:43:00 +0100 |
commit | 4f3b23b390640efdc36c575dbda2175e61154bc9 (patch) | |
tree | b6b86755f91753a236e53eb4719a6dae7ac4a6ee /bfd | |
parent | 71829b1a3f9b4825150747b138b5cfadf0c5fcba (diff) | |
download | binutils-gdb-4f3b23b390640efdc36c575dbda2175e61154bc9.tar.gz |
Add support for non-ELF targets to check their relocs.
bfd * aout-adobe.c: Use _bfd_generic_link_check_relocs.
* aout-target.h: Likewise.
* aout-tic30.c: Likewise.
* binary.c: Likewise.
* bout.c: Likewise.
* coff-alpha.c: Likewise.
* coff-rs6000.c: Likewise.
* coff64-rs6000.c: Likewise.
* coffcode.h: Likewise.
* i386msdos.c: Likewise.
* i386os9k.c: Likewise.
* ieee.c: Likewise.
* ihex.c: Likewise.
* libbfd-in.h: Likewise.
* libecoff.h: Likewise.
* mach-o-target.c: Likewise.
* mmo.c: Likewise.
* nlm-target.h: Likewise.
* oasys.c: Likewise.
* pef.c: Likewise.
* plugin.c: Likewise.
* ppcboot.c: Likewise.
* som.c: Likewise.
* srec.c: Likewise.
* tekhex.c: Likewise.
* versados.c: Likewise.
* vms-alpha.c: Likewise.
* xsym.c: Likewise.
* elfxx-target.h: Use _bfd_elf_link_check_relocs.
* linker.c (bfd_link_check_relocs): New function.
(_bfd_generic_link_check_relocs): New function.
* targets.c (BFD_JUMP_TABLE_LINK): Add initialization of
_bfd_link_check_relocs field.
(struct bfd_target)L Add _bfd_link_check_relocs field.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
ld * ldlang.c (lang_check_relocs): Use bfd_link_check_relocs in
prefernce to _bfd_elf_link_check_relocs. Drop test for ELF
targets. Do not stop the checks when problems are encountered.
include * bfdlink.h: Add prototype for bfd_link_check_relocs.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 39 | ||||
-rw-r--r-- | bfd/aout-adobe.c | 1 | ||||
-rw-r--r-- | bfd/aout-target.h | 4 | ||||
-rw-r--r-- | bfd/aout-tic30.c | 4 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 10 | ||||
-rw-r--r-- | bfd/binary.c | 4 | ||||
-rw-r--r-- | bfd/bout.c | 1 | ||||
-rw-r--r-- | bfd/coff-alpha.c | 1 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 1 | ||||
-rw-r--r-- | bfd/coff64-rs6000.c | 2 | ||||
-rw-r--r-- | bfd/coffcode.h | 2 | ||||
-rw-r--r-- | bfd/elfxx-target.h | 4 | ||||
-rw-r--r-- | bfd/i386msdos.c | 1 | ||||
-rw-r--r-- | bfd/i386os9k.c | 1 | ||||
-rw-r--r-- | bfd/ieee.c | 1 | ||||
-rw-r--r-- | bfd/ihex.c | 4 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 2 | ||||
-rw-r--r-- | bfd/libbfd.h | 2 | ||||
-rw-r--r-- | bfd/libecoff.h | 1 | ||||
-rw-r--r-- | bfd/linker.c | 43 | ||||
-rw-r--r-- | bfd/mach-o-target.c | 1 | ||||
-rw-r--r-- | bfd/mmo.c | 1 | ||||
-rw-r--r-- | bfd/nlm-target.h | 1 | ||||
-rw-r--r-- | bfd/oasys.c | 1 | ||||
-rw-r--r-- | bfd/pef.c | 1 | ||||
-rw-r--r-- | bfd/plugin.c | 1 | ||||
-rw-r--r-- | bfd/ppcboot.c | 1 | ||||
-rw-r--r-- | bfd/som.c | 1 | ||||
-rw-r--r-- | bfd/srec.c | 4 | ||||
-rw-r--r-- | bfd/targets.c | 4 | ||||
-rw-r--r-- | bfd/tekhex.c | 4 | ||||
-rw-r--r-- | bfd/versados.c | 1 | ||||
-rw-r--r-- | bfd/vms-alpha.c | 1 | ||||
-rw-r--r-- | bfd/xsym.c | 1 |
34 files changed, 143 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 201b16330d3..979322522b1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,42 @@ +2016-04-21 Nick Clifton <nickc@redhat.com> + + * aout-adobe.c: Use _bfd_generic_link_check_relocs. + * aout-target.h: Likewise. + * aout-tic30.c: Likewise. + * binary.c: Likewise. + * bout.c: Likewise. + * coff-alpha.c: Likewise. + * coff-rs6000.c: Likewise. + * coff64-rs6000.c: Likewise. + * coffcode.h: Likewise. + * i386msdos.c: Likewise. + * i386os9k.c: Likewise. + * ieee.c: Likewise. + * ihex.c: Likewise. + * libbfd-in.h: Likewise. + * libecoff.h: Likewise. + * mach-o-target.c: Likewise. + * mmo.c: Likewise. + * nlm-target.h: Likewise. + * oasys.c: Likewise. + * pef.c: Likewise. + * plugin.c: Likewise. + * ppcboot.c: Likewise. + * som.c: Likewise. + * srec.c: Likewise. + * tekhex.c: Likewise. + * versados.c: Likewise. + * vms-alpha.c: Likewise. + * xsym.c: Likewise. + * elfxx-target.h: Use _bfd_elf_link_check_relocs. + * linker.c (bfd_link_check_relocs): New function. + (_bfd_generic_link_check_relocs): New function. + * targets.c (BFD_JUMP_TABLE_LINK): Add initialization of + _bfd_link_check_relocs field. + (struct bfd_target)L Add _bfd_link_check_relocs field. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2016-04-20 H.J. Lu <hongjiu.lu@intel.com> * elf32-i386.c (elf_i386_gc_sweep_hook): Removed. diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 9556c895317..57fdce7890d 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -472,6 +472,7 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, _bfd_generic_copy_link_hash_symbol_type #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 const bfd_target aout_adobe_vec = { diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 7d962609f4e..c7f5b1bf459 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -542,6 +542,10 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) #define MY_bfd_link_split_section _bfd_generic_link_split_section #endif +#ifndef MY_bfd_link_check_relocs +#define MY_bfd_link_check_relocs _bfd_generic_link_check_relocs +#endif + #ifndef MY_bfd_copy_private_bfd_data #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index f73b7e4340a..468944c0773 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -997,6 +997,10 @@ tic30_aout_set_arch_mach (bfd *abfd, #define MY_bfd_link_split_section _bfd_generic_link_split_section #endif +#ifndef MY_bfd_link_check_relocs +#define MY_bfd_link_check_relocs _bfd_generic_link_check_relocs +#endif + #ifndef MY_bfd_copy_private_bfd_data #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 6532f6e1f62..a19a6513992 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7413,6 +7413,7 @@ typedef struct bfd_target NAME##_bfd_copy_link_hash_symbol_type, \ NAME##_bfd_final_link, \ NAME##_bfd_link_split_section, \ + NAME##_bfd_link_check_relocs, \ NAME##_bfd_gc_sections, \ NAME##_bfd_lookup_section_flags, \ NAME##_bfd_merge_sections, \ @@ -7454,6 +7455,9 @@ typedef struct bfd_target /* Should this section be split up into smaller pieces during linking. */ bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); + /* Check the relocations in the bfd for validity. */ + bfd_boolean (* _bfd_link_check_relocs)(bfd *, struct bfd_link_info *); + /* Remove sections that are not referenced from the output. */ bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); @@ -7566,6 +7570,12 @@ struct bfd_elf_version_tree * bfd_find_version_for_sym bfd_boolean bfd_hide_sym_by_version (struct bfd_elf_version_tree *verdefs, const char *sym_name); +bfd_boolean bfd_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); + +bfd_boolean _bfd_generic_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); + /* Extracted from simple.c. */ bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); diff --git a/bfd/binary.c b/bfd/binary.c index ce94af29af3..2223b5d2dfc 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -309,12 +309,12 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define binary_bfd_define_common_symbol bfd_generic_define_common_symbol #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define binary_bfd_link_just_syms _bfd_generic_link_just_syms -#define binary_bfd_copy_link_hash_symbol_type \ - _bfd_generic_copy_link_hash_symbol_type +#define binary_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type #define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols #define binary_bfd_final_link _bfd_generic_final_link #define binary_bfd_link_split_section _bfd_generic_link_split_section #define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define binary_bfd_link_check_relocs _bfd_generic_link_check_relocs const bfd_target binary_vec = { diff --git a/bfd/bout.c b/bfd/bout.c index 77023dbc1ba..0718d3e7867 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1393,6 +1393,7 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd, #define b_out_section_already_linked _bfd_generic_section_already_linked #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 extern const bfd_target bout_le_vec; diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index 70388f7db02..55fd35070be 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -2351,6 +2351,7 @@ static const struct ecoff_backend_data alpha_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_bfd_link_check_relocs _bfd_generic_link_check_relocs const bfd_target alpha_ecoff_le_vec = { diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index e7a215b65b2..ffef1baee93 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -4014,6 +4014,7 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = { #define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group #define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked #define _bfd_xcoff_bfd_define_common_symbol _bfd_xcoff_define_common_symbol +#define _bfd_xcoff_bfd_link_check_relocs _bfd_generic_link_check_relocs /* For dynamic symbols and relocs entry points. */ #define _bfd_xcoff_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index a0bc160ea02..7b5bb2460f7 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2741,6 +2741,7 @@ const bfd_target rs6000_xcoff64_vec = _bfd_generic_copy_link_hash_symbol_type, _bfd_xcoff_bfd_final_link, _bfd_generic_link_split_section, + _bfd_generic_link_check_relocs, bfd_generic_gc_sections, bfd_generic_lookup_section_flags, bfd_generic_merge_sections, @@ -2999,6 +3000,7 @@ const bfd_target rs6000_xcoff64_aix_vec = _bfd_generic_copy_link_hash_symbol_type, _bfd_xcoff_bfd_final_link, _bfd_generic_link_split_section, + _bfd_generic_link_check_relocs, bfd_generic_gc_sections, bfd_generic_lookup_section_flags, bfd_generic_merge_sections, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 798f7f7f0a5..eef3fa8d1da 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5480,6 +5480,8 @@ dummy_reloc16_extra_cases (bfd *abfd ATTRIBUTE_UNUSED, _bfd_generic_copy_link_hash_symbol_type #define coff_bfd_link_split_section _bfd_generic_link_split_section +#define coff_bfd_link_check_relocs _bfd_generic_link_check_relocs + #ifndef coff_start_final_link #define coff_start_final_link NULL #endif diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index c179721ac68..fde34b7d292 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -287,6 +287,10 @@ #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section #endif +#ifndef bfd_elfNN_bfd_link_check_relocs +#define bfd_elfNN_bfd_link_check_relocs _bfd_elf_link_check_relocs +#endif + #ifndef bfd_elfNN_archive_p #define bfd_elfNN_archive_p bfd_generic_archive_p #endif diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index fd24e8b571b..7be9544ea12 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -157,6 +157,7 @@ msdos_set_section_contents (bfd *abfd, #define msdos_bfd_final_link _bfd_generic_final_link #define msdos_bfd_link_split_section _bfd_generic_link_split_section #define msdos_set_arch_mach _bfd_generic_set_arch_mach +#define msdos_bfd_link_check_relocs _bfd_generic_link_check_relocs #define msdos_get_symtab_upper_bound _bfd_nosymbols_get_symtab_upper_bound #define msdos_canonicalize_symtab _bfd_nosymbols_canonicalize_symtab diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index 6bfe2183db4..dc5624a0cd0 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -183,6 +183,7 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, _bfd_generic_copy_link_hash_symbol_type #define os9k_bfd_final_link _bfd_generic_final_link #define os9k_bfd_link_split_section _bfd_generic_link_split_section +#define os9k_bfd_link_check_relocs _bfd_generic_link_check_relocs const bfd_target i386_aout_os9k_vec = { diff --git a/bfd/ieee.c b/bfd/ieee.c index f65f0f038c9..73b3f98d477 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -3863,6 +3863,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, _bfd_generic_copy_link_hash_symbol_type #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 const bfd_target ieee_vec = { diff --git a/bfd/ihex.c b/bfd/ihex.c index ba3c0871513..27e197dcbe2 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -940,10 +940,10 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, #define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols #define ihex_bfd_link_just_syms _bfd_generic_link_just_syms -#define ihex_bfd_copy_link_hash_symbol_type \ - _bfd_generic_copy_link_hash_symbol_type +#define ihex_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type #define ihex_bfd_final_link _bfd_generic_final_link #define ihex_bfd_link_split_section _bfd_generic_link_split_section +#define ihex_bfd_link_check_relocs _bfd_generic_link_check_relocs /* The Intel Hex target vector. */ diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 89d215bd3ec..5f2886339fe 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -499,6 +499,8 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_define_common_symbol \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, \ struct bfd_link_hash_entry *)) bfd_false) +#define _bfd_nolink_bfd_link_check_relocs \ + _bfd_generic_link_check_relocs /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 16c0aee5782..5fe45ecae94 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -504,6 +504,8 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_define_common_symbol \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *, \ struct bfd_link_hash_entry *)) bfd_false) +#define _bfd_nolink_bfd_link_check_relocs \ + _bfd_generic_link_check_relocs /* Routines to use for BFD_JUMP_TABLE_DYNAMIC for targets which do not have dynamic symbols or relocs. Use BFD_JUMP_TABLE_DYNAMIC diff --git a/bfd/libecoff.h b/bfd/libecoff.h index 0d97c463767..e0991ee14b4 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -242,6 +242,7 @@ extern bfd_boolean _bfd_ecoff_get_section_contents (bfd *, asection *, void * location, file_ptr, bfd_size_type); #define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section +#define _bfd_ecoff_bfd_link_check_relocs _bfd_generic_link_check_relocs extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data (bfd *, bfd *); diff --git a/bfd/linker.c b/bfd/linker.c index 97b5d18d845..082eea0715b 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -3304,3 +3304,46 @@ bfd_hide_sym_by_version (struct bfd_elf_version_tree *verdefs, bfd_find_version_for_sym (verdefs, sym_name, &hidden); return hidden; } + +/* +FUNCTION + bfd_link_check_relocs + +SYNOPSIS + bfd_boolean bfd_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); + +DESCRIPTION + Checks the relocs in ABFD for validity. + Does not execute the relocs. + Return TRUE if everything is OK, FALSE otherwise. + This is the external entry point to this code. +*/ + +bfd_boolean +bfd_link_check_relocs (bfd *abfd, struct bfd_link_info *info) +{ + return BFD_SEND (abfd, _bfd_link_check_relocs, (abfd, info)); +} + +/* +FUNCTION + _bfd_generic_link_check_relocs + +SYNOPSIS + bfd_boolean _bfd_generic_link_check_relocs + (bfd *abfd, struct bfd_link_info *info); + +DESCRIPTION + Stub function for targets that do not implement reloc checking. + Return TRUE. + This is an internal function. It should not be called from + outside the BFD library. +*/ + +bfd_boolean +_bfd_generic_link_check_relocs (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) +{ + return TRUE; +} diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c index bf956fdd3df..6b615ed774e 100644 --- a/bfd/mach-o-target.c +++ b/bfd/mach-o-target.c @@ -44,6 +44,7 @@ _bfd_generic_copy_link_hash_symbol_type #define bfd_mach_o_bfd_final_link _bfd_generic_final_link #define bfd_mach_o_bfd_link_split_section _bfd_generic_link_split_section +#define bfd_mach_o_bfd_link_check_relocs _bfd_generic_link_check_relocs #define bfd_mach_o_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data #define bfd_mach_o_bfd_set_private_flags bfd_mach_o_bfd_set_private_flags #define bfd_mach_o_get_section_contents _bfd_generic_get_section_contents diff --git a/bfd/mmo.c b/bfd/mmo.c index d396fd74281..b8af63a711f 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -3278,6 +3278,7 @@ mmo_write_object_contents (bfd *abfd) _bfd_generic_copy_link_hash_symbol_type #define mmo_bfd_final_link _bfd_generic_final_link #define mmo_bfd_link_split_section _bfd_generic_link_split_section +#define mmo_bfd_link_check_relocs _bfd_generic_link_check_relocs /* Strictly speaking, only MMIX uses this restricted format, but let's not stop anybody from shooting themselves in the foot. */ diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index 082e8562848..6ed0b5c6847 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -59,6 +59,7 @@ _bfd_generic_copy_link_hash_symbol_type #define nlm_bfd_final_link _bfd_generic_final_link #define nlm_bfd_link_split_section _bfd_generic_link_split_section +#define nlm_bfd_link_check_relocs _bfd_generic_link_check_relocs /* This structure contains everything that BFD knows about a target. It includes things like its byte order, name, what routines to call diff --git a/bfd/oasys.c b/bfd/oasys.c index f7791d231fa..31555e094ab 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1192,6 +1192,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, _bfd_generic_copy_link_hash_symbol_type #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 const bfd_target oasys_vec = { diff --git a/bfd/pef.c b/bfd/pef.c index fb9a07abd15..30c31794909 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -67,6 +67,7 @@ #define bfd_pef_bfd_final_link _bfd_generic_final_link #define bfd_pef_bfd_link_split_section _bfd_generic_link_split_section #define bfd_pef_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define bfd_pef_bfd_link_check_relocs _bfd_generic_link_check_relocs static int bfd_pef_parse_traceback_table (bfd *abfd, diff --git a/bfd/plugin.c b/bfd/plugin.c index f57833c1fb4..fd7bac04ece 100644 --- a/bfd/plugin.c +++ b/bfd/plugin.c @@ -106,6 +106,7 @@ dlerror (void) #define bfd_plugin_section_already_linked _bfd_generic_section_already_linked #define bfd_plugin_bfd_define_common_symbol bfd_generic_define_common_symbol #define bfd_plugin_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type +#define bfd_plugin_bfd_link_check_relocs _bfd_generic_link_check_relocs static enum ld_plugin_status message (int level ATTRIBUTE_UNUSED, diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index ea54d62ee23..afb6ce0d204 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -465,6 +465,7 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg) #define ppcboot_bfd_link_split_section _bfd_generic_link_split_section #define ppcboot_get_section_contents_in_window \ _bfd_generic_get_section_contents_in_window +#define ppcboot_bfd_link_check_relocs _bfd_generic_link_check_relocs #define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data diff --git a/bfd/som.c b/bfd/som.c index 859e8865510..635727c4d5d 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -6758,6 +6758,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) #define som_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data #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 const bfd_target hppa_som_vec = { diff --git a/bfd/srec.c b/bfd/srec.c index 02b8dad440f..5fdd68bdd0f 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1275,10 +1275,10 @@ srec_print_symbol (bfd *abfd, #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols #define srec_bfd_link_just_syms _bfd_generic_link_just_syms -#define srec_bfd_copy_link_hash_symbol_type \ - _bfd_generic_copy_link_hash_symbol_type +#define srec_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type #define srec_bfd_final_link _bfd_generic_final_link #define srec_bfd_link_split_section _bfd_generic_link_split_section +#define srec_bfd_link_check_relocs _bfd_generic_link_check_relocs const bfd_target srec_vec = { diff --git a/bfd/targets.c b/bfd/targets.c index 50f3712be01..a9edd4c9f02 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -452,6 +452,7 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_copy_link_hash_symbol_type, \ . NAME##_bfd_final_link, \ . NAME##_bfd_link_split_section, \ +. NAME##_bfd_link_check_relocs, \ . NAME##_bfd_gc_sections, \ . NAME##_bfd_lookup_section_flags, \ . NAME##_bfd_merge_sections, \ @@ -493,6 +494,9 @@ BFD_JUMP_TABLE macros. . {* Should this section be split up into smaller pieces during linking. *} . bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); . +. {* Check the relocations in the bfd for validity. *} +. bfd_boolean (* _bfd_link_check_relocs)(bfd *, struct bfd_link_info *); +. . {* Remove sections that are not referenced from the output. *} . bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); . diff --git a/bfd/tekhex.c b/bfd/tekhex.c index 7de2f24bbd4..b94f843b8a7 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -980,11 +980,11 @@ tekhex_print_symbol (bfd *abfd, #define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols #define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms -#define tekhex_bfd_copy_link_hash_symbol_type \ - _bfd_generic_copy_link_hash_symbol_type +#define tekhex_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type #define tekhex_bfd_final_link _bfd_generic_final_link #define tekhex_bfd_link_split_section _bfd_generic_link_split_section #define tekhex_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define tekhex_bfd_link_check_relocs _bfd_generic_link_check_relocs const bfd_target tekhex_vec = { diff --git a/bfd/versados.c b/bfd/versados.c index c8b3c48f389..ed46e3baf43 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -873,6 +873,7 @@ versados_canonicalize_reloc (bfd *abfd, _bfd_generic_copy_link_hash_symbol_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 const bfd_target m68k_versados_vec = { diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index d55780e2e3d..e6cfc1fcf29 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -9260,6 +9260,7 @@ bfd_vms_get_data (bfd *abfd) _bfd_nodynamic_get_dynamic_reloc_upper_bound #define alpha_vms_canonicalize_dynamic_reloc \ _bfd_nodynamic_canonicalize_dynamic_reloc +#define alpha_vms_bfd_link_check_relocs _bfd_generic_link_check_relocs const bfd_target alpha_vms_vec = { diff --git a/bfd/xsym.c b/bfd/xsym.c index c637f74072b..62cc02e60a7 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -59,6 +59,7 @@ #define bfd_sym_bfd_final_link _bfd_generic_final_link #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window +#define bfd_sym_bfd_link_check_relocs _bfd_generic_link_check_relocs extern const bfd_target sym_vec; |