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.

Relocation Overflow



Hi,

I'm adding a new feature into current baseline. Since the free space in IRAM is not sufficient for this new feature both for code section and bss section, I located it in to SDRAM. Almost the baseline code and data are in IRAM. While I tried to compile the code, I got below errors. I've added keyword far in front of the global variable of this new feature. I tried to put the baseline code into SDRAM, in this case, no error occurred. Have tried "--mem_model:data=far", did not work. How can I make this right? My goal is to keep the baseline in IRAM as it is, and put the new feature in SDRAM. 

"c:\ti/c6000/cgtools/bin/cl6x" -@"Bp1Dsp.Release.lkf"
>> error: relocation overflow occured at address 0x00000f50 in section
'.edr_text' of input file 'Release/Bp1Objs/CircularBuffers.obj'.
The 32-bit PC-relative displacement -536838080 at this location is
too large to fit into the 21-bit PC-Relative field; the destination
address is too far away from the instruction. You may need to add a
mask to the assembly instruction or use other target specific
assembly features if you really only need the lowest 21 bits of
this symbol. Please see the section on Relocation in the Assembly
User's Guide.
>> error: relocation overflow occured at address 0x00000f70 in section
'.edr_text' of input file 'Release/Bp1Objs/CircularBuffers.obj'.
The 32-bit PC-relative displacement -536838088 at this location is
too large to fit into the 21-bit PC-Relative field; the destination
address is too far away from the instruction. You may need to add a
mask to the assembly instruction or use other target specific
assembly features if you really only need the lowest 21 bits of
this symbol. Please see the section on Relocation in the Assembly
User's Guide.
....

Thanks,

Jane

  • I've moved this thread to the compiler forum. What processor are you using, and also what version of the compiler?
  • You've got a "near" branch or call in CircularBuffers.obj. This is a code model issue, not a data model issue.
    It usually means that the "near" branch is too far from its destination.
    Usually the linker will fixup this sort of problem automatically by inserting a trampoline. Have you disabled trampolines?
  • I've tried to use --trampolines, but it seems that the compiler cannot recognize it. So I used --large_model, it works. The processor is C6713, I'm not clear about the version of the compiler.
    Thanks for your help.
  • You must be using a relatively old version of the compiler.  Recent versions of the compiler do not accept the option --large_model.  One easy way to see the version of the compiler is to look at the top of the linker map file.  This file is typically found in the build configuration directory of the project, often named Debug.  In your case, it appears you are building the Release build configuration, so look in the directory named Release.  It is usually named project_name.map.  Please take a look and let us know the compiler version.

    Thanks and regards,

    -George

  • Follow your guidance, I found the information in map file - "TMS320C6x COFF Linker PC Version 4.36". I guess that's the reason why --trampolines was not supported, too old version. But in some reason, we have to live with this situation. In this case, I suppose --large_model can help to handle the "far" call/branch. How about the data allocated in SDRAM, using keyword far ?

    Thanks and Regards,

    Jane

  • That version of the compiler is about 13 years old.  I cannot encourage you enough to upgrade.

    When I try --large_model with version 4.36, it doesn't work.  Are you sure you used --large_model?  

    In that version of the compiler, memory models are controlled with the option -mlN, where N can be 0-3.  

    Option Code Data
    none near near
    -ml0 near ADF
    -ml1 far near
    -ml2 far ADF
    -ml3 far far

    The table shows the default handling of code or data for that option.  ADF stands for aggregate data far.  This means aggregate data (structures and arrays) is far, all other data is near.  

    In all cases, explicit use of the keywords far or near overrides the default.  When you use the far or near keywords, be sure to use the keyword on both the declaration (which usually appears in a header file, and is visible throughout the code) and the definition (which appears in one source file).

    So, the best solution is up to you.  Just to get everything working, you can use -ml3.  That could cause performance and/or size problems, so it could be better to use no -mlN option at all, and use the far keyword on functions or data that are located in distant memory.

    Thanks and regards,

    -George

  • Yes, you are right. Although --large_model helps me to pass compilation, but I got problem of executing the code. Follow your information, I used -ml3 and got the code started to work finally. I'll try to use far keyword instead of -mlN later.

    Thanks so much for your help.

    Jane