[lld] r206019 - [Mips] Rewrite R_MIPS_32 handling test using the yaml2obj tool.

Simon Atanasyan simon at atanasyan.com
Thu Apr 10 21:43:59 PDT 2014


Author: atanasyan
Date: Thu Apr 10 23:43:59 2014
New Revision: 206019

URL: http://llvm.org/viewvc/llvm-project?rev=206019&view=rev
Log:
[Mips] Rewrite R_MIPS_32 handling test using the yaml2obj tool.

Added:
    lld/trunk/test/elf/Mips/rel-32.test
Removed:
    lld/trunk/test/elf/Mips/mips32.test

Removed: lld/trunk/test/elf/Mips/mips32.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/mips32.test?rev=206018&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/mips32.test (original)
+++ lld/trunk/test/elf/Mips/mips32.test (removed)
@@ -1,21 +0,0 @@
-# Check handling R_MIPS_32 relocation.
-#
-# RUN: llvm-mc -triple=mipsel -filetype=obj -o=%t-obj %s
-# RUN: lld -flavor gnu -target mipsel -o %t-exe %t-obj
-# RUN: llvm-objdump -s %t-exe | FileCheck %s
-
-# CHECK: Contents of section .data:
-# CHECK-NEXT: 422000 28014000 2c014200 (. at .,.B.
-
-    .global __start
-    .ent    __start
-__start:
-    nop
-    .space 0x20000
-la:
-    nop
-    .end    __start
-
-    .data
-    .4byte __start
-    .4byte la

Added: lld/trunk/test/elf/Mips/rel-32.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/Mips/rel-32.test?rev=206019&view=auto
==============================================================================
--- lld/trunk/test/elf/Mips/rel-32.test (added)
+++ lld/trunk/test/elf/Mips/rel-32.test Thu Apr 10 23:43:59 2014
@@ -0,0 +1,58 @@
+# Check handling of R_MIPS_32 relocation.
+# RUN: yaml2obj -format=elf %s > %t-obj
+# RUN: lld -flavor gnu -target mipsel -o %t-exe %t-obj
+# RUN: llvm-objdump -s -t %t-exe | FileCheck %s
+
+# CHECK: Contents of section .data:
+# CHECK-NEXT: 402000 00000000 09204080 05204080  ..... @.. @.
+#                             ^^ data2 + 0x80000001 = 0x80402009
+#                                      ^^ data1 + 0x80000001 = 0x80402005
+# CHECK: SYMBOL TABLE:
+# CHECK: 00402004 g  .data  00000004 data1
+# CHECK: 00402008 g  .data  00000004 data2
+
+!ELF
+FileHeader: !FileHeader
+  Class: ELFCLASS32
+  Data: ELFDATA2LSB
+  Type: ET_REL
+  Machine: EM_MIPS
+
+Sections:
+- Name: .text
+  Type: SHT_PROGBITS
+  Content: "00000000"
+  AddressAlign: 16
+  Flags: [SHF_ALLOC]
+- Name: .data
+  Type: SHT_PROGBITS
+  Content: "000000000100008001000080"
+  AddressAlign: 16
+  Flags: [SHF_ALLOC, SHF_WRITE]
+
+- Name: .rel.data
+  Type: SHT_REL
+  Info: .data
+  AddressAlign: 4
+  Relocations:
+    - Offset: 0x4
+      Symbol: data2
+      Type: R_MIPS_32
+    - Offset: 0x8
+      Symbol: data1
+      Type: R_MIPS_32
+
+Symbols:
+  Global:
+    - Name: __start
+      Section: .text
+      Value: 0x0
+      Size: 4
+    - Name: data1
+      Section: .data
+      Value: 0x4
+      Size: 4
+    - Name: data2
+      Section: .data
+      Value: 0x8
+      Size: 4





More information about the llvm-commits mailing list