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

Georg-Johann Lay via Binutils <[email protected]>
Newsgroups gmane.comp.gnu.binutils
Message-ID <[email protected]>
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-*-*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.