Index: lld/trunk/ELF/Relocations.cpp =================================================================== --- lld/trunk/ELF/Relocations.cpp +++ lld/trunk/ELF/Relocations.cpp @@ -360,9 +360,9 @@ // These expressions always compute a constant if (isRelExprOneOf(E)) + R_MIPS_TLSGD, R_GOT_PAGE_PC, R_GOT_PC, + R_GOTONLY_PC_FROM_END, R_PLT_PC, R_TLSGD_PC, R_TLSGD, + R_PPC_PLT_OPD, R_TLSDESC_CALL, R_TLSDESC_PAGE, R_HINT>(E)) return true; // These never do, except if the entire file is position dependent or if Index: lld/trunk/test/ELF/i386-gotpc-dynamic.s =================================================================== --- lld/trunk/test/ELF/i386-gotpc-dynamic.s +++ lld/trunk/test/ELF/i386-gotpc-dynamic.s @@ -0,0 +1,32 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o +# RUN: ld.lld %t.o -o %t.so -shared +# RUN: llvm-readobj -s %t.so | FileCheck %s +# RUN: llvm-objdump -d %t.so | FileCheck --check-prefix=DISASM %s + +# CHECK: Section { +# CHECK: Index: 7 +# CHECK-NEXT: Name: .got +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_WRITE +# CHECK-NEXT: ] +# CHECK-NEXT: Address: 0x2030 +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: } + +## 0x1000 + 4144 = 0x2030 +# DISASM: 1000: {{.*}} movl $4144, %eax + +.section .foo,"ax",@progbits +foo: + movl $bar@got-., %eax # R_386_GOTPC + +.local bar +bar: