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.
This commit is contained in:
Fangrui Song
2020-04-15 14:25:08 +01:00
committed by Nick Clifton
parent b1bc1394df
commit 95a5156812
18 changed files with 115 additions and 86 deletions

View File

@ -3882,13 +3882,14 @@ elf64_hppa_relocate_section (bfd *output_bfd,
else if (!bfd_link_relocatable (info))
{
bfd_boolean err;
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
|| ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT);
(*info->callbacks->undefined_symbol) (info,
eh->root.root.string,
input_bfd,
input_section,
rel->r_offset, err);
err = (info->unresolved_syms_in_objects == RM_DIAGNOSE
&& !info->warn_unresolved_syms)
|| ELF_ST_VISIBILITY (eh->other) != STV_DEFAULT;
info->callbacks->undefined_symbol
(info, eh->root.root.string, input_bfd,
input_section, rel->r_offset, err);
}
if (!bfd_link_relocatable (info)
@ -3900,7 +3901,7 @@ elf64_hppa_relocate_section (bfd *output_bfd,
if (info->unresolved_syms_in_objects == RM_IGNORE
&& ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT
&& eh->type == STT_PARISC_MILLI)
(*info->callbacks->undefined_symbol)
info->callbacks->undefined_symbol
(info, eh_name (eh), input_bfd,
input_section, rel->r_offset, FALSE);
}