[PATCH] D44993: Do not create R_X86_64_32S in dyna relo tbl

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 2 09:52:51 PDT 2018


shenhan updated this revision to Diff 140641.
shenhan marked an inline comment as done.
shenhan added a comment.

clang-format the changed lines in X86_64.cpp


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D44993

Files:
  ELF/Arch/X86_64.cpp
  test/ELF/Inputs/x86-64-reloc-32s-input.s
  test/ELF/x86-64-reloc-32s.s


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, at 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:  ]
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, at object
+.size foo, 8
+foo:
+	.quad 0x12
Index: ELF/Arch/X86_64.cpp
===================================================================
--- ELF/Arch/X86_64.cpp
+++ ELF/Arch/X86_64.cpp
@@ -156,7 +156,7 @@
 }
 
 template <class ELFT> bool X86_64<ELFT>::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;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44993.140641.patch
Type: text/x-patch
Size: 1466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180402/8d48be57/attachment.bin>


More information about the llvm-commits mailing list