[llvm-bugs] [Bug 39711] New: Broken PLT in statically linked binary with -z now -z retpolineplt
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 19 12:17:16 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=39711
Bug ID: 39711
Summary: Broken PLT in statically linked binary with -z now -z
retpolineplt
Product: lld
Version: unspecified
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: emaste at freebsd.org
CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org
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: https://people.freebsd.org/~emaste/lld/hello.tar.xz
See also FreeBSD PR 233336 https://bugs.freebsd.org/233336
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181119/956e26b8/attachment.html>
More information about the llvm-bugs
mailing list