public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/58082] New: avr-gcc vector table relocation truncation error with -mrelax option
@ 2013-08-05 0:21 acmeexhibits at gmail dot com
2013-09-09 16:47 ` [Bug other/58082] " gjl at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: acmeexhibits at gmail dot com @ 2013-08-05 0:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58082
Bug ID: 58082
Summary: avr-gcc vector table relocation truncation error with
-mrelax option
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: acmeexhibits at gmail dot com
Created attachment 30613
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30613&action=edit
pads the space between the vector table and text area to move the rjmp/jmp
transition.
When the attached code compiles properly, we get this vector table:
00000000 <__vectors>:
0: 0c 94 08 08 jmp 0x1010 ; 0x1010 <__ctors_end>
4: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
8: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
c: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
10: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
14: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
18: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
1c: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
20: 0c 94 12 08 jmp 0x1024 ; 0x1024 <__bad_interrupt>
24: ff c7 rjmp .+4094 ; 0x1024
<__bad_interrupt>
26: 00 00 nop
28: fd c7 rjmp .+4090 ; 0x1024
<__bad_interrupt>
2a: 00 00 nop
2c: fb c7 rjmp .+4086 ; 0x1024
<__bad_interrupt>
2e: 00 00 nop
I believe the -mrelax option says to use rjmp (relative jumps) when possible,
which for the Atmel 2560 chip is +/- 4k. We can see that the jumps for vectors
0 to 8 are too far for a relative jump so the linker/compiler switches to jmp,
an absolute jump.
For reasons I don't understand, if the __bad_interrupt label is 2 bytes farther
away, the linker cannot figure out how to make vector 9 a jmp. Instead it
generates the error message:
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr6/crtm2560.o: In function
`__bad_interrupt':
../../../../crt1/gcrt1.S:195: relocation truncated to fit: R_AVR_13_PCREL
against symbol `__vector_9' defined in .text section in
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr6/crtm2560.o
There are bands where the rjmp/jmp transition works and other bands where it
doesn't work. Omitting the -mrelax flag does solve the problem as only jmp
instructions are generated.
Thankfully, source code that irritates the bug is trivial
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug other/58082] avr-gcc vector table relocation truncation error with -mrelax option
2013-08-05 0:21 [Bug other/58082] New: avr-gcc vector table relocation truncation error with -mrelax option acmeexhibits at gmail dot com
@ 2013-09-09 16:47 ` gjl at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: gjl at gcc dot gnu.org @ 2013-09-09 16:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58082
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |avr
Status|UNCONFIRMED |RESOLVED
CC| |gjl at gcc dot gnu.org
Resolution|--- |INVALID
Severity|major |normal
--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Relaxation is a matter of Binutils. The compiler driver just passes -mrelax
through to Binutils. Please report the issue to the Binutils bug tracker
together with a valid test case, command options and Binutils version. Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-09 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 0:21 [Bug other/58082] New: avr-gcc vector table relocation truncation error with -mrelax option acmeexhibits at gmail dot com
2013-09-09 16:47 ` [Bug other/58082] " gjl at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).