[lld] r336201 - [ELF][MIPS] Use llvm-mc to generate test case input file. NFC

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 3 07:39:27 PDT 2018


Author: atanasyan
Date: Tue Jul  3 07:39:27 2018
New Revision: 336201

URL: http://llvm.org/viewvc/llvm-project?rev=336201&view=rev
Log:
[ELF][MIPS] Use llvm-mc to generate test case input file. NFC

Removed:
    lld/trunk/test/ELF/Inputs/mips-n32-rels.o
Modified:
    lld/trunk/test/ELF/mips-n32-rels.s

Removed: lld/trunk/test/ELF/Inputs/mips-n32-rels.o
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/mips-n32-rels.o?rev=336200&view=auto
==============================================================================
Binary files lld/trunk/test/ELF/Inputs/mips-n32-rels.o (original) and lld/trunk/test/ELF/Inputs/mips-n32-rels.o (removed) differ

Modified: lld/trunk/test/ELF/mips-n32-rels.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/mips-n32-rels.s?rev=336201&r1=336200&r2=336201&view=diff
==============================================================================
--- lld/trunk/test/ELF/mips-n32-rels.s (original)
+++ lld/trunk/test/ELF/mips-n32-rels.s Tue Jul  3 07:39:27 2018
@@ -1,28 +1,27 @@
 # REQUIRES: mips
 # Check handling of N32 ABI relocation records.
 
-# For now llvm-mc generates incorrect object files for N32 ABI.
-# We use the binary input file generated by GNU tool.
-# llvm-mc -filetype=obj -triple=mips64-unknown-linux \
-#         -target-abi n32 %s -o %t.o
-# RUN: ld.lld %S/Inputs/mips-n32-rels.o -o %t.exe
+# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \
+# RUN:         -target-abi n32 -o %t.o %s
+# RUN: ld.lld %t.o -o %t.exe
 # RUN: llvm-objdump -t -d -s %t.exe | FileCheck %s
 # RUN: llvm-readobj -h %t.exe | FileCheck -check-prefix=ELF %s
 
-#   .text
-#   .type   __start, @function
-#   .global  __start
-# __start:
-#   lui     $gp,%hi(%neg(%gp_rel(__start)))     # R_MIPS_GPREL16
-#                                               # R_MIPS_SUB
-#                                               # R_MIPS_HI16
-# loc:
-#   daddiu  $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
-#                                               # R_MIPS_SUB
-#                                               # R_MIPS_LO16
-#
-#   .section  .rodata,"a", at progbits
-#   .gpword(loc)                                # R_MIPS_32
+  .option pic2
+  .text
+  .type   __start, @function
+  .global  __start
+__start:
+  lui     $gp,%hi(%neg(%gp_rel(__start)))     # R_MIPS_GPREL16
+                                              # R_MIPS_SUB
+                                              # R_MIPS_HI16
+loc:
+  daddiu  $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16
+                                              # R_MIPS_SUB
+                                              # R_MIPS_LO16
+
+  .section  .rodata,"a", at progbits
+  .gpword(loc)                                # R_MIPS_GPREL32
 
 # CHECK:      Disassembly of section .text:
 # CHECK-NEXT: __start:
@@ -37,8 +36,8 @@
 #                                                       ^-- %lo(0x17ff0)
 
 # CHECK:      Contents of section .rodata:
-# CHECK-NEXT:  {{[0-9a-f]+}} 00020004
-#                            ^-- loc
+# CHECK-NEXT:  {{[0-9a-f]+}} fffe8014
+#                            ^-- loc - _gp
 
 # CHECK: 00020004      .text   00000000 loc
 # CHECK: 00037ff0      .got    00000000 .hidden _gp
@@ -66,5 +65,7 @@
 # ELF-NEXT:   SectionHeaderOffset:
 # ELF-NEXT:   Flags [
 # ELF-NEXT:     EF_MIPS_ABI2
-# ELF-NEXT:     EF_MIPS_ARCH_64R2
+# ELF-NEXT:     EF_MIPS_ARCH_64
+# ELF-NEXT:     EF_MIPS_CPIC
+# ELF-NEXT:     EF_MIPS_PIC
 # ELF-NEXT:   ]




More information about the llvm-commits mailing list