This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: arm-elf-as truncates branch offsets w/o warning
- To: Scott Bambrough <scottb at netwinder dot org>
- Subject: Re: arm-elf-as truncates branch offsets w/o warning
- From: Grant Edwards <grante at visi dot com>
- Date: Thu, 16 Mar 2000 17:39:49 -0600
- Cc: binutils at sourceware dot cygnus dot com
- References: <20000316102708.A18044@visi.com> <20000316171956.A5344@visi.com> <38D16B91.6B96150F@netwinder.org>
> Would you have a testcase for this as well?
Sure:
------------------------------testit2.s------------------------------
.text
.org 0x05000000
b label1
nop
nop
nop
label1:
nop
--------------------------------------------------------------------
NB: Assembling the above file will suck the life out of your
machine for a minute or two.
This generates the following (broken) code with the unpatched
000309 arm-elf-as:
Disassembly of section .text:
00000000 <label1-0x5000010>:
...
5000000: ea400002 b 6000010 <label1+0x1000000>
5000004: e1a00000 nop (mov r0,r0)
5000008: e1a00000 nop (mov r0,r0)
500000c: e1a00000 nop (mov r0,r0)
05000010 <label1>:
5000010: e1a00000 nop (mov r0,r0)
While my patch doesn't generate the correct code, it does
generate an error message:
$ binutils-000309.work/gas/as-new testit2.s
testit2.s: Assembler messages:
testit2.s:3: Error: gas can't handle non-relocatable branch dest >= 0x04000000
$
Now, there's damned little reason anybody would ever want to
_write_ code like that but believe it or not, somebody e-mailed
me an off-the-cuff snippet of code to demonstrate something,
and I ran into the problem. ;)
I _think_ that relocatable destinations for both cases #1 and
#2 are handled correctly by the linker, but I haven't verified
that just yet.
--
Grant Edwards
grante@visi.com