[PATCH] D33717: [ELF] - Properly handle R_386_GOTPC relocation.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 00:54:30 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304393: [ELF] - Properly handle R_386_GOTPC relocation. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D33717?vs=100844&id=100975#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33717
Files:
lld/trunk/ELF/Relocations.cpp
lld/trunk/test/ELF/i386-gotpc-dynamic.s
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", at progbits
+foo:
+ movl $bar at got-., %eax # R_386_GOTPC
+
+.local bar
+bar:
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<R_SIZE, R_GOT_FROM_END, R_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE,
R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC,
- R_MIPS_TLSGD, R_GOT_PAGE_PC, R_GOT_PC, R_PLT_PC,
- R_TLSGD_PC, R_TLSGD, R_PPC_PLT_OPD, R_TLSDESC_CALL,
- R_TLSDESC_PAGE, R_HINT>(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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33717.100975.patch
Type: text/x-patch
Size: 1948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170601/8f999ecc/attachment.bin>
More information about the llvm-commits
mailing list