extern int foo () __attribute__ ((weak)); extern int bar __attribute__ ((weak));
int main () { if (foo) foo (); if (&bar) bar++; return 0; } When compiled with -fPIC, the tests for non-zero foo and bar address have a pic adjustment made before comparing against zero. If the code is run at an address other than where it was linked this will result in foo being called when it is undefined, and similarly for bar. -- Summary: undefined weak sym test broken when pic Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amodra at bigpond dot net dot au GCC target triplet: spu-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32621