<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/122196>122196</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SPARC] llvm-objdump seem to mishandle backwards branches
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:Sparc,
tools:llvm-objdump
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
koachan
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
koachan
</td>
</tr>
</table>
<pre>
llvm-objdump seems to treat negative branch offset as a large positive one, causing it to disassemble backwards branch in an odd way:
```
reproducer:
nop
ba reproducer
nop
```
Assemble with e.g. `clang -target sparc -c reproducer.s`, then read it back:
```
$ bin/llvm-objdump -d reproducer.o
reproducer.o: file format elf32-sparc
Disassembly of section .text:
00000000 <reproducer>:
0: 01 00 00 00 nop
4: 10 bf ff ff ba 4194303
8: 01 00 00 00 nop
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0U9FupDoM_ZrwYg0KDswMDzxwp3eeV9svCImBtCEZJaHd_v0KhmlZddeyhGSb4-MTW8ZoBkfUsOo_hvjqpRqlY4isesrknEYfmi2YdV5_NNa-TQffveh5ukEkmiIkDymQTOBokMm8EXRBOjWC7_tICWQECVaGgeDmo1krvCOGF1ByjsYNYNKCok2UMdLUWYJOqtd3GXR8gBkH0oHXGt7lBxMt4y078s15G-gWvJ4VhXsOwPnb-u0k7JJLZEvtf2e8bR-t300agfIhB3bkyko3wCEt9BPEmwwKDmqHmMcFAS-QRnIQSOplmoX-d5IMS-iMY3j9Q8aD3uN5uPPZh1aoujeWoPdhkgnI9gIPK597-dOneB_ge4ikkvEO8kS_0saEt3wzYOKyV-z_h2ircSZa4AVwvjkwXj_kXK1cKgoOXQ_96ktFJ6Es6lJw8VV4_jfUpzCZboSuRS0zaoqTOIozF1WZjQ0_H49Si5PCirgiwataCCGI1FkVvKLMNMix4gU_o6hQlDnHqtZVV9AJT6cz9qzkNElj80Xv3IchMzHO1BSIRX3MrOzIxm33lycjp5lon1dVERleGGLy3kYm2v2TbQcS7ufQzUNkJbcmpvjVKZlk17t6_tH-vLDqCb7dzrL0k4mjdPovK08xm4NtxpRuS3-GV4bXwaRx7nLlp22LHst0C_6FVGJ4XUeMDK_blG8N_g4AAP__XjgxeA">