From 95a515681272fa3a79624279c1579cce14ad61c0 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 15 Apr 2020 14:25:08 +0100 Subject: Unify the behaviour of ld.bfd and ld.gold with respect to warning about unresolved symbol references. (PR 24613) PR binutils/24613 include * bfdlink.h (enum report_method): Delete RM_GENERATE_WARNING and RM_GENERATE_ERROR. Add RM_DIAGNOSE. (struct bfd_link_info): Add warn_unresolved_syms. ld * lexsup.c (parse_args): Change RM_GENERATE_WARNING and RM_GENERATE_ERROR to RM_DIAGNOSE. * emultempl/aix.em (ld_${EMULATION_NAME}_emulation): Change RM_GENERATE_ERROR to RM_DIAGNOSE. * emultempl/elf.em (ld_${EMULATION_NAME}_emulation): Likewise. bfd * coff-rs6000.c (xcoff_ppc_relocate_section): Change RM_GENERATE_ERROR to RM_DIAGNOSE plus a check of warn_unresolved_syms. * coff64-rs6000.c (xcoff_ppc_relocate_section): Likewise. * elf-bfd.h (_bfd_elf_large_com_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise. * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise. * elf32-sh.c (sh_elf_relocate_section): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf64-hppa.c (elf64_hppa_relocate_section): Likewise. * elflink.c (elf_link_output_extsym): Likewise. * elfxx-mips.c (mips_elf_calculate_relocation): Likewise. --- include/ChangeLog | 7 +++++++ include/bfdlink.h | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/ChangeLog b/include/ChangeLog index 97409d9..42698b2 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2020-04-10 Fangrui Song + + PR binutils/24613 + * bfdlink.h (enum report_method): Delete RM_GENERATE_WARNING and + RM_GENERATE_ERROR. Add RM_DIAGNOSE. + (struct bfd_link_info): Add warn_unresolved_syms. + 2020-04-14 Stephen Casner PR ld/25677 diff --git a/include/bfdlink.h b/include/bfdlink.h index 84b9dd7..ec97679 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -270,8 +270,7 @@ enum report_method allowed to set the value. */ RM_NOT_YET_SET = 0, RM_IGNORE, - RM_GENERATE_WARNING, - RM_GENERATE_ERROR + RM_DIAGNOSE, }; typedef enum {with_flags, without_flags} flag_type; @@ -373,7 +372,7 @@ struct bfd_link_info ENUM_BITFIELD (bfd_link_elf_stt_common) elf_stt_common : 2; /* Criteria for skipping symbols when determining - whether to include an object from an archive. */ + whether to include an object from an archive. */ ENUM_BITFIELD (bfd_link_common_skip_ar_symbols) common_skip_ar_symbols : 2; /* What to do with unresolved symbols in an object file. @@ -387,6 +386,9 @@ struct bfd_link_info The same defaults apply. */ ENUM_BITFIELD (report_method) unresolved_syms_in_shared_libs : 2; + /* TRUE if unresolved symbols are to be warned, rather than errored. */ + unsigned int warn_unresolved_syms: 1; + /* TRUE if shared objects should be linked directly, not shared. */ unsigned int static_link: 1; -- cgit v1.1