binutils-gdb/ld/testsuite/ld-plugin/pr22502a.c
H.J. Lu a83ef4d139 ld: Set non_ir_ref_regular on symbols referenced in regular objects
If linker plugin is enabled, set non_ir_ref_regular on symbols referenced
in regular objects so that linker plugin will get the correct symbol
resolution.

bfd/

	PR ld/22502
	* elflink.c (_bfd_elf_merge_symbol): Also skip definition from
	an IR object.
	(elf_link_add_object_symbols): If linker plugin is enabled, set
	non_ir_ref_regular on symbols referenced in regular objects so
	that linker plugin will get the correct symbol resolution.

ld/

	PR ld/22502
	* testsuite/ld-plugin/lto.exp: Run PR ld/22502 test.
	* testsuite/ld-plugin/pr22502a.c: New file.
	* testsuite/ld-plugin/pr22502b.c: Likewise.
2017-11-28 03:48:44 -08:00

17 lines
205 B
C

#include <stdio.h>
volatile int x;
extern void abort ();
__attribute__((weak))
void foobar (void) { x++; }
int main (void)
{
foobar ();
if (x != -1)
abort ();
printf ("PASS\n");
return 0;
}