[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #33698] Explicit use of RJMP/RCALL can cause "reloca

From: Georg-Johann Lay
Subject: [avr-libc-dev] [bug #33698] Explicit use of RJMP/RCALL can cause "relocation truncated to fit: R_AVR_13_PCREL" linker error
Date: Thu, 16 Feb 2012 11:10:09 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100506 SUSE/3.5.10-0.1.2 Firefox/3.5.10

Follow-up Comment #7, bug #33698 (project avr-libc):

> IMO, I think the cleaner solution is to:
> 1. Improve the definition of XCALL/XJMP - at present
> it's defines call/jmp when __AVR_MEGA__ and rjmp/rcall
> otherwise. We need to correct this.

That won't catch all cases because sources use RJMP directly.
See the initial post for examples.
> 2. Like Jan Waclawek mentioned, let the linker relaxation
> optimize it, rather than changing the linker script to
> keep the math functions closer (even if we do, i wonder if
> it's going to solve the problem completely)

Keeping functions together and knowing that RCALL is always
legal can simplify the sources.  There is a silicon bug that
obsoletes call-skip sequences.

For example, in libgcc we see code like the following:

    ;; Some cores have problem skipping 2-word instruction
    tst  A0
    brmi 1f
    sbrs A0, 7
#endif /* __AVR_HAVE_JMP_CALL__ */
    XJMP  __fmul
1:  XCALL __fmul

This must not rely on linker relaxation.

If, however, binutils ensured that functions in
section .text.libgcc and any .text.libgcc.foo are close
together, the snip above could be simplified as

    sbrs A0, 7
    XJMP  __fmul
    XCALL __fmul

For avr-libc this means that replacing RCALL/RJMP with
XCALL/XJMP must be done carefully if the instruction
is a skip's payload (SBRS, SBRC, SBIS, SBIC, CPSE).


Reply to this item at:


  Nachricht geschickt von/durch Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]