@@ -203,22 +203,22 @@ void X86::writePltHeader(uint8_t *buf) const {
203
203
0x90 , 0x90 , 0x90 , 0x90 , // nop
204
204
};
205
205
memcpy (buf, pltData, sizeof (pltData));
206
- uint32_t gotPlt = in.gotPlt ->getVA ();
206
+ uint32_t gotPlt = ctx. in .gotPlt ->getVA ();
207
207
write32le (buf + 2 , gotPlt + 4 );
208
208
write32le (buf + 8 , gotPlt + 8 );
209
209
}
210
210
211
211
void X86::writePlt (uint8_t *buf, const Symbol &sym,
212
212
uint64_t pltEntryAddr) const {
213
- unsigned relOff = in.relaPlt ->entsize * sym.getPltIdx ();
213
+ unsigned relOff = ctx. in .relaPlt ->entsize * sym.getPltIdx ();
214
214
if (config->isPic ) {
215
215
const uint8_t inst[] = {
216
216
0xff , 0xa3 , 0 , 0 , 0 , 0 , // jmp *foo@GOT(%ebx)
217
217
0x68 , 0 , 0 , 0 , 0 , // pushl $reloc_offset
218
218
0xe9 , 0 , 0 , 0 , 0 , // jmp .PLT0@PC
219
219
};
220
220
memcpy (buf, inst, sizeof (inst));
221
- write32le (buf + 2 , sym.getGotPltVA () - in.gotPlt ->getVA ());
221
+ write32le (buf + 2 , sym.getGotPltVA () - ctx. in .gotPlt ->getVA ());
222
222
} else {
223
223
const uint8_t inst[] = {
224
224
0xff , 0x25 , 0 , 0 , 0 , 0 , // jmp *foo@GOT
@@ -230,7 +230,7 @@ void X86::writePlt(uint8_t *buf, const Symbol &sym,
230
230
}
231
231
232
232
write32le (buf + 7 , relOff);
233
- write32le (buf + 12 , in.plt ->getVA () - pltEntryAddr - 16 );
233
+ write32le (buf + 12 , ctx. in .plt ->getVA () - pltEntryAddr - 16 );
234
234
}
235
235
236
236
int64_t X86::getImplicitAddend (const uint8_t *buf, RelType type) const {
@@ -532,7 +532,7 @@ IntelIBT::IntelIBT() { pltHeaderSize = 0; }
532
532
533
533
void IntelIBT::writeGotPlt (uint8_t *buf, const Symbol &s) const {
534
534
uint64_t va =
535
- in.ibtPlt ->getVA () + IBTPltHeaderSize + s.getPltIdx () * pltEntrySize;
535
+ ctx. in .ibtPlt ->getVA () + IBTPltHeaderSize + s.getPltIdx () * pltEntrySize;
536
536
write32le (buf, va);
537
537
}
538
538
@@ -545,7 +545,7 @@ void IntelIBT::writePlt(uint8_t *buf, const Symbol &sym,
545
545
0x66 , 0x0f , 0x1f , 0x44 , 0 , 0 , // nop
546
546
};
547
547
memcpy (buf, inst, sizeof (inst));
548
- write32le (buf + 6 , sym.getGotPltVA () - in.gotPlt ->getVA ());
548
+ write32le (buf + 6 , sym.getGotPltVA () - ctx. in .gotPlt ->getVA ());
549
549
return ;
550
550
}
551
551
@@ -630,7 +630,7 @@ void RetpolinePic::writePltHeader(uint8_t *buf) const {
630
630
631
631
void RetpolinePic::writePlt (uint8_t *buf, const Symbol &sym,
632
632
uint64_t pltEntryAddr) const {
633
- unsigned relOff = in.relaPlt ->entsize * sym.getPltIdx ();
633
+ unsigned relOff = ctx. in .relaPlt ->entsize * sym.getPltIdx ();
634
634
const uint8_t insn[] = {
635
635
0x50 , // pushl %eax
636
636
0x8b , 0x83 , 0 , 0 , 0 , 0 , // mov foo@GOT(%ebx), %eax
@@ -642,8 +642,8 @@ void RetpolinePic::writePlt(uint8_t *buf, const Symbol &sym,
642
642
};
643
643
memcpy (buf, insn, sizeof (insn));
644
644
645
- uint32_t ebx = in.gotPlt ->getVA ();
646
- unsigned off = pltEntryAddr - in.plt ->getVA ();
645
+ uint32_t ebx = ctx. in .gotPlt ->getVA ();
646
+ unsigned off = pltEntryAddr - ctx. in .plt ->getVA ();
647
647
write32le (buf + 3 , sym.getGotPltVA () - ebx);
648
648
write32le (buf + 8 , -off - 12 + 32 );
649
649
write32le (buf + 13 , -off - 17 + 18 );
@@ -682,14 +682,14 @@ void RetpolineNoPic::writePltHeader(uint8_t *buf) const {
682
682
};
683
683
memcpy (buf, insn, sizeof (insn));
684
684
685
- uint32_t gotPlt = in.gotPlt ->getVA ();
685
+ uint32_t gotPlt = ctx. in .gotPlt ->getVA ();
686
686
write32le (buf + 2 , gotPlt + 4 );
687
687
write32le (buf + 8 , gotPlt + 8 );
688
688
}
689
689
690
690
void RetpolineNoPic::writePlt (uint8_t *buf, const Symbol &sym,
691
691
uint64_t pltEntryAddr) const {
692
- unsigned relOff = in.relaPlt ->entsize * sym.getPltIdx ();
692
+ unsigned relOff = ctx. in .relaPlt ->entsize * sym.getPltIdx ();
693
693
const uint8_t insn[] = {
694
694
0x50 , // 0: pushl %eax
695
695
0xa1 , 0 , 0 , 0 , 0 , // 1: mov foo_in_GOT, %eax
@@ -702,7 +702,7 @@ void RetpolineNoPic::writePlt(uint8_t *buf, const Symbol &sym,
702
702
};
703
703
memcpy (buf, insn, sizeof (insn));
704
704
705
- unsigned off = pltEntryAddr - in.plt ->getVA ();
705
+ unsigned off = pltEntryAddr - ctx. in .plt ->getVA ();
706
706
write32le (buf + 2 , sym.getGotPltVA ());
707
707
write32le (buf + 7 , -off - 11 + 32 );
708
708
write32le (buf + 12 , -off - 16 + 17 );
0 commit comments