Revise test to run llc and llvm-mc separately.
authorAndy Ayers <andya@microsoft.com>
Thu, 28 May 2015 21:49:50 +0000 (21:49 +0000)
committerAndy Ayers <andya@microsoft.com>
Thu, 28 May 2015 21:49:50 +0000 (21:49 +0000)
Differential Revision: http://reviews.llvm.org/D10066

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238508 91177308-0d34-0410-b5e6-96231b3b80d8

test/MC/COFF/cross-section-relative.ll
test/MC/COFF/cross-section-relative.s [new file with mode: 0644]

index 18823f8b29a1317ec87e3e59a723b46df17b3267..6b7a3d7b40b2f835724969b66476ef12ff1a2bab 100644 (file)
@@ -1,7 +1,5 @@
 ; Verify the assembler produces the expected expressions
 ; RUN: llc -mtriple=x86_64-pc-win32 %s -o - | FileCheck %s
-; Verify the .fix data section conveys the right offsets and the right relocations
-; RUN: llc -mtriple=x86_64-pc-win32 -filetype=obj %s -o - | llvm-readobj -relocations -expand-relocs -sections -section-data | FileCheck %s --check-prefix=READOBJ
 
 ;;;; some globals
 
         i64 256,
         i32 trunc(i64 sub(i64 ptrtoint(i32* @g3 to i64), i64 ptrtoint(i32* getelementptr inbounds (%struct.EEType, %struct.EEType* @t6, i32 0, i32 2) to i64)) to i32 )
 }, section ".fix"
-
-; READOBJ:  Section {
-; READOBJ:    Number: 5
-; READOBJ:    Name: .fix (2E 66 69 78 00 00 00 00)
-; READOBJ:    VirtualSize: 0x0
-; READOBJ:    VirtualAddress: 0x0
-; READOBJ:    RawDataSize: 56
-; READOBJ:    PointerToRawData: 0xEC
-; READOBJ:    PointerToRelocations: 0x124
-; READOBJ:    PointerToLineNumbers: 0x0
-; READOBJ:    RelocationCount: 6
-; READOBJ:    LineNumberCount: 0
-; READOBJ:    Characteristics [ (0xC0500040)
-; READOBJ:      IMAGE_SCN_ALIGN_16BYTES (0x500000)
-; READOBJ:      IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
-; READOBJ:      IMAGE_SCN_MEM_READ (0x40000000)
-; READOBJ:      IMAGE_SCN_MEM_WRITE (0x80000000)
-; READOBJ:    ]
-; READOBJ:    SectionData (
-; READOBJ:      0000: 10000000 00000000 0C000000 00000000  |................|
-; READOBJ:      0010: 08000000 00000000 0C000000 00000000  |................|
-; READOBJ:      0020: 01020000 00000000 00010000 00000000  |................|
-; READOBJ:      0030: 0C000000 00000000                    |........|
-; READOBJ:    )
-; READOBJ:  }
-; READOBJ:  ]
-; READOBJ:  Relocations [
-; READOBJ:  Section (5) .fix {
-; READOBJ:    Relocation {
-; READOBJ:      Offset: 0x0
-; READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
-; READOBJ:      Symbol: .rdata
-; READOBJ:    }
-; READOBJ:    Relocation {
-; READOBJ:      Offset: 0x8
-; READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
-; READOBJ:      Symbol: .rdata
-; READOBJ:    }
-; READOBJ:    Relocation {
-; READOBJ:      Offset: 0x10
-; READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
-; READOBJ:      Symbol: .rdata
-; READOBJ:    }
-; READOBJ:    Relocation {
-; READOBJ:      Offset: 0x18
-; READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
-; READOBJ:      Symbol: .rdata
-; READOBJ:    }
-; READOBJ:    Relocation {
-; READOBJ:      Offset: 0x1C
-; READOBJ:      Type: IMAGE_REL_AMD64_ADDR32NB (3)
-; READOBJ:      Symbol: g3
-; READOBJ:    }
-; READOBJ:    Relocation {
-; READOBJ:      Offset: 0x30
-; READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
-; READOBJ:      Symbol: .rdata
-; READOBJ:    }
diff --git a/test/MC/COFF/cross-section-relative.s b/test/MC/COFF/cross-section-relative.s
new file mode 100644 (file)
index 0000000..dd94b0a
--- /dev/null
@@ -0,0 +1,118 @@
+// Verify the .fix data section conveys the right offsets and the right relocations
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s -o - | llvm-readobj -relocations -expand-relocs -sections -section-data | FileCheck %s --check-prefix=READOBJ
+
+        .text
+       .section        .rdata,"dr"
+       .globl  g1                      # @g1
+       .align  4
+g1:
+       .long   1                       # 0x1
+
+       .globl  g2                      # @g2
+       .align  4
+g2:
+       .long   2                       # 0x2
+
+       .globl  g3                      # @g3
+       .align  4
+g3:
+       .long   3                       # 0x3
+
+       .globl  g4                      # @g4
+       .align  4
+g4:
+       .long   4                       # 0x4
+
+       .section        .fix,"dw"
+       .globl  t1                      # @t1
+       .align  8
+t1:
+       .quad   (g3-t1)+4
+
+       .globl  t2                      # @t2
+       .align  8
+t2:
+       .quad   g3-t2
+
+       .globl  t3                      # @t3
+       .align  8
+t3:
+       .quad   (g3-t3)-4
+
+       .globl  t4                      # @t4
+       .align  4
+t4:
+       .long   g3-t4
+
+       .globl  t5                      # @t5
+       .align  4
+t5:
+       .long   g3@IMGREL
+
+       .globl  t6                      # @t6
+       .align  16
+t6:
+       .ascii  "\001\002"
+       .zero   6
+       .quad   256                     # 0x100
+       .long   g3-(t6+16)
+       .zero   4
+
+
+// READOBJ:  Section {
+// READOBJ:    Number: 5
+// READOBJ:    Name: .fix (2E 66 69 78 00 00 00 00)
+// READOBJ:    VirtualSize: 0x0
+// READOBJ:    VirtualAddress: 0x0
+// READOBJ:    RawDataSize: 56
+// READOBJ:    PointerToRawData: 0xEC
+// READOBJ:    PointerToRelocations: 0x124
+// READOBJ:    PointerToLineNumbers: 0x0
+// READOBJ:    RelocationCount: 6
+// READOBJ:    LineNumberCount: 0
+// READOBJ:    Characteristics [ (0xC0500040)
+// READOBJ:      IMAGE_SCN_ALIGN_16BYTES (0x500000)
+// READOBJ:      IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+// READOBJ:      IMAGE_SCN_MEM_READ (0x40000000)
+// READOBJ:      IMAGE_SCN_MEM_WRITE (0x80000000)
+// READOBJ:    ]
+// READOBJ:    SectionData (
+// READOBJ:      0000: 10000000 00000000 0C000000 00000000  |................|
+// READOBJ:      0010: 08000000 00000000 0C000000 00000000  |................|
+// READOBJ:      0020: 01020000 00000000 00010000 00000000  |................|
+// READOBJ:      0030: 0C000000 00000000                    |........|
+// READOBJ:    )
+// READOBJ:  }
+// READOBJ:  ]
+// READOBJ:  Relocations [
+// READOBJ:  Section (5) .fix {
+// READOBJ:    Relocation {
+// READOBJ:      Offset: 0x0
+// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
+// READOBJ:      Symbol: .rdata
+// READOBJ:    }
+// READOBJ:    Relocation {
+// READOBJ:      Offset: 0x8
+// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
+// READOBJ:      Symbol: .rdata
+// READOBJ:    }
+// READOBJ:    Relocation {
+// READOBJ:      Offset: 0x10
+// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
+// READOBJ:      Symbol: .rdata
+// READOBJ:    }
+// READOBJ:    Relocation {
+// READOBJ:      Offset: 0x18
+// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
+// READOBJ:      Symbol: .rdata
+// READOBJ:    }
+// READOBJ:    Relocation {
+// READOBJ:      Offset: 0x1C
+// READOBJ:      Type: IMAGE_REL_AMD64_ADDR32NB (3)
+// READOBJ:      Symbol: g3
+// READOBJ:    }
+// READOBJ:    Relocation {
+// READOBJ:      Offset: 0x30
+// READOBJ:      Type: IMAGE_REL_AMD64_REL32 (4)
+// READOBJ:      Symbol: .rdata
+// READOBJ:    }