// True if this expression is of the form Sym - X, where X is a position in the
// file (PC, or GOT for example).
static bool isRelExpr(RelExpr Expr) {
- return Expr == R_PC || Expr == R_GOTREL || Expr == R_PAGE_PC ||
- Expr == R_RELAX_GOT_PC || Expr == R_THUNK_PC || Expr == R_THUNK_PLT_PC;
+ return Expr == R_PC || Expr == R_GOTREL || Expr == R_GOTREL_FROM_END ||
+ Expr == R_PAGE_PC || Expr == R_RELAX_GOT_PC || Expr == R_THUNK_PC ||
+ Expr == R_THUNK_PLT_PC;
}
template <class ELFT>
--- /dev/null
+// 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
+
+bar:
+ movl bar@GOTOFF(%ebx), %eax
+ mov bar@GOT, %eax
+
+// CHECK: Name: .got
+// CHECK-NEXT: Type: SHT_PROGBITS
+// CHECK-NEXT: Flags [
+// CHECK-NEXT: SHF_ALLOC
+// CHECK-NEXT: SHF_WRITE
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x2050
+// CHECK-NEXT: Offset: 0x2050
+// CHECK-NEXT: Size: 4
+
+// 0x1000 - (0x2050 + 4) = -4180
+
+// DISASM: 1000: {{.*}} movl -4180(%ebx), %eax