<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 - --gc-sections remove relocations from --emit-relocs"
href="https://bugs.llvm.org/show_bug.cgi?id=34836">34836</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>--gc-sections remove relocations from --emit-relocs
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>thgarnie@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, phosek@chromium.org
</td>
</tr></table>
<p>
<div>
<pre>This bug is related to Zircon/Magenta kernel where --gc-sections is used and we
would like to use --emit-relocs to generate relocations to analyze and filter.
When using --gc-sections and --emit-relocs together, all the relocations
sections are always stripped being on the small assembly I pasted below or the
Zircon kernel. Using the binutils linker, these sections are not stripped.
Output from lld with --gc-sections + --emit-relocs and --print-gc-sections:
GCC / LLD ---
removing unused section from '.rela.text' in file './test_gcc.o'
removing unused section from '.data' in file './test_gcc.o'
removing unused section from '.bss' in file './test_gcc.o'
removing unused section from '.rela.debug_line' in file './test_gcc.o'
removing unused section from '.rela.debug_info' in file './test_gcc.o'
removing unused section from '.rela.debug_aranges' in file './test_gcc.o'
readelf -r: There are no relocations in this file.
CLANG / LLD ---
removing unused section from '.rela.text' in file './test_clang.o'
removing unused section from '.rela.debug_info' in file './test_clang.o'
removing unused section from '.rela.debug_aranges' in file './test_clang.o'
removing unused section from '.rela.debug_line' in file './test_clang.o'
readelf -r: There are no relocations in this file.
The symbol assembly file I used to test:
.global _start
.text
relocs:
.quad _start
_start:
movabs $relocs, %rax
ret
---</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>