[PATCH] D43952: [ELF][MIPS] Don't change every dynamic relocation into R_MIPS_REL32

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 09:41:45 PST 2018


arichardson updated this revision to Diff 136553.
arichardson added a comment.

Added the correct version of the test


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43952

Files:
  ELF/Arch/Mips.cpp
  test/ELF/mips-32.s
  test/ELF/mips-64.s
  test/ELF/mips-data-relocation-undef.s
  test/ELF/rel-addend-with-rela-input.s


Index: test/ELF/rel-addend-with-rela-input.s
===================================================================
--- test/ELF/rel-addend-with-rela-input.s
+++ test/ELF/rel-addend-with-rela-input.s
@@ -32,7 +32,7 @@
 #                                        ^--- Addend for relocation in .rel.dyn
 # RELA-TO-REL:     Relocations [
 # RELA-TO-REL-NEXT:  Section ({{.+}}) .rel.dyn {
-# RELA-TO-REL-NEXT:     0x10000 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE foo 0x0
+# RELA-TO-REL-NEXT:     0x10000 R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE foo 0x0
 # RELA-TO-REL-NEXT:  }
 # RELA-TO-REL-NEXT: ]
 
Index: test/ELF/mips-data-relocation-undef.s
===================================================================
--- /dev/null
+++ test/ELF/mips-data-relocation-undef.s
@@ -0,0 +1,22 @@
+# REQUIRES: mips
+# RUN: llvm-mc -triple=mips64-unknown-freebsd -filetype=obj %s -o %t.o
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-readobj -expand-relocs -r -t %t.so | FileCheck %s
+
+.global foo
+
+.data
+.global bar
+bar:
+  .quad foo
+.size bar, 8
+
+#CHECK-LABEL: Relocations [
+#CHECK-NEXT:  Section (7) .rel.dyn {
+#CHECK-NEXT:    Relocation {
+#CHECK-NEXT:      Offset: 0x10000
+#CHECK-NEXT:      Type: R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE (18)
+#CHECK-NEXT:      Symbol: foo
+#CHECK-NEXT:      Addend: 0x0
+#CHECK-NEXT:    }
+#CHECK-NEXT:  }
Index: test/ELF/mips-64.s
===================================================================
--- test/ELF/mips-64.s
+++ test/ELF/mips-64.s
@@ -32,7 +32,7 @@
 # CHECK:      Relocations [
 # CHECK-NEXT:   Section (7) .rel.dyn {
 # CHECK-NEXT:     0x20010 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE - 0x0
-# CHECK-NEXT:     0x20008 R_MIPS_REL32/R_MIPS_64/R_MIPS_NONE v2 0x0
+# CHECK-NEXT:     0x20008 R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE v2 0x0
 # CHECK-NEXT:   }
 # CHECK-NEXT: ]
 
Index: test/ELF/mips-32.s
===================================================================
--- test/ELF/mips-32.s
+++ test/ELF/mips-32.s
@@ -48,7 +48,7 @@
 # REL:      Relocations [
 # REL-NEXT:   Section (7) .rel.dyn {
 # REL-NEXT:     0x20008 R_MIPS_REL32 - 0x0
-# REL-NEXT:     0x20004 R_MIPS_REL32 v2 0x0
+# REL-NEXT:     0x20004 R_MIPS_32 v2 0x0
 # REL-NEXT:   }
 # REL-NEXT: ]
 
Index: ELF/Arch/Mips.cpp
===================================================================
--- ELF/Arch/Mips.cpp
+++ ELF/Arch/Mips.cpp
@@ -188,7 +188,8 @@
 }
 
 template <class ELFT> RelType MIPS<ELFT>::getDynRel(RelType Type) const {
-  return RelativeRel;
+  // TODO: are there any that need to change?
+  return Type;
 }
 
 template <class ELFT>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43952.136553.patch
Type: text/x-patch
Size: 2531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180301/e40acc39/attachment.bin>


More information about the llvm-commits mailing list