summaryrefslogtreecommitdiff
path: root/gnu/llvm
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2023-05-30 02:02:01 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2023-05-30 02:02:01 +0000
commit1a1e7a2bf062d6af7dc260aff62752c125df6b04 (patch)
tree2fa537e007f159677856181e60a7dccb8e2a9a2d /gnu/llvm
parent669d37e71ec6ede0c7acd436e53b2cb601bae900 (diff)
Add IBT support to the retpoline+znow PLTs
ok kettenis@
Diffstat (limited to 'gnu/llvm')
-rw-r--r--gnu/llvm/lld/ELF/Arch/X86_64.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/gnu/llvm/lld/ELF/Arch/X86_64.cpp b/gnu/llvm/lld/ELF/Arch/X86_64.cpp
index 271558c6599..0ecdfe5f1a5 100644
--- a/gnu/llvm/lld/ELF/Arch/X86_64.cpp
+++ b/gnu/llvm/lld/ELF/Arch/X86_64.cpp
@@ -1122,14 +1122,14 @@ void RetpolineZNow::writePltHeader(uint8_t *buf) const {
void RetpolineZNow::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const {
const uint8_t insn[] = {
- 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // mov foo@GOTPLT(%rip), %r11
- 0xe9, 0, 0, 0, 0, // jmp plt+0
- 0xcc, 0xcc, 0xcc, 0xcc, // int3; padding
+ 0xf3, 0x0f, 0x1e, 0xfa, // 0: endbr64
+ 0x4c, 0x8b, 0x1d, 0, 0, 0, 0, // 4: mov foo@GOTPLT(%rip), %r11
+ 0xe9, 0, 0, 0, 0, // b: jmp plt+0
};
memcpy(buf, insn, sizeof(insn));
- write32le(buf + 3, sym.getGotPltVA() - pltEntryAddr - 7);
- write32le(buf + 8, in.plt->getVA() - pltEntryAddr - 12);
+ write32le(buf + 7, sym.getGotPltVA() - pltEntryAddr - 11);
+ write32le(buf + 12, in.plt->getVA() - pltEntryAddr - 16);
}
static TargetInfo *getTargetInfo() {