When final_scan_insn() emit a jump-table it always puts it in the readonly_data_section (unless JUMP_TABLES_IN_TEXT_SECTION). If the current function is located in a linkonce section this generates a reference from a non-linkonce section to a local label of a linkonce section, and current binutils complain if the linkonce section is discarded. $ cat inline.h inline int foo (int x) { switch (x) { default: return -1; case 1: return 0; case 2: return 1; case 4: return 2; case 8: return 3; case 16: return 4; case 32: return 5; case 64: return 6; } } $ cat inline1.cc #include "inline.h" int (*x1) (int) = foo; $ cat inline2.cc #include "inline.h" int (*x2) (int) = foo; $ gcc -fPIC -shared inline1.cc inline2.cc `.gnu.linkonce.t._Z3fooi' referenced in section `.rodata' of /tmp/ccvGwdXw.o: defined in discarded section `.gnu.linkonce.t._Z3fooi' of /tmp/ccvGwdXw.o collect2: ld returned 1 exit status
I think this is a dup of bug 16625 but I cannot be for sure as the testcase is a complex one.
I agree. *** This bug has been marked as a duplicate of 16625 ***