Index: ELF/Arch/X86_64.cpp =================================================================== --- ELF/Arch/X86_64.cpp +++ ELF/Arch/X86_64.cpp @@ -156,7 +156,7 @@ } template bool X86_64::isPicRel(RelType Type) const { - return Type != R_X86_64_PC32 && Type != R_X86_64_32 && + return Type != R_X86_64_PC32 && Type != R_X86_64_32 && Type != R_X86_64_32S && Type != R_X86_64_TPOFF32; } Index: test/ELF/Inputs/x86-64-reloc-32s-input.s =================================================================== --- /dev/null +++ test/ELF/Inputs/x86-64-reloc-32s-input.s @@ -0,0 +1,5 @@ +.globl foo +.type foo,@object +.size foo, 8 +foo: + .quad 0x12 Index: test/ELF/x86-64-reloc-32s.s =================================================================== --- /dev/null +++ test/ELF/x86-64-reloc-32s.s @@ -0,0 +1,23 @@ +// REQUIRES: x86 +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc--linux %p/Inputs/x86-64-reloc-32s-input.s -o %t2.o +// RUN: ld.lld -shared %t2.o -o %t2.so +// RUN: ld.lld -e main -z notext %t.o %t2.so -o %t3.out +// RUN: llvm-readobj -r %t3.out | FileCheck %s + +.data +.long foo +.type foo,@object +.size foo, 8 + +.text +.globl main +.type main, @function +main: + movq foo, %rax + +// CHECK: Relocations [ +// CHECK-NEXT: Section ({{.*}}) .rela.dyn { +// CHECK-NEXT: R_X86_64_COPY foo 0x0 +// CHECK-NEXT: } +// CHECK-NEXT: ]