IBM Support

LI76822: OVERLAPING CSECTS CAUSING LINKER ERROR

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When compiling with both -qfuncsect and -qminimaltoc, the newer
    linkers (ie bos.rte.bind_cmds 7.1.0.16 and above)
    start complaining about overlaping csect symbols in the object
    file.
    
    After looking at the .s file, you can see the overlap between
    csect H.12 and H.22:
    .
    .
            .csect  H.22.NO_SYMBOL{RO}, 3         <----start of H.22
            .long   0x00000054              # "\0\0\0T"
            .long   0x00000060              # "\0\0\0`"
            .long   0x0000006c              # "\0\0\0l"
            .long   0x00000078              # "\0\0\0x"
    
            .toc
    T.12.NO_SYMBOL:
            .tc     H.12.NO_SYMBOL{TC},0x00000084     <----start of
    H.12
            .long   0x00000090              # "\0\0\0\220"
            .long   0x0000009c              # "\0\0\0\234"
            .long   0x000000a8              # "\0\0\0\250"
    # End   csect   H.22.NO_SYMBOL{RO}          <----end of H.22
    
    
    
    
    ===== COMPILE COMMAND:
    $xlC -qfuncsect -qminimaltoc test.cpp
    
    ===== TESTCASE:
    $cat test.cpp
    int Z(int val)
    {
     int ret=0;
     switch(val)
     {
     case 0:
      ret=5;
      break;
     case 1:
      ret=10;
      break;
     case 2:
      ret=7;
      break;
     case 3:
      ret=2;
      break;
     case 4:
      ret=17;
      break;
     case 5:
      ret=1;
      break;
     case 6:
      ret=47;
      break;
     case 7:
      ret=99;
      break;
     default:
      ret=98;
      break;
     }
     return ret;
    }
    
    int main(int argc)
    {
     return Z(argc);
    }
    $
    
    
    ===== ACTUAL OUTPUT:
    $xlC -qfuncsect -qminimaltoc test.cpp
    ld: 0711-552 SEVERE ERROR: Object test.o:
     Csects with symbol numbers 22 and 12 overlap.
    $
    
    ===== EXPECTED OUTPUT:
    Should not cause a link error.
    

Local fix

  • Avoid using the -qfuncsect -qminimaltoc option combination as a
    workaround with the 7.1.0.16 (and above) linkers.
    

Problem summary

  • USERS AFFECTED:
    Clients using -qfuncsect and -qminimaltoc together to compile a
    program with switch statements may be affected by this issue.
    
    PROBLEM DESCRIPTION:
    The compiler internally generates a branch table for the switch
    statement when -qfuncsect is used.
    When -qminimaltoc is used, relocatable addresses are created
    and put into data CSECTs and should not generate TOC slots.
    When both are used together, the compiler generates incorrect
    addresses that overlap the branch table causing the linker to
    complain.
    

Problem conclusion

  • The fix is to not emit the sym table entries for the incorrect
    TOC slot.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76822

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5724X1400

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2012-05-24

  • Closed date

    2012-05-24

  • Last modified date

    2012-05-24

  • APAR is sysrouted FROM one or more of the following:

    IV13924

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5724X1400

Applicable component levels



Document information

More support for: XL C/C++ for Linux

Software version: B10

Reference #: LI76822

Modified date: 24 May 2012