<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 - -d/-r/-j should not require relocation sections be specified with -j"
href="https://bugs.llvm.org/show_bug.cgi?id=41886">41886</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-d/-r/-j should not require relocation sections be specified with -j
</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>Windows NT
</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>jh7370.2008@my.bristol.ac.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>llvm-objdump -d -r prints relocations inline with the disassembly as follows:
C:\> llvm-objdump -d -r test.o
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
0000000000000401: R_X86_64_PC32 foo+1
0000000000000401: R_X86_64_GOT32 foo
Disassembly of section .text2:
0000000000000401 .text2:
401: 90 nop
402: e8 00 00 00 00 callq 0 <.text2+0x6>
0000000000000402: R_X86_64_PLT32 foo+2
This is the same behaviour as GNU objdump. However, if you apply --section, the
behaviour differs. --section for GNU objdump reduces the disassembly down to
the listed sections, and prints all the relocations for those sections (note,
the below output is approximate, and not exactly what GNU objdump prints, but
is used for illustration purposes):
C:\> objdump -d -r test.o --section .text
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
0000000000000401: R_X86_64_PC32 foo+1 //from .rela.text
0000000000000401: R_X86_64_GOT32 foo //from
.rela2.text
llvm-objdump only prints the relocations that come from the listed relocations:
C:\> llvm-objdump -d -r test.o --section .text
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
// No relocations printed
C:\> llvm-objdump -d -r test.o --section .text --rela.text
Disassembly of section .text:
0000000000000400 .text:
400: e8 00 00 00 00 callq 0 <.text+0x5>
0000000000000401: R_X86_64_PC32 foo+1 //from .rela.text
Intuitively, I didn't expect llvm-objdump to behave the way it does, even
without coming from a GNU background. The behaviour is subtle and could easily
break users. I think we should change the behaviour to match GNU and always
print the relocations for the sections that are disassembled, not just the
filtered set of relocations.</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>