[SH] Line numbers and delayed branches

Andrew STUBBS andrew.stubbs@st.com
Fri Oct 27 15:10:00 GMT 2006


Kaz Kojima wrote:
> Andrew STUBBS <andrew.stubbs@st.com> wrote:
>> On re-reading the code I see that this problem relates to all types of 
>> branches, not just delayed branches.
>>
>> Updated patch attached. (It's only the comment that has changed.)
> 
> This patch is OK.  Thanks!

Thanks, committed.

Although the above patch fixes most cases of this problem, Joern has 
noted another similar example:

--------------------------------
         .file 1 "test.c"
         .text
         .loc 1 2
         nop
         .loc 1 1000
         bt 0f
         nop

         .align 9, 0
0:
--------------------------------

In this case the bt branches too far and so is converted to two 
branches. The line numbers are still wrong with the new patch.

$ ./gas/as-new -o test2.o test2.s
test2.s: Assembler messages:
test2.s:6: Warning: overflow in branch to L1; converted into longer 
instruction sequence
$ ./binutils/objdump -dl test2.o

test2.o:     file format elf32-sh

Disassembly of section .text:

00000000 <.text>:
blah/test.c:2
    0:   00 09           nop
    2:   8b 01           bf      0x8
    4:   a0 fc           bra     0x200
blah/test.c:1000
    6:   00 09           nop
    8:   00 09           nop
         ...

I don't know how to fix this one. However, I'm not that worried about it 
either because there is a warning and, in any case, I don't think the 
compiler generates code like this (does it?)

Andrew Stubbs



More information about the Binutils mailing list