<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 - Relocation records printed in the wrong format"
href="https://bugs.llvm.org/show_bug.cgi?id=41355">41355</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Relocation records printed in the wrong format
</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>enhancement
</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>rupprecht@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>llvm-objdump (for ELF files at least) prints relocation records *in* a section,
however, it prints them as being "for" a section. This breaks GNU objdump
compatibility, and I think it may be slightly wrong.
Take for example the test file generated by
llvm/test/tools/llvm-objdump/relocations-elf.test:
$ llvm-readelf -r test/tools/llvm-objdump/Output/relocations-elf.test.tmp
Relocation section '.rel.text' at offset 0x208 contains 3 entries:
Offset Info Type Symbol's Value
Symbol's Name
0000000000000001 000000030000000a R_X86_64_32 0000000000000000
glob1
0000000000000001 000000040000000b R_X86_64_32S 0000000000000000
glob2
0000000000000002 0000000100000001 R_X86_64_64 0000000000000000 loc1
Relocation section '.rela.text' at offset 0x238 contains 3 entries:
Offset Info Type Symbol's Value
Symbol's Name + Addend
0000000000000001 000000030000000a R_X86_64_32 0000000000000000
glob1 + 1
0000000000000001 000000040000000b R_X86_64_32S 0000000000000000
glob2 + 2
0000000000000002 0000000100000001 R_X86_64_64 0000000000000000 loc1
+ 3
The file contains relocations for .text in both .rel.text and .rela.text. (GNU
readelf matches this output, modulo minor syntax tweaks)
llvm-objdump lists them in a similar way:
$ llvm-objdump -r test/tools/llvm-objdump/Output/relocations-elf.test.tmp
test/tools/llvm-objdump/Output/relocations-elf.test.tmp: file format
ELF64-x86-64
RELOCATION RECORDS FOR [.rel.text]:
0000000000000001 R_X86_64_32 glob1
0000000000000001 R_X86_64_32S glob2
0000000000000002 R_X86_64_64 loc1
RELOCATION RECORDS FOR [.rela.text]:
0000000000000001 R_X86_64_32 glob1+1
0000000000000001 R_X86_64_32S glob2+2
0000000000000002 R_X86_64_64 loc1+3
GNU objdump puts them all together:
$ objdump -r test/tools/llvm-objdump/Output/relocations-elf.test.tmp
test/tools/llvm-objdump/Output/relocations-elf.test.tmp: file format
elf64-x86-64
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000001 R_X86_64_32 glob1
0000000000000001 R_X86_64_32S glob2
0000000000000002 R_X86_64_64 loc1
0000000000000001 R_X86_64_32 glob1+0x0000000000000001
0000000000000001 R_X86_64_32S glob2+0x0000000000000002
0000000000000002 R_X86_64_64 loc1+0x0000000000000003
I think we should either:
* Put all the relocations for a given section together, and list the section
name as what it's a relocation for (i.e. match GNU)
* Changing the wording to "in" instead of "for", e.g. "relocation records in
[.rel.text]"</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>