bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/28686] New: [avr] linker relaxations generate incorrect value


From: j at uriah dot heep.sax.de
Subject: [Bug ld/28686] New: [avr] linker relaxations generate incorrect value
Date: Sun, 12 Dec 2021 22:55:38 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28686

            Bug ID: 28686
           Summary: [avr] linker relaxations generate incorrect value
           Product: binutils
           Version: 2.37
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: j at uriah dot heep.sax.de
  Target Milestone: ---

This appears to be similar to

https://www.sourceware.org/bugzilla/show_bug.cgi?id=20545

However, as that one is "resolved fixed", opening a new bug instead.

In a setup with an assembler file requesting alignment for a particular block
of code, the ZH value for that block of code is miscalculated when linker
relaxations are requested.

Without linker relaxations, the correct code is generated.

Testcode:

.rept 300
call test
.endr
clr ZL
ldi ZH,hi8(matrix)
1:rjmp 1b
test:
ret

.balign 256
matrix:
.byte 1,2,3,4,5

Compiler (i.e. combined assembler+linker) commandline:

avr-gcc main.S -o main.elf -mmcu=atmega328 -nostartfiles -mrelax

Without -mrelax, ZH is (correctly) loaded with 5, as matrix is located at
0x500. With -mrelax, as there are 300 CALL instructions turned into RCALLs,
matrix is located at 0x300, yet the value loaded into ZH becomes 2 rather than
3.

Cross reference:

https://www.mikrocontroller.net/topic/528827

(German-language forum discussion the bug has been reported to originally.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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