Index: lld/trunk/ELF/Arch/X86_64.cpp =================================================================== --- lld/trunk/ELF/Arch/X86_64.cpp +++ lld/trunk/ELF/Arch/X86_64.cpp @@ -105,6 +105,8 @@ case R_X86_64_REX_GOTPCRELX: case R_X86_64_GOTTPOFF: return R_GOT_PC; + case R_X86_64_GOTOFF64: + return R_GOTREL; case R_X86_64_GOTPC32: case R_X86_64_GOTPC64: return R_GOTONLY_PC_FROM_END; @@ -323,6 +325,7 @@ case R_X86_64_PC64: case R_X86_64_SIZE64: case R_X86_64_GOT64: + case R_X86_64_GOTOFF64: case R_X86_64_GOTPC64: write64le(Loc, Val); break; Index: lld/trunk/test/ELF/x86-64-reloc-gotoff64.s =================================================================== --- lld/trunk/test/ELF/x86-64-reloc-gotoff64.s +++ lld/trunk/test/ELF/x86-64-reloc-gotoff64.s @@ -0,0 +1,17 @@ +// REQUIRES: x86 + +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: ld.lld -shared -o %t.so %t.o +// RUN: llvm-readelf -sections %t.so | FileCheck %s +// RUN: llvm-objdump -d %t.so | FileCheck -check-prefix=DISASM %s + +// CHECK: .dynamic DYNAMIC 0000000000002000 002000 +// CHECK: .got PROGBITS 0000000000002070 002070 + +// DISASM: 1000: 48 ba 90 ff ff ff ff ff ff ff movabsq $-112, %rdx + +.global _start +.weak _DYNAMIC +.hidden _DYNAMIC +_start: + movabsq $_DYNAMIC@GOTOFF, %rdx