1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Link error for ProC files

Discussion in 'SQL PL/SQL' started by saracooper, Apr 1, 2010.

  1. saracooper

    saracooper Active Member

    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    80
    Hello,

    I have 3 code files written in ProC. I have precompiled, compiled, tested them in my local environment (Windows) & they work fine. But when I try in real environment, AIX 5.3, I can precompile them. But when I try to compile & link them with the libclntsh library I get errors. I am using a Makefile but just for testing this is the command -

    xlc oraProcs oraProcs.c test_curva.c lib_util.c -I $ORACLE_HOME/precomp/public -L $LIBPATH -l libclntsh.a

    Error - ld: 0706-006 Cannot find or open library file: -l libclntsh.a
    ld: open(): A file or directory in the pathname does not exist


    where LIBPATH = $ORACLE_HOME/lib
    library libclntsh.a exists in $ORACLE_HOME/lib & has the right permissions

    I also tried removing the library libclntsh.a & recreating it using the command - genclntsh
    When I run this command I get this warning more than once -
    ld: 0711-783 Warning TOC overflow TOC size: 66888 Max size: 65536

    genclntsh creates the library libclntsh.a, just not sure if these warnings damage the library file and are related to my link erros in some way.

    Please let me know if u have any suggestions. Any help is appreciated. Thanks
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,529
    Likes Received:
    360
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    This appears to be a bug with gcc:

    > This is a bug in gcc (or g++), as evidenced by locale-init.o (and I
    > suspect wlocale-init.o).
    >
    > There are multiple .text csects in locale-init.o, and there is a branch
    > from 1 csect to another. When the linker assigns addresses to the
    > csects, the csects are far enough apart that the branch overflows.
    > Normally, the overflowing branch instruction would be replaced (by the
    > linker) with a branch to a branch, ultimately reaching the desired target
    > instruction.
    >
    > Unfortunately, the referenced symbol used for the branch causes the
    > overflow fixup code to fail. In order for branches to be fixed up
    > properly, the branch has to be a branch to the target symbol, not the
    > target plus an offset. That is, if you have :
    > .extern .foo
    > bl .foo+4
    >
    > This instruction can't be fixed up, because of the "+4".
    >
    > In locale-init.o, symbol 8818 is a csect containing 2 labels: symbol
    > 9656 and 9753. Symbol 9565 has an address of 0, while symbol 9753 has
    > an address of 0x130
    >
    > The branch instruction is in the csect at symbol 14092, whose only label
    > is at 14094. The address of the branch is 0x9f7c, and it is generated as
    > a branch to 0x130 (the address of symbol 9753).
    >
    > The relocation for this branch (which you can see by extracting
    > locale-inst.o and running dump -X64 -r locale-inst.o | grep 0009f7c) is
    > based on symbol 8818 (=3D0x2272).
    >
    > If the relocation were to symbol 9753, the target of the branch would be
    > to the address of the referenced symbol with no offset, and fixup would
    > work. Other branches were fixed up successfully.
    >
    > A workaround is to use -Wl,-bnoobjreorder. This keeps .text csects in
    > the same object file together, so no branch overflow occurs.
    > Nevertheless, the compiler problem should be reported to the gcc (g++)
    > developers.
    >
    >
    > (By the way, the limit on the size of a single csect containing branches
    > to other csects is not explicitly documented, but it is implied by the
    > PowerPC architecture, where the branch instruction is described. This is
    > similar to the restriction on the target of a conditional branch
    > instruction, which contains a signed, 16-bit offset.)
    >
     
  3. saracooper

    saracooper Active Member

    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    80
    OK thanks zargon