<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 - Broken PLT in statically linked binary with -z now -z retpolineplt"
href="https://bugs.llvm.org/show_bug.cgi?id=39711">39711</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Broken PLT in statically linked binary with -z now -z retpolineplt
</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>FreeBSD
</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>ELF
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>emaste@freebsd.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>Hello world test code:
% cat hello.c
#include <stdio.h>
int main(int argc, char *argv[]) { printf("Hi\n"); }
lld version:
% ld.lld --version
LLD 6.0.1 (FreeBSD 335540-1200005) (compatible with GNU linkers)
Build test application:
% LLD_REPRODUCE=hello.tar cc -g -static -Wl,-zretpolineplt,-znow hello.c -o
hello.static-retpoline-now
Application segfaults:
% ./hello.static-retpoline-now
zsh: illegal hardware instruction (core dumped) ./hello.static-retpoline-now
We have a PLT entry that jumps to an invalid location:
% objdump -S -section=.plt hello.static-retpoline-now
hello.static-retpoline-now: file format ELF64-x86-64
Disassembly of section .plt:
.plt:
2a0890: 4c 8b 1d a9 5f 00 00 movq 24489(%rip), %r11
2a0897: e9 d4 ff ff ff jmp -44 <_init+0x8>
2a089c: cc int3
2a089d: cc int3
2a089e: cc int3
2a089f: cc int3
Note that there is a .plt entry here, but no PLT header.
Reproducer: <a href="https://people.freebsd.org/~emaste/lld/hello.tar.xz">https://people.freebsd.org/~emaste/lld/hello.tar.xz</a>
See also FreeBSD PR 233336 <a href="https://bugs.freebsd.org/233336">https://bugs.freebsd.org/233336</a></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>