"relocation truncated to fit" error when linking

I'm building a very large application using the Blackfin GNU toolchain and getting an error about a R_BFIN_PCREL24 relocation being truncated when I try to link it.  The error is as follows:
block/built-in.o: In function `as_exit':^Mblock/as-iosched.c:1511: relocation truncated to fit: R_BFIN_PCREL24 against symbol `wait_for_completion' defined in .sched.text section in kernel/built-in.o

What does this error mean and how do I fix it?

  • This error usually occurs when the linker tries to resolve a PC relative call to a symbol further away than the signed 25-bit range.  By default the compiler generates PC relative calls as they are both faster and smaller, however in the rare situations where they are not sufficient you must manually tell the compiler to use indirect calls.  For code compiled from source you can do this by adding the -mlong-calls switch to your command line.  However, in situations where the problem call is part of assembly code, you will have to alter the code yourself.

    e.g.

    -jump.l _func;
    +P2.H = _func;
    +P2.L = _func;
    +jump (P2);

    Stu

  • 0
    •  Analog Employees 
    on Apr 29, 2019 10:36 AM
    This question has been closed by the EZ team and is assumed answered.