[patch] AVR: Let -mrelax elide global RJMP .+0

Georg-Johann Lay avr@gjlay.de
Fri Aug 21 16:06:16 GMT 2026


Am 21.08.26 um 14:59 schrieb Alan Modra:
> On Sun, Aug 16, 2026 at 03:48:44PM +0200, Georg-Johann Lay via Binutils wrote:
>> This patch extends the avr-specific linker relaxation machine to
>> elide trivial RJMP instructions.  These are RJMP instructions
> 
> You need to run "make check" before committing patches.  This one
> causes
> +FAIL: AVR .avr.prop, single .align sym at end of section test.

Ok, thanks.

I went ahead and adjusted the test case to rjmp0 elision.

https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=02d2394808d8f9c68245d4d1bbb74fb2e9ccd974

Johann

--

     AVR: Repair avr-prop-6.d by linking with --no-elide-rjmp0

     avr-prop-6.d uses a JMP instruction that targets a global
     label right after it, which is relaxed  to RJMP .+0,
     and that no-op is then removed.  Outcome is that the
     expectation of the test case is violated.

     The fix is to link with --no-elide-rjmp0 to retain the RJMP.

     ld/
             * testsuite/ld-avr/avr-prop-6.d (ld): Add --no-elide-rjmp0.

diff --git a/ld/testsuite/ld-avr/avr-prop-6.d 
b/ld/testsuite/ld-avr/avr-prop-6.d
index 1bf8aa13725..0f6a6252b3d 100644
--- a/ld/testsuite/ld-avr/avr-prop-6.d
+++ b/ld/testsuite/ld-avr/avr-prop-6.d
@@ -1,6 +1,6 @@
  #name: AVR .avr.prop, single .align sym at end of section test.
  #as: -mavrxmega2 -mlink-relax
-#ld: -mavrxmega2 --relax
+#ld: -mavrxmega2 --relax --no-elide-rjmp0
  #source: avr-prop-6.s
  #objdump: -S
  #target: avr-*-*



More information about the Binutils mailing list