PR22220, BFD linker wrongly marks symbols as PREVAILING_DEF_IRONLY

non_ir_ref_dynamic wasn't being set in the case where we have a
versioned dynamic symbol definition with a non-versioned matching IR
symbol.

bfd/
	PR 22220
	* elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
	a case where plugin_notice isn't called.
ld/
	* testsuite/ld-plugin/pr22220.h,
	* testsuite/ld-plugin/pr22220lib.cc,
	* testsuite/ld-plugin/pr22220lib.ver,
	* testsuite/ld-plugin/pr22220main.cc: New test.
	* testsuite/ld-plugin/lto.exp: Run it.
This commit is contained in:
Alan Modra
2017-09-28 17:11:38 +09:30
parent 50300765aa
commit 1a3b5c34fe
8 changed files with 63 additions and 0 deletions

View File

@@ -1234,6 +1234,16 @@ _bfd_elf_merge_symbol (bfd *abfd,
olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0;
}
/* Handle a case where plugin_notice won't be called and thus won't
set the non_ir_ref flags on the first pass over symbols. */
if (oldbfd != NULL
&& (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN)
&& newdyn != olddyn)
{
h->root.non_ir_ref_dynamic = TRUE;
hi->root.non_ir_ref_dynamic = TRUE;
}
/* NEWDEF and OLDDEF indicate whether the new or old symbol,
respectively, appear to be a definition rather than reference. */