http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56353
Bug #: 56353 Summary: libgcj should be listed on command line for libjava.jni/invocation/PR16923.c Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcj AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com libjava.jni/invocation/PR16923.c behaves differently, depending on linking with gold or ld. _Jv_RegisterClasses is weak reference and libgcj.so isn't on the linker command line. Since libgcj.so isn't on the linker command line, gold resolves _Jv_RegisterClasses to 0 and ld silently resolves it to _Jv_RegisterClasses in libgcj.so: [hjl@gnu-13 testsuite]$ readelf -sWr /tmp/PR16923.gold | grep _Jv_RegisterClasses 8: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses 37: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses [hjl@gnu-13 testsuite]$ readelf -sWr /tmp/PR16923.bfd | grep _Jv_RegisterClasses 0000000000600cd0 0000000900000007 R_X86_64_JUMP_SLOT 00000000004005e0 _Jv_RegisterClasses + 0 9: 00000000004005e0 0 FUNC WEAK DEFAULT UND _Jv_RegisterClasses 59: 00000000004005e0 0 FUNC WEAK DEFAULT UND _Jv_RegisterClasses [hjl@gnu-13 testsuite]$