forked from OSchip/llvm-project
parent
d10ca9deee
commit
a794fd44a1
|
@ -33,6 +33,9 @@ void InputSection<ELFT>::relocateOne(uint8_t *Buf, const Elf_Rel &Rel,
|
|||
uint8_t *Location = Buf + Offset;
|
||||
uint32_t Addend = *(support::ulittle32_t *)Location;
|
||||
switch (Type) {
|
||||
case R_386_PC32:
|
||||
support::endian::write32le(Location, SymVA + Addend - (BaseAddr + Offset));
|
||||
break;
|
||||
case R_386_32:
|
||||
support::endian::write32le(Location, SymVA + Addend);
|
||||
break;
|
||||
|
|
|
@ -11,6 +11,24 @@ _start:
|
|||
R_386_32:
|
||||
movl $R_386_32 + 1, %edx
|
||||
|
||||
|
||||
.section .R_386_PC32,"ax",@progbits,unique,1
|
||||
.global R_386_PC32
|
||||
R_386_PC32:
|
||||
call R_386_PC32_2
|
||||
|
||||
.section .R_386_PC32,"ax",@progbits,unique,2
|
||||
.zero 4
|
||||
R_386_PC32_2:
|
||||
nop
|
||||
|
||||
// CHECK: Disassembly of section .R_386_32:
|
||||
// CHECK-NEXT: R_386_32:
|
||||
// CHECK-NEXT: 11000: {{.*}} movl $69633, %edx
|
||||
|
||||
// CHECK: Disassembly of section .R_386_PC32:
|
||||
// CHECK-NEXT: R_386_PC32:
|
||||
// CHECK-NEXT: 11005: e8 04 00 00 00 calll 4
|
||||
|
||||
// CHECK: R_386_PC32_2:
|
||||
// CHECK-NEXT: 1100e: 90 nop
|
||||
|
|
Loading…
Reference in New Issue