<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - llvm-objdump doesn't calculate relative branch target address for arm binaries"
href="https://bugs.llvm.org/show_bug.cgi?id=49518">49518</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-objdump doesn't calculate relative branch target address for arm binaries
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>llvm-objdump
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yabinc@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24617" name="attach_24617" title="arm binary for testing">attachment 24617</a> <a href="attachment.cgi?id=24617&action=edit" title="arm binary for testing">[details]</a></span>
arm binary for testing
For arm binaries, llvm-objdump doesn't calculate relative branch target
address. Instead, it only shows offsets from current address. And users need to
calculate target address manually. Below is an example:
$ llvm-objdump -dlC --no-show-raw-insn --start-address=0x784
--stop-address=0x7d4 simpleperf_runtest_two_functions_arm
00000784 <main>:
; main():
...
7a4: movs r1, #0
; system/extras/simpleperf/runtest/two_functions.cpp:9
7a6: str.w r1, [r7, r0, lsl #2]
; system/extras/simpleperf/runtest/two_functions.cpp:8
7aa: adds r1, #1
7ac: cmp r6, r1
7ae: bne #-12 <main+0x22>
To know the branch target address of bne instruction in 0x7ae, we need to
calculate either 0x7ae + 4 - 12, or 0x784 + 0x22. But there is no directly show
of 0x7a6.
For comparison, binutils objdump for arm binaries shows branch target address
as below:
$ arm-linux-androideabi-objdump -dlC --no-show-raw-insn --start-address=0x784
--stop-address=0x7d4 simpleperf_runtest_two_functions_arm
00000784 <main>:
...
system/extras/simpleperf/runtest/two_functions.cpp:9
7a6: str.w r1, [r7, r0, lsl #2]
system/extras/simpleperf/runtest/two_functions.cpp:8
7aa: adds r1, #1
7ac: cmp r6, r1
7ae: bne.n 7a6 <main+0x22>
...
And llvm-objdump shows branch target address for binaries in other targets,
including arm64, x86, x86_64.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>