This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linker issue while building a large code base



Hi,

For one of our project we are building our code base for c6x linux using uclinux compiler.

Basically our compiling code has 3 major modules. If we compiling each modules independently, we are not observing any issues.

But when we do combine compilation, we see some linker issues.

/home/test/my-linux-c6x/gcc-c6x/c6x-4.5/bin/../lib/gcc/c6x-uclinux/4.5.1/crtbegin.o:(.fini+0x0): relocation truncated to fit: R_C6000_PCR_S21 against `.text'
/home/test/my-linux-c6x/gcc-c6x/c6x-4.5/bin/../lib/gcc/c6x-uclinux/4.5.1/crtend.o:(.init+0x0): relocation truncated to fit: R_C6000_PCR_S21 against `.text'

Has any one encountered such issues while using uclinux?

Solutions are badly needed.

Regards,

Shrinivas

  • Hi.

    I am running into the exactly same problem. By removing code I am as you able to get rid of the linker errors. 

    From the wiki:

    Q: When cross-compiling, it gets the error message of "Relocation Truncated to Fit"
    A: The issue is due to R_C6000_PCR_S21 relocation uses 21 bit PC-relative branches.
    Thus, problem may occur when .text is greater than 2MB. You may want to try
    adding -mlong-calls flag to see if it helps. If it does not help, try to reorder the objects.
    The linker map file (-WI, --print-map) can help and show where things end up and
    might help pointing to any issues.

    Adding the -mlong-calls however provokes another compiler error ("error: insn does not satisfy its constraints") for me so I am not able to link with this option. Maybe it works for you.

    Any luck solving this?

    Regards

    Anders