From: Rui Ueyama Date: Mon, 1 Apr 2019 00:25:17 +0000 (+0000) Subject: Simplify. NFC. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a77ea59c4d1bb926501ca598e1e15607b4fcec79;p=platform%2Fupstream%2Fllvm.git Simplify. NFC. llvm-svn: 357373 --- diff --git a/lld/ELF/Arch/X86.cpp b/lld/ELF/Arch/X86.cpp index ff35362..896d4fe 100644 --- a/lld/ELF/Arch/X86.cpp +++ b/lld/ELF/Arch/X86.cpp @@ -215,21 +215,21 @@ void X86::writePltHeader(uint8_t *Buf) const { 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@GOT(%ebx) - 0x68, 0, 0, 0, 0, // pushl $reloc_offset - 0xe9, 0, 0, 0, 0, // jmp .PLT0@PC - }; - memcpy(Buf, Inst, sizeof(Inst)); - if (Config->Pic) { - // jmp *foo@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@GOT(%ebx) + 0x68, 0, 0, 0, 0, // pushl $reloc_offset + 0xe9, 0, 0, 0, 0, // jmp .PLT0@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@GOT + 0x68, 0, 0, 0, 0, // pushl $reloc_offset + 0xe9, 0, 0, 0, 0, // jmp .PLT0@PC + }; + memcpy(Buf, Inst, sizeof(Inst)); write32le(Buf + 2, GotPltEntryAddr); }