Bug 16849 - Jump tables for linkonce sections in non-linkonce section
Summary: Jump tables for linkonce sections in non-linkonce section
Status: RESOLVED DUPLICATE of bug 16625
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2004-08-01 08:12 UTC by Andreas Schwab
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2004-08-01 08:12:08 UTC
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) 
      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
Comment 1 Andrew Pinski 2004-08-01 08:53:11 UTC
I think this is a dup of bug 16625 but I cannot be for sure as the testcase is a complex one.
Comment 2 Andreas Schwab 2004-08-01 09:31:29 UTC
I agree. 

*** This bug has been marked as a duplicate of 16625 ***