http://sourceware.org/bugzilla/show_bug.cgi?id=15469
Bug #: 15469 Summary: GNU LD incorrectly binds weakref to a random symbol when weakref target is taken away by linker plugin Product: binutils Version: unspecified Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassig...@sourceware.org ReportedBy: hubi...@gcc.gnu.org Classification: Unclassified GCC revision r198926 is needed to reproduce this bug. evans:/abuild/jh/trunk-3/build-inst11-check/gcc/:[0]# cat a.c /* { dg-lto-do run } */ int first = 0; void abort (void); int second = 0; void callmealias (void) { if (!first || !second) abort (); } void callmefirst (void) { if (first) abort(); first = 1; } void callmesecond (void) { if (!first) abort(); if (second) abort(); second = 1; } main() { c(); b(); return 0; } evans:/abuild/jh/trunk-3/build-inst11-check/gcc/:[0]# cat b.c extern void callmesecond(); static void callmealias() __attribute__((weakref ("callmesecond"))); b() { callmealias(); } evans:/abuild/jh/trunk-3/build-inst11-check/gcc/:[0]# cat c.c extern void callmefirst(); static void callmealias() __attribute__((weakref ("callmefirst"))); c() { callmealias(); } evans:/abuild/jh/trunk-3/build-inst11-check/gcc/:[0]# ./xgcc -B ./ -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects ?.c -g -fdump-ipa-all leads to working segfaulting binary with gold and infinite loop with GNU LD. There is bug in GCC that optimize away the targets of weakrefs (callmefirst and callmesecond) but it keeps the weakrefs. Gold correctly makes the weakref target to be NULL, while GNU LD binds it to other function causing the infinite loop. I believe GNU LD ought to be fixed. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils