binutils-gdb/ld/testsuite/ld-plugin/pr15323a.c
H.J. Lu 6d636d8c77 Add "ld -r" tests for PR ld/15323
Weak defined function is turned into non-weak defined function by
"ld -r -flto" with GCC 5 due to a GCC 5 regression:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67548

Add "ld -r" tests for PR ld/15323 to make sure that any linker change
won't introduce linker regression for PR ld/15323.

	* ld-plugin/lto.exp (lto_link_tests): Add a "ld -r" test for
	PR ld/15323.
	(lto_run_tests): Add a "ld -r" test for PR ld/15323.
2015-09-11 10:02:57 -07:00

24 lines
254 B
C

#include <stdio.h>
int x;
int y;
__attribute__((weak))
void foobar (void) { y++; x++; }
int main (void)
{
foobar ();
if (y == 0)
{
if (x == -1)
printf ("OK\n");
}
else
{
if (x == 1)
printf ("OK\n");
}
return 0;
}