https://sourceware.org/bugzilla/show_bug.cgi?id=20221
Bug ID: 20221
Summary: [avr] Wrong code generated with linker relaxation for
source with alignment directives
Product: binutils
Version: 2.27 (HEAD)
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: senthil.thecoder at gmail dot com
Target Milestone: ---
$ cat avr-prop-5.s
.text
.global _start, dest
_start:
CALL dest
.align 1
dest:
NOP
when assembled with -mlink-relax and linked with --relax
$ avr-gcc -mrelax -mmcu=atmega1280 -Os avr-prop-5.s -nostartfiles
$ avr-objdump -S a.out
a.out: file format elf32-avr
Disassembly of section .text:
00000000 <__ctors_end>:
0: ff df rcall .-2 ; 0x0 <__ctors_end>
00000002 <dest>:
...
Note that the rcall offset is wrong - it's calling 0x0 rather than calling dest
(0x2). Disabling relaxation results in correct code
$ avr-gcc -mno-relax -mmcu=atmega1280 -Os avr-prop-5.s -nostartfiles
$ avr-objdump -S a.out
a.out: file format elf32-avr
Disassembly of section .text:
00000000 <__ctors_end>:
0: 0e 94 02 00 call 0x4 ; 0x4 <dest>
00000004 <dest>:
...
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils