Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -56,7 +56,14 @@ } bool X86TargetInfo::relocNeedsPlt(uint32_t Type, const SymbolBody &S) const { - return Type == R_386_PLT32; + switch (Type) { + default: + return false; + case R_386_PC32: + return S.isShared(); + case R_386_PLT32: + return true; + } } static void add32le(uint8_t *L, int32_t V) { write32le(L, read32le(L) + V); } Index: test/elf2/relocation-i686.s =================================================================== --- test/elf2/relocation-i686.s +++ test/elf2/relocation-i686.s @@ -62,7 +62,7 @@ call bar+4 // CHECK: Disassembly of section .dynamic_reloc: // CHECK-NEXT: .dynamic_reloc: -// CHECK-NEXT: 12019: e8 00 00 00 00 calll 0 +// CHECK-NEXT: 12019: e8 16 00 00 00 calll 22 .section .R_386_GOT32,"ax",@progbits .global R_386_GOT32