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.

GCC linker error, relocation overflow / Internal compiler error


Hi

I have a problem when linking an application compiled with GCC for c6x (v 4.5-124).

I get the following error message during linking:

pr-support.c:(.text+0x1074): relocation truncated to fit: R_C6000_PCR_S21 against symbol `abort' defined in .plt section in /home/vagrant/repositories/ti_toolchain/gcc-c6x/bin/../c6x-uclinux/libc/lib/crt1.o
/home/vagrant/repositories/ti_toolchain/gcc-c6x/bin/../lib/gcc/c6x-uclinux/4.5.1/libgcc.a(emutls.o): In function `__emutls_get_address':
emutls.c:(.text+0x68): relocation truncated to fit: R_C6000_PCR_S21 against symbol `malloc' defined in .plt section in /home/vagrant/repositories/ti_toolchain/gcc-c6x/bin/../c6x-uclinux/libc/lib/crt1.o
emutls.c:(.text+0xa4): relocation truncated to fit: R_C6000_PCR_S21 against symbol `memcpy' defined in .plt section in /home/vagrant/repositories/ti_toolchain/gcc-c6x/bin/../c6x-uclinux/libc/lib/crt1.o
emutls.c:(.text+0xec): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status

The application is almost 5 MB.

We have tried to add -mlong-calls as suggested in 8.QA http://linux-c6x.org/wiki/index.php/FAQ.

This however provokes several compilation errors like this:

algdat/adstringhelper.h: In function 'void ADStringSetSignedNumber(ADString&, T, int, int, char) [with T = int]':
algdat/adstringhelper.h:175:1: error: insn does not satisfy its constraints:
(insn:TI 71 48 54 2 algdat/adstringhelper.h:16
2 (parallel [
            (unspec [
                    (symbol_ref:SI ("_ZN8ADString5resetEi") [flags 0x3] <function_decl 0x40393700 reset>)
                    (const_int 1 [0x1])
                ] 10)
            (clobber (reg:SI 35 B3))
        ]) 81 {real_call} (expr_list:REG_UNUSED (reg:SI 35 B3)
        (nil)))
algdat/adstringhelper.h:175:1: internal compiler error: in final_scan_insn, at final.c:2591
Please submit a full bug report, with preprocessed source if appropriate.
See <https://support.codesourcery.com/GNUToolchain/> for instructions.

Any suggestions on how to resolve this?

Best regards

Anders

  • Hi Anders,

    Could you try adding this "-mlarge" option to both the compiler and linker settings,

  • Hi.

    Thanks for the quick reply. 

    The compiler does not recognize the -mlarge option, and the linker still gives the same error with the -mlarge option.

    Any other suggestions?

    -Anders

  • Hi Anders,

    Would you please let us know what is the application you are trying to build? Is it a standard TI software package? or your own or the modified one of the TI package?

    From your log, I could see morethan one source file throwing linker errors. Just to narrow down the problem, 1. Try excluding the module ( which includes these source files) in the Makefile and build again or comment out the functions which throws error. Once the build is successful, include the source file one by one with the functions un-commenting one by one.

    If it is a standard TI package, remove all your own modifications and give a build. If you see errors in the build of standard package, please specify, We will try from our end to either build successfully ot reproduce the linker error.

     

    Regards,

    Shankari

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

  • Hi, Anders,

    There isn't really a solution for it other than tried to rearrange your object files in the link command or reduce the code. Please refer to earlier discussion of the issue in http://e2e.ti.com/support/embedded/linux/f/354/t/191695.aspx

    Rex