[lld] r357373 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 31 17:25:17 PDT 2019
Author: ruiu
Date: Sun Mar 31 17:25:17 2019
New Revision: 357373
URL: http://llvm.org/viewvc/llvm-project?rev=357373&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/Arch/X86.cpp
Modified: lld/trunk/ELF/Arch/X86.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/X86.cpp?rev=357373&r1=357372&r2=357373&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/X86.cpp (original)
+++ lld/trunk/ELF/Arch/X86.cpp Sun Mar 31 17:25:17 2019
@@ -215,21 +215,21 @@ void X86::writePltHeader(uint8_t *Buf) c
void X86::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr,
uint64_t PltEntryAddr, int32_t Index,
unsigned RelOff) const {
- const uint8_t Inst[] = {
- 0xff, 0x00, 0, 0, 0, 0, // jmp *foo_in_GOT or jmp *foo at GOT(%ebx)
- 0x68, 0, 0, 0, 0, // pushl $reloc_offset
- 0xe9, 0, 0, 0, 0, // jmp .PLT0 at PC
- };
- memcpy(Buf, Inst, sizeof(Inst));
-
if (Config->Pic) {
- // jmp *foo at GOT(%ebx)
- uint32_t Ebx = In.GotPlt->getVA();
- Buf[1] = 0xa3;
- write32le(Buf + 2, GotPltEntryAddr - Ebx);
+ const uint8_t Inst[] = {
+ 0xff, 0xa3, 0, 0, 0, 0, // jmp *foo at GOT(%ebx)
+ 0x68, 0, 0, 0, 0, // pushl $reloc_offset
+ 0xe9, 0, 0, 0, 0, // jmp .PLT0 at PC
+ };
+ memcpy(Buf, Inst, sizeof(Inst));
+ write32le(Buf + 2, GotPltEntryAddr - In.GotPlt->getVA());
} else {
- // jmp *foo_in_GOT
- Buf[1] = 0x25;
+ const uint8_t Inst[] = {
+ 0xff, 0x25, 0, 0, 0, 0, // jmp *foo at GOT
+ 0x68, 0, 0, 0, 0, // pushl $reloc_offset
+ 0xe9, 0, 0, 0, 0, // jmp .PLT0 at PC
+ };
+ memcpy(Buf, Inst, sizeof(Inst));
write32le(Buf + 2, GotPltEntryAddr);
}
More information about the llvm-commits
mailing list