forked from OSchip/llvm-project
Not every x86 relocation is relative.
Without this predicate we were not producing R_386_RELATIVE relocations. llvm-svn: 264160
This commit is contained in:
parent
3a520349f1
commit
ffcad441fd
|
@ -85,6 +85,7 @@ public:
|
|||
void writePltZero(uint8_t *Buf) const override;
|
||||
void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr,
|
||||
int32_t Index, unsigned RelOff) const override;
|
||||
bool isRelRelative(uint32_t Type) const override;
|
||||
bool needsCopyRelImpl(uint32_t Type) const override;
|
||||
bool needsDynRelative(uint32_t Type) const override;
|
||||
bool needsGot(uint32_t Type, SymbolBody &S) const override;
|
||||
|
@ -396,6 +397,17 @@ X86TargetInfo::X86TargetInfo() {
|
|||
PltZeroSize = 16;
|
||||
}
|
||||
|
||||
bool X86TargetInfo::isRelRelative(uint32_t Type) const {
|
||||
switch (Type) {
|
||||
default:
|
||||
return false;
|
||||
case R_386_PC32:
|
||||
case R_386_PLT32:
|
||||
case R_386_TLS_LDO_32:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void X86TargetInfo::writeGotPltHeader(uint8_t *Buf) const {
|
||||
write32le(Buf, Out<ELF32LE>::Dynamic->getVA());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// REQUIRES: x86
|
||||
// RUN: llvm-mc -filetype=obj -triple=i386-pc-linux %s -o %t.o
|
||||
// RUN: ld.lld -shared %t.o -o %t.so
|
||||
// RUN: llvm-readobj -r %t.so | FileCheck %s
|
||||
|
||||
// CHECK: Relocations [
|
||||
// CHECK-NEXT: Section ({{.*}}) .rel.dyn {
|
||||
// CHECK-NEXT: R_386_RELATIVE - 0x0
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: ]
|
||||
|
||||
foo:
|
||||
.long foo
|
Loading…
Reference in New Issue