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: Nick Clifton <nickc at cygnus dot com>
- Subject: Re: arm-elf-as truncates branch offsets w/o warning
- From: Grant Edwards <grante at visi dot com>
- Date: Thu, 16 Mar 2000 19:19:00 -0600
- Cc: scottb at netwinder dot org, binutils at sourceware dot cygnus dot com
- References: <200003170109.RAA05817@elmo.cygnus.com>
> : ------------------------------testit2.s------------------------------
> : .text
> : .org 0x05000000
> : b label1
> : nop
> : nop
> : nop
> : label1:
> : nop
> : --------------------------------------------------------------------
>
> Great - thanks. I have now been able to track the cause of the
> assembler's failure to handle this code correctly. It turns out that
> the assembler was performing an absolute relocation rather than a PC
> relative relocation. If you try to assemble the following code you
> will also get a bad binary:
>
> .text
> .org 0x100
> b label1
> nop
> label1:
> nop
It looks OK to me -- when I assemble the above and link it with
.text @ 0, I get:
----------------------------------------------------------------------
testit: file format elf32-littlearm
Disassembly of section .text:
00000000 <label1-0x108>:
...
100: ea000000 b 108 <label1>
104: e1a00000 nop (mov r0,r0)
00000108 <label1>:
108: e1a00000 nop (mov r0,r0)
Disassembly of section .glue:
----------------------------------------------------------------------
Linked with .text @ 1000, I get:
----------------------------------------------------------------------
testit: file format elf32-littlearm
Disassembly of section .text:
00001000 <label1-0x108>:
...
1100: ea000000 b 1108 <label1>
1104: e1a00000 nop (mov r0,r0)
00001108 <label1>:
1108: e1a00000 nop (mov r0,r0)
Disassembly of section .glue:
----------------------------------------------------------------------
--
Grant Edwards
grante@visi.com