diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2013-06-10 20:36:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2013-06-10 20:36:52 +0000 |
commit | 59d6cff90eecf31cb3dd860c4e786674cfdd42eb (patch) | |
tree | 909310b2e05119d1d6efda049977042abbb58bb1 /test/MC/COFF | |
parent | 4a16efa3e43e35f0cc9efe3a67f620f0017c3d36 (diff) | |
download | src-59d6cff90eecf31cb3dd860c4e786674cfdd42eb.tar.gz src-59d6cff90eecf31cb3dd860c4e786674cfdd42eb.zip |
Vendor import of llvm tags/RELEASE_33/final r183502 (effectively, 3.3vendor/llvm/llvm-release_33-r183502
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=251607
svn path=/vendor/llvm/llvm-release_33-r183502/; revision=251608; tag=vendor/llvm/llvm-release_33-r183502
Diffstat (limited to 'test/MC/COFF')
-rw-r--r-- | test/MC/COFF/align-nops.s | 64 | ||||
-rw-r--r-- | test/MC/COFF/basic-coff-64.s | 137 | ||||
-rw-r--r-- | test/MC/COFF/basic-coff.s | 220 | ||||
-rw-r--r-- | test/MC/COFF/bss.s | 12 | ||||
-rw-r--r-- | test/MC/COFF/diff.s | 34 | ||||
-rwxr-xr-x | test/MC/COFF/linker-options.ll | 21 | ||||
-rw-r--r-- | test/MC/COFF/module-asm.ll | 32 | ||||
-rw-r--r-- | test/MC/COFF/relocation-imgrel.s | 29 | ||||
-rw-r--r-- | test/MC/COFF/secrel-variant.s | 19 | ||||
-rw-r--r-- | test/MC/COFF/secrel32.s | 12 | ||||
-rw-r--r-- | test/MC/COFF/seh-section.s | 20 | ||||
-rw-r--r-- | test/MC/COFF/seh.s | 119 | ||||
-rw-r--r-- | test/MC/COFF/simple-fixups.s | 11 | ||||
-rw-r--r-- | test/MC/COFF/symbol-alias.s | 76 | ||||
-rw-r--r-- | test/MC/COFF/symbol-fragment-offset-64.s | 168 | ||||
-rw-r--r-- | test/MC/COFF/symbol-fragment-offset.s | 277 | ||||
-rw-r--r-- | test/MC/COFF/weak-symbol-section-specification.ll | 30 | ||||
-rw-r--r-- | test/MC/COFF/weak.s | 70 |
18 files changed, 903 insertions, 448 deletions
diff --git a/test/MC/COFF/align-nops.s b/test/MC/COFF/align-nops.s index 2971ec67798e..02b488475e90 100644 --- a/test/MC/COFF/align-nops.s +++ b/test/MC/COFF/align-nops.s @@ -1,4 +1,4 @@ -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s -o - | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -s -sd | FileCheck %s // Test that we get optimal nops in text .text @@ -15,36 +15,40 @@ f0: .long 0 .align 8 -//CHECK: Name = .text -//CHECK-NEXT: VirtualSize -//CHECK-NEXT: VirtualAddress -//CHECK-NEXT: SizeOfRawData = 16 -//CHECK-NEXT: PointerToRawData -//CHECK-NEXT: PointerToRelocations -//CHECK-NEXT: PointerToLineNumbers -//CHECK-NEXT: NumberOfRelocations -//CHECK-NEXT: NumberOfLineNumbers -//CHECK-NEXT: Charateristics = 0x60400020 -//CHECK-NEXT: IMAGE_SCN_CNT_CODE +//CHECK: Name: .text +//CHECK-NEXT: VirtualSize +//CHECK-NEXT: VirtualAddress +//CHECK-NEXT: RawDataSize: 16 +//CHECK-NEXT: PointerToRawData +//CHECK-NEXT: PointerToRelocations +//CHECK-NEXT: PointerToLineNumbers +//CHECK-NEXT: RelocationCount +//CHECK-NEXT: LineNumberCount +//CHECK-NEXT: Characteristics [ (0x60400020) //CHECK-NEXT: IMAGE_SCN_ALIGN_8BYTES +//CHECK-NEXT: IMAGE_SCN_CNT_CODE //CHECK-NEXT: IMAGE_SCN_MEM_EXECUTE //CHECK-NEXT: IMAGE_SCN_MEM_READ -//CHECK-NEXT: SectionData = -//CHECK-NEXT: 00 00 00 00 0F 1F 40 00 - 00 00 00 00 0F 1F 40 00 +//CHECK-NEXT: ] +//CHECK-NEXT: SectionData ( +//CHECK-NEXT: 0000: 00000000 0F1F4000 00000000 0F1F4000 +//CHECK-NEXT: ) -//CHECK: Name = .data -//CHECK-NEXT: VirtualSize -//CHECK-NEXT: VirtualAddress -//CHECK-NEXT: SizeOfRawData = 16 -//CHECK-NEXT: PointerToRawData -//CHECK-NEXT: PointerToRelocations -//CHECK-NEXT: PointerToLineNumbers -//CHECK-NEXT: NumberOfRelocations -//CHECK-NEXT: NumberOfLineNumbers -//CHECK-NEXT: Charateristics = 0xC0400040 -//CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA -//CHECK-NEXT: IMAGE_SCN_ALIGN_8BYTES -//CHECK-NEXT: IMAGE_SCN_MEM_READ -//CHECK-NEXT: IMAGE_SCN_MEM_WRITE -//CHECK-NEXT: SectionData = -//CHECK-NEXT: 00 00 00 00 90 90 90 90 - 00 00 00 00 00 00 00 00 +//CHECK: Name: .data +//CHECK-NEXT: VirtualSize: +//CHECK-NEXT: VirtualAddress: +//CHECK-NEXT: RawDataSize: 16 +//CHECK-NEXT: PointerToRawData: +//CHECK-NEXT: PointerToRelocations: +//CHECK-NEXT: PointerToLineNumbers: +//CHECK-NEXT: RelocationCount: +//CHECK-NEXT: LineNumberCount: +//CHECK-NEXT: Characteristics [ (0xC0400040) +//CHECK-NEXT: IMAGE_SCN_ALIGN_8BYTES +//CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA +//CHECK-NEXT: IMAGE_SCN_MEM_READ +//CHECK-NEXT: IMAGE_SCN_MEM_WRITE +//CHECK-NEXT: ] +//CHECK-NEXT: SectionData ( +//CHECK-NEXT: 0000: 00000000 90909090 00000000 00000000 +//CHECK-NEXT: ) diff --git a/test/MC/COFF/basic-coff-64.s b/test/MC/COFF/basic-coff-64.s new file mode 100644 index 000000000000..89d17452d0d7 --- /dev/null +++ b/test/MC/COFF/basic-coff-64.s @@ -0,0 +1,137 @@ +// This test checks that the COFF object emitter works for the most basic +// programs. + +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -h -s -sr -sd -t | FileCheck %s + +.def _main; + .scl 2; + .type 32; + .endef + .text + .globl _main + .align 16, 0x90 +_main: # @main +# BB#0: # %entry + subl $4, %esp + movl $.L_.str, (%esp) + call _printf + xorl %eax, %eax + addl $4, %esp + ret + + .data +.L_.str: # @.str + .asciz "Hello World" + +// CHECK: ImageFileHeader { +// CHECK: Machine: IMAGE_FILE_MACHINE_AMD64 +// CHECK: SectionCount: 2 +// CHECK: TimeDateStamp: {{[0-9]+}} +// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} +// CHECK: SymbolCount: 6 +// CHECK: OptionalHeaderSize: 0 +// CHECK: Characteristics [ (0x0) +// CHECK: ] +// CHECK: } +// CHECK: Sections [ +// CHECK: Section { +// CHECK: Number: [[TextNum:[0-9]+]] +// CHECK: Name: .text +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: [[TextSize:[0-9]+]] +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 2 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0x60500020) +// CHECK: IMAGE_SCN_ALIGN_16BYTES +// CHECK: IMAGE_SCN_CNT_CODE +// CHECK: IMAGE_SCN_MEM_EXECUTE +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: ] +// CHECK: Relocations [ +// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_AMD64_ADDR32 .data +// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_AMD64_REL32 _printf +// CHECK: ] +// CHECK: } +// CHECK: Section { +// CHECK: Number: [[DataNum:[0-9]+]] +// CHECK: Name: .data +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: [[DataSize:[0-9]+]] +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x0 +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0xC0300040) +// CHECK: IMAGE_SCN_ALIGN_4BYTES +// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: IMAGE_SCN_MEM_WRITE +// CHECK: ] +// CHECK: Relocations [ +// CHECK: ] +// CHECK: SectionData ( +// CHECK: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| +// CHECK: ) +// CHECK: } +// CHECK: ] +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: .text +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: [[TextSize]] +// CHECK: RelocationCount: 2 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: [[TextNum]] +// CHECK: Selection: 0x0 +// CHECK: } +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: .data +// CHECK: Value: 0 +// CHECK: Section: .data +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: [[DataSize]] +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: [[DataNum]] +// CHECK: Selection: 0x0 +// CHECK: Unused: (00 00 00) +// CHECK: } +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _main +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Function +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _printf +// CHECK: Value: 0 +// CHECK: Section: (0) +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: ] diff --git a/test/MC/COFF/basic-coff.s b/test/MC/COFF/basic-coff.s index 23156b82d2e5..9b299707a130 100644 --- a/test/MC/COFF/basic-coff.s +++ b/test/MC/COFF/basic-coff.s @@ -1,8 +1,7 @@ // This test checks that the COFF object emitter works for the most basic // programs. -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s -// I WOULD RUN, BUT THIS FAILS: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -h -s -sr -sd -t | FileCheck %s .def _main; .scl 2; @@ -15,119 +14,124 @@ _main: # @main # BB#0: # %entry subl $4, %esp movl $L_.str, (%esp) - calll _printf + call _printf xorl %eax, %eax addl $4, %esp ret .data L_.str: # @.str - .asciz "Hello World" + .asciz "Hello World" -// CHECK: { -// CHECK: MachineType = IMAGE_FILE_MACHINE_I386 (0x14C) -// CHECK: NumberOfSections = 2 -// CHECK: TimeDateStamp = {{[0-9]+}} -// CHECK: PointerToSymbolTable = 0x{{[0-9A-F]+}} -// CHECK: NumberOfSymbols = 6 -// CHECK: SizeOfOptionalHeader = 0 -// CHECK: Characteristics = 0x0 -// CHECK: Sections = [ -// CHECK: 1 = { -// CHECK: Name = .text -// CHECK: VirtualSize = 0 -// CHECK: VirtualAddress = 0 -// CHECK: SizeOfRawData = {{[0-9]+}} -// CHECK: PointerToRawData = 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations = 0x{{[0-9A-F]+}} -// CHECK: PointerToLineNumbers = 0x0 -// CHECK: NumberOfRelocations = 2 -// CHECK: NumberOfLineNumbers = 0 -// CHECK: Charateristics = 0x60500020 -// CHECK: IMAGE_SCN_CNT_CODE -// CHECK: IMAGE_SCN_ALIGN_16BYTES -// CHECK: IMAGE_SCN_MEM_EXECUTE -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: SectionData = -// CHECK: Relocations = [ -// CHECK: 0 = { -// CHECK: VirtualAddress = 0x{{[0-9A-F]+}} -// CHECK: SymbolTableIndex = 2 -// CHECK: Type = IMAGE_REL_I386_DIR32 (6) -// CHECK: SymbolName = .data -// CHECK: } -// CHECK: 1 = { -// CHECK: VirtualAddress = 0x{{[0-9A-F]+}} -// CHECK: SymbolTableIndex = 5 -// CHECK: Type = IMAGE_REL_I386_REL32 (20) -// CHECK: SymbolName = _printf -// CHECK: } -// CHECK: ] -// CHECK: } -// CHECK: 2 = { -// CHECK: Name = .data -// CHECK: VirtualSize = 0 -// CHECK: VirtualAddress = 0 -// CHECK: SizeOfRawData = {{[0-9]+}} -// CHECK: PointerToRawData = 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations = 0x0 -// CHECK: PointerToLineNumbers = 0x0 -// CHECK: NumberOfRelocations = 0 -// CHECK: NumberOfLineNumbers = 0 -// CHECK: Charateristics = 0xC0300040 -// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA -// CHECK: IMAGE_SCN_ALIGN_4BYTES -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: IMAGE_SCN_MEM_WRITE -// CHECK: SectionData = -// CHECK: 48 65 6C 6C 6F 20 57 6F - 72 6C 64 00 |Hello World.| -// CHECK: Relocations = None -// CHECK: } +// CHECK: ImageFileHeader { +// CHECK: Machine: IMAGE_FILE_MACHINE_I386 +// CHECK: SectionCount: 2 +// CHECK: TimeDateStamp: {{[0-9]+}} +// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} +// CHECK: SymbolCount: 6 +// CHECK: OptionalHeaderSize: 0 +// CHECK: Characteristics [ (0x0) // CHECK: ] -// CHECK: Symbols = [ -// CHECK: 0 = { -// CHECK: Name = .text -// CHECK: Value = 0 -// CHECK: SectionNumber = 1 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) -// CHECK: NumberOfAuxSymbols = 1 -// CHECK: AuxillaryData = -// CHECK: 15 00 00 00 02 00 00 00 - 00 00 00 00 01 00 00 00 |................| -// CHECK: 00 00 |..| -// CHECK: } -// CHECK: 2 = { -// CHECK: Name = .data -// CHECK: Value = 0 -// CHECK: SectionNumber = 2 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) -// CHECK: NumberOfAuxSymbols = 1 -// CHECK: AuxillaryData = -// CHECK: 0C 00 00 00 00 00 00 00 - 00 00 00 00 02 00 00 00 |................| -// CHECK: 00 00 |..| -// CHECK: } -// CHECK: 4 = { -// CHECK: Name = _main -// CHECK: Value = 0 -// CHECK: SectionNumber = 1 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_FUNCTION (2) -// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) -// CHECK: NumberOfAuxSymbols = 0 -// CHECK: AuxillaryData = +// CHECK: } +// CHECK: Sections [ +// CHECK: Section { +// CHECK: Number: [[TextNum:[0-9]+]] +// CHECK: Name: .text +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: {{[0-9]+}} +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 2 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0x60500020) +// CHECK: IMAGE_SCN_ALIGN_16BYTES +// CHECK: IMAGE_SCN_CNT_CODE +// CHECK: IMAGE_SCN_MEM_EXECUTE +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: ] +// CHECK: Relocations [ +// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_I386_DIR32 .data +// CHECK: 0x{{[0-9A-F]+}} IMAGE_REL_I386_REL32 _printf +// CHECK: ] +// CHECK: } +// CHECK: Section { +// CHECK: Number: [[DataNum:[0-9]+]] +// CHECK: Name: .data +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: {{[0-9]+}} +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x0 +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0xC0300040) +// CHECK: IMAGE_SCN_ALIGN_4BYTES +// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: IMAGE_SCN_MEM_WRITE +// CHECK: ] +// CHECK: Relocations [ +// CHECK: ] +// CHECK: SectionData ( +// CHECK: 0000: 48656C6C 6F20576F 726C6400 |Hello World.| +// CHECK: ) +// CHECK: } +// CHECK: ] +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: .text +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: 21 +// CHECK: RelocationCount: 2 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: 1 +// CHECK: Selection: 0x0 // CHECK: } -// CHECK: 5 = { -// CHECK: Name = _printf -// CHECK: Value = 0 -// CHECK: SectionNumber = 0 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) -// CHECK: NumberOfAuxSymbols = 0 -// CHECK: AuxillaryData = +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: .data +// CHECK: Value: 0 +// CHECK: Section: .data +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: 12 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: 2 +// CHECK: Selection: 0x0 +// CHECK: Unused: (00 00 00) // CHECK: } -// CHECK: ] -// CHECK: } +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _main +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Function +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _printf +// CHECK: Value: 0 +// CHECK: Section: (0) +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: ] diff --git a/test/MC/COFF/bss.s b/test/MC/COFF/bss.s index 3bed13d4aac9..86294c18683e 100644 --- a/test/MC/COFF/bss.s +++ b/test/MC/COFF/bss.s @@ -1,7 +1,7 @@ // The purpose of this test is to verify that bss sections are emited correctly. -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s -// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -s | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -s | FileCheck %s .bss .globl _g0 @@ -9,7 +9,7 @@ _g0: .long 0 -// CHECK: Name = .bss -// CHECK-NEXT: VirtualSize = 0 -// CHECK-NEXT: VirtualAddress = 0 -// CHECK-NEXT: SizeOfRawData = 4 +// CHECK: Name: .bss +// CHECK-NEXT: VirtualSize: 0 +// CHECK-NEXT: VirtualAddress: 0 +// CHECK-NEXT: RawDataSize: 4 diff --git a/test/MC/COFF/diff.s b/test/MC/COFF/diff.s index aa683f26a7b1..820272a40bf4 100644 --- a/test/MC/COFF/diff.s +++ b/test/MC/COFF/diff.s @@ -1,4 +1,4 @@ -// RUN: llvm-mc -filetype=obj -triple i686-pc-mingw32 %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-mingw32 %s | llvm-readobj -s -sr -sd | FileCheck %s .def _foobar; .scl 2; @@ -21,26 +21,12 @@ _rust_crate: .long _foobar-_rust_crate .long _foobar-_rust_crate -// CHECK: Name = .data -// CHECK: SectionData = -// CHECK-NEXT: 00 00 00 00 00 00 00 00 - 1C 00 00 00 20 00 00 00 |............ ...| -// CHECK: Relocations = [ -// CHECK-NEXT: 0 = { -// CHECK-NEXT: VirtualAddress = 0x4 -// CHECK-NEXT: SymbolTableIndex = -// CHECK-NEXT: Type = IMAGE_REL_I386_DIR32 (6) -// CHECK-NEXT: SymbolName = _foobar -// CHECK-NEXT: } -// CHECK-NEXT: 1 = { -// CHECK-NEXT: VirtualAddress = 0x8 -// CHECK-NEXT: SymbolTableIndex = 0 -// CHECK-NEXT: Type = IMAGE_REL_I386_REL32 (20) -// CHECK-NEXT: SymbolName = .text -// CHECK-NEXT: } -// CHECK-NEXT: 2 = { -// CHECK-NEXT: VirtualAddress = 0xC -// CHECK-NEXT: SymbolTableIndex = 0 -// CHECK-NEXT: Type = IMAGE_REL_I386_REL32 (20) -// CHECK-NEXT: SymbolName = .text -// CHECK-NEXT: } -// CHECK-NEXT: ] +// CHECK: Name: .data +// CHECK: Relocations [ +// CHECK-NEXT: 0x4 IMAGE_REL_I386_DIR32 _foobar +// CHECK-NEXT: 0x8 IMAGE_REL_I386_REL32 .text +// CHECK-NEXT: 0xC IMAGE_REL_I386_REL32 .text +// CHECK-NEXT: ] +// CHECK: SectionData ( +// CHECK-NEXT: 0000: 00000000 00000000 1C000000 20000000 +// CHECK-NEXT: ) diff --git a/test/MC/COFF/linker-options.ll b/test/MC/COFF/linker-options.ll new file mode 100755 index 000000000000..de119417447e --- /dev/null +++ b/test/MC/COFF/linker-options.ll @@ -0,0 +1,21 @@ +; RUN: llc -O0 -mtriple=i386-pc-win32 -filetype=asm -o - %s | FileCheck %s + +!0 = metadata !{ i32 6, metadata !"Linker Options", + metadata !{ + metadata !{ metadata !"/DEFAULTLIB:msvcrt.lib" }, + metadata !{ metadata !"/DEFAULTLIB:msvcrt.lib", + metadata !"/DEFAULTLIB:secur32.lib" }, + metadata !{ metadata !"/with spaces" } } } + +!llvm.module.flags = !{ !0 } + +define dllexport void @foo() { + ret void +} + +; CHECK: .section .drectve,"r" +; CHECK: .ascii " /DEFAULTLIB:msvcrt.lib" +; CHECK: .ascii " /DEFAULTLIB:msvcrt.lib" +; CHECK: .ascii " /DEFAULTLIB:secur32.lib" +; CHECK: .ascii " \"/with spaces\"" +; CHECK: .ascii " /EXPORT:_foo" diff --git a/test/MC/COFF/module-asm.ll b/test/MC/COFF/module-asm.ll index 9c6d00d2f503..bf14dc695b58 100644 --- a/test/MC/COFF/module-asm.ll +++ b/test/MC/COFF/module-asm.ll @@ -1,26 +1,28 @@ ; The purpose of this test is to verify that various module level assembly ; constructs work. -; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o - | coff-dump.py | FileCheck %s -; RUN: llc -filetype=obj -mtriple x86_64-pc-win32 %s -o - | coff-dump.py | FileCheck %s +; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o - | llvm-readobj -s -sd | FileCheck %s +; RUN: llc -filetype=obj -mtriple x86_64-pc-win32 %s -o - | llvm-readobj -s -sd | FileCheck %s module asm ".text" module asm "_foo:" module asm " ret" -; CHECK: Name = .text -; CHECK-NEXT: VirtualSize = 0 -; CHECK-NEXT: VirtualAddress = 0 -; CHECK-NEXT: SizeOfRawData = {{[0-9]+}} -; CHECK-NEXT: PointerToRawData = 0x{{[0-9A-F]+}} -; CHECK-NEXT: PointerToRelocations = 0x{{[0-9A-F]+}} -; CHECK-NEXT: PointerToLineNumbers = 0x0 -; CHECK-NEXT: NumberOfRelocations = 0 -; CHECK-NEXT: NumberOfLineNumbers = 0 -; CHECK-NEXT: Charateristics = 0x60300020 -; CHECK-NEXT: IMAGE_SCN_CNT_CODE +; CHECK: Name: .text +; CHECK-NEXT: VirtualSize: 0 +; CHECK-NEXT: VirtualAddress: 0 +; CHECK-NEXT: RawDataSize: {{[0-9]+}} +; CHECK-NEXT: PointerToRawData: 0x{{[0-9A-F]+}} +; CHECK-NEXT: PointerToRelocations: 0x{{[0-9A-F]+}} +; CHECK-NEXT: PointerToLineNumbers: 0x0 +; CHECK-NEXT: RelocationCount: 0 +; CHECK-NEXT: LineNumberCount: 0 +; CHECK-NEXT: Characteristics [ (0x60300020) ; CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES +; CHECK-NEXT: IMAGE_SCN_CNT_CODE ; CHECK-NEXT: IMAGE_SCN_MEM_EXECUTE ; CHECK-NEXT: IMAGE_SCN_MEM_READ -; CHECK-NEXT: SectionData = -; CHECK-NEXT: C3 +; CHECK-NEXT: ] +; CHECK-NEXT: SectionData ( +; CHECK-NEXT: 0000: C3 +; CHECK-NEXT: ) diff --git a/test/MC/COFF/relocation-imgrel.s b/test/MC/COFF/relocation-imgrel.s new file mode 100644 index 000000000000..ccd19ee318b6 --- /dev/null +++ b/test/MC/COFF/relocation-imgrel.s @@ -0,0 +1,29 @@ +// COFF Image-relative relocations +// +// Test that we produce image-relative relocations (IMAGE_REL_I386_DIR32NB +// and IMAGE_REL_AMD64_ADDR32NB) when accessing foo@imgrel. + +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -r | FileCheck --check-prefix=W32 %s +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -r | FileCheck --check-prefix=W64 %s + +.data +foo: + .long 1 + +.text + mov foo@IMGREL(%ebx, %ecx, 4), %eax + mov foo@imgrel(%ebx, %ecx, 4), %eax + +// W32: Relocations [ +// W32-NEXT: Section (1) .text { +// W32-NEXT: 0x3 IMAGE_REL_I386_DIR32NB foo +// W32-NEXT: 0xA IMAGE_REL_I386_DIR32NB foo +// W32-NEXT: } +// W32-NEXT: ] + +// W64: Relocations [ +// W64-NEXT: Section (1) .text { +// W64-NEXT: 0x4 IMAGE_REL_AMD64_ADDR32NB foo +// W64-NEXT: 0xC IMAGE_REL_AMD64_ADDR32NB foo +// W64-NEXT: } +// W64-NEXT: ] diff --git a/test/MC/COFF/secrel-variant.s b/test/MC/COFF/secrel-variant.s new file mode 100644 index 000000000000..1061bd404eaa --- /dev/null +++ b/test/MC/COFF/secrel-variant.s @@ -0,0 +1,19 @@ +// COFF section-relative relocations + +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -r | FileCheck %s + +.data +values: + .long 1 + .long 0 + +.text + movq values@SECREL32(%rax), %rcx + movq values@SECREL32+8(%rax), %rax + +// CHECK: Relocations [ +// CHECK-NEXT: Section (1) .text { +// CHECK-NEXT: 0x3 IMAGE_REL_AMD64_SECREL values +// CHECK-NEXT: 0xA IMAGE_REL_AMD64_SECREL values +// CHECK-NEXT: } +// CHECK-NEXT: ] diff --git a/test/MC/COFF/secrel32.s b/test/MC/COFF/secrel32.s index ce148db9000c..deadfe09e0e4 100644 --- a/test/MC/COFF/secrel32.s +++ b/test/MC/COFF/secrel32.s @@ -1,14 +1,10 @@ -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -s -sr | FileCheck %s // check that we produce the correct relocation for .secrel32 Lfoo: .secrel32 Lfoo -// CHECK: Relocations = [ -// CHECK-NEXT: 0 = { -// CHECK-NEXT: VirtualAddress = 0x0 -// CHECK-NEXT: SymbolTableIndex = 0 -// CHECK-NEXT: Type = IMAGE_REL_I386_SECREL (11) -// CHECK-NEXT: SymbolName = .text -// CHECK-NEXT: } +// CHECK: Relocations [ +// CHECK-NEXT: 0x0 IMAGE_REL_I386_SECREL .text +// CHECK-NEXT: ] diff --git a/test/MC/COFF/seh-section.s b/test/MC/COFF/seh-section.s index 802cba5e6b31..7f05cc372e07 100644 --- a/test/MC/COFF/seh-section.s +++ b/test/MC/COFF/seh-section.s @@ -1,24 +1,26 @@ // This test ensures that, if the section containing a function has a suffix // (e.g. .text$foo), its unwind info section also has a suffix (.xdata$foo). -// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -s -sd | FileCheck %s // XFAIL: * -// CHECK: Name = .xdata$foo +// CHECK: Name: .xdata$foo // CHECK-NEXT: VirtualSize // CHECK-NEXT: VirtualAddress -// CHECK-NEXT: SizeOfRawData = 8 +// CHECK-NEXT: RawDataSize: 8 // CHECK-NEXT: PointerToRawData // CHECK-NEXT: PointerToRelocations // CHECK-NEXT: PointerToLineNumbers -// CHECK-NEXT: NumberOfRelocations = 0 -// CHECK-NEXT: NumberOfLineNumbers = 0 -// CHECK-NEXT: Charateristics -// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK-NEXT: RelocationCount: 0 +// CHECK-NEXT: LineNumberCount: 0 +// CHECK-NEXT: Characteristics [ // CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES +// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA // CHECK-NEXT: IMAGE_SCN_MEM_READ // CHECK-NEXT: IMAGE_SCN_MEM_WRITE -// CHECK-NEXT: SectionData -// CHECK-NEXT: 01 05 02 00 05 50 04 02 +// CHECK-NEXT: ] +// CHECK-NEXT: SectionData ( +// CHECK-NEXT: 0000: 01050200 05500402 +// CHECK-NEXT: ) .section .text$foo,"x" .globl foo diff --git a/test/MC/COFF/seh.s b/test/MC/COFF/seh.s index 3f728056005b..bef425efb437 100644 --- a/test/MC/COFF/seh.s +++ b/test/MC/COFF/seh.s @@ -1,24 +1,105 @@ // This test checks that the SEH directives emit the correct unwind data. -// RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | coff-dump.py | FileCheck %s -// CHECK: Name = .xdata -// CHECK-NEXT: VirtualSize -// CHECK-NEXT: VirtualAddress -// CHECK-NEXT: SizeOfRawData = 52 -// CHECK-NEXT: PointerToRawData -// CHECK-NEXT: PointerToRelocations -// CHECK-NEXT: PointerToLineNumbers -// CHECK-NEXT: NumberOfRelocations = 4 -// CHECK-NEXT: NumberOfLineNumbers = 0 -// CHECK-NEXT: Charateristics -// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA -// CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES -// CHECK-NEXT: IMAGE_SCN_MEM_READ -// CHECK-NEXT: SectionData -// CHECK-NEXT: 09 12 08 03 00 03 0F 30 - 0E 88 00 00 09 64 02 00 -// CHECK-NEXT: 04 22 00 1A 00 00 00 00 - 00 00 00 00 21 00 00 00 -// CHECK-NEXT: 00 00 00 00 1B 00 00 00 - 00 00 00 00 01 00 00 00 -// CHECK-NEXT: 00 00 00 00 +// TODO: Expected fail because SET_FPREG has a wrong offset. +// XFAIL: * +// RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | llvm-readobj -s -u | FileCheck %s + +// CHECK: Sections [ +// CHECK: Section { +// CHECK: Name: .text +// CHECK: RelocationCount: 0 +// CHECK: Characteristics [ +// CHECK-NEXT: ALIGN_4BYTES +// CHECK-NEXT: CNT_CODE +// CHECK-NEXT: MEM_EXECUTE +// CHECK-NEXT: MEM_READ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK: Section { +// CHECK: Name: .xdata +// CHECK: RawDataSize: 52 +// CHECK: RelocationCount: 4 +// CHECK: Characteristics [ +// CHECK-NEXT: ALIGN_4BYTES +// CHECK-NEXT: CNT_INITIALIZED_DATA +// CHECK-NEXT: MEM_READ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK: Section { +// CHECK: Name: .pdata +// CHECK: RelocationCount: 9 +// CHECK: Characteristics [ +// CHECK-NEXT: ALIGN_4BYTES +// CHECK-NEXT: CNT_INITIALIZED_DATA +// CHECK-NEXT: MEM_READ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: ] + +// CHECK: UnwindInformation [ +// CHECK-NEXT: RuntimeFunction { +// CHECK-NEXT: StartAddress: [[CodeSect1:[^ ]+]] [[BeginDisp1:(\+0x[A-F0-9]+)?]] +// CHECK-NEXT: EndAddress: [[CodeSect1]] [[EndDisp1:(\+0x[A-F0-9]+)?]] +// CHECK-NEXT: UnwindInfoAddress: +// CHECK-NEXT: UnwindInfo { +// CHECK-NEXT: Version: 1 +// CHECK-NEXT: Flags [ +// CHECK-NEXT: ExceptionHandler +// CHECK-NEXT: ] +// CHECK-NEXT: PrologSize: 18 +// CHECK-NEXT: FrameRegister: RBX +// CHECK-NEXT: FrameOffset: 0x0 +// CHECK-NEXT: UnwindCodeCount: 8 +// CHECK-NEXT: UnwindCodes [ +// CHECK-NEXT: 0x12: SET_FPREG reg=RBX, offset=0x0 +// CHECK-NEXT: 0x0F: PUSH_NONVOL reg=RBX +// CHECK-NEXT: 0x0E: SAVE_XMM128 reg=XMM8, offset=0x0 +// CHECK-NEXT: 0x09: SAVE_NONVOL reg=RSI, offset=0x10 +// CHECK-NEXT: 0x04: ALLOC_SMALL size=24 +// CHECK-NEXT: 0x00: PUSH_MACHFRAME errcode=yes +// CHECK-NEXT: ] +// CHECK-NEXT: Handler: __C_specific_handler +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: RuntimeFunction { +// CHECK-NEXT: StartAddress: [[CodeSect2:[^ ]+]] [[BeginDisp2:(\+0x[A-F0-9]+)?]] +// CHECK-NEXT: EndAddress: [[CodeSect2]] [[BeginDisp2:(\+0x[A-F0-9]+)?]] +// CHECK-NEXT: UnwindInfoAddress: +// CHECK-NEXT: UnwindInfo { +// CHECK-NEXT: Version: 1 +// CHECK-NEXT: Flags [ +// CHECK-NEXT: ChainInfo +// CHECK-NEXT: ] +// CHECK-NEXT: PrologSize: 0 +// CHECK-NEXT: FrameRegister: - +// CHECK-NEXT: FrameOffset: - +// CHECK-NEXT: UnwindCodeCount: 0 +// CHECK-NEXT: UnwindCodes [ +// CHECK-NEXT: ] +// CHECK-NEXT: Chained { +// CHECK-NEXT: StartAddress: [[CodeSect1]] [[BeginDisp1]] +// CHECK-NEXT: EndAddress: [[CodeSect1]] [[EndDisp1]] +// CHECK-NEXT: UnwindInfoAddress: +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: RuntimeFunction { +// CHECK-NEXT: StartAddress: [[CodeSect3:[^ ]+]] [[BeginDisp3:(\+0x[A-F0-9]+)?]] +// CHECK-NEXT: EndAddress: [[CodeSect3]] [[BeginDisp3:(\+0x[A-F0-9]+)?]] +// CHECK-NEXT: UnwindInfoAddress: +// CHECK-NEXT: UnwindInfo { +// CHECK-NEXT: Version: 1 +// CHECK-NEXT: Flags [ +// CHECK-NEXT: ] +// CHECK-NEXT: PrologSize: 0 +// CHECK-NEXT: FrameRegister: - +// CHECK-NEXT: FrameOffset: - +// CHECK-NEXT: UnwindCodeCount: 0 +// CHECK-NEXT: UnwindCodes [ +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: ] .text .globl func diff --git a/test/MC/COFF/simple-fixups.s b/test/MC/COFF/simple-fixups.s index 4c9b4d44528f..2a74f21f12d0 100644 --- a/test/MC/COFF/simple-fixups.s +++ b/test/MC/COFF/simple-fixups.s @@ -1,8 +1,8 @@ // The purpose of this test is to verify that we do not produce unneeded // relocations when symbols are in the same section and we know their offset. -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s -// I WOULD RUN, BUT THIS FAILS: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -s | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -s | FileCheck %s .def _foo; .scl 2; @@ -41,10 +41,9 @@ _baz: # @baz # BB#0: # %e subl $4, %esp Ltmp0: - calll _baz + call _baz addl $4, %esp ret -// CHECK: Sections = [ -// CHECK-NOT: NumberOfRelocations = {{[^0]}} -// CHECK: Symbols = [ +// CHECK: Sections [ +// CHECK-NOT: RelocationCount: {{[^0]}} diff --git a/test/MC/COFF/symbol-alias.s b/test/MC/COFF/symbol-alias.s index 4b1772ce711b..ccada3793ca3 100644 --- a/test/MC/COFF/symbol-alias.s +++ b/test/MC/COFF/symbol-alias.s @@ -1,9 +1,9 @@ // The purpose of this test is to verify that symbol aliases -// (@foo = alias <type> @bar) generate the correct entries in the symbol table. +// (@foo: alias <type> @bar) generate the correct entries in the symbol table. // They should be identical except for the name. -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s -// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -t | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -t | FileCheck %s .def _foo; .scl 2; @@ -31,43 +31,43 @@ _bar_alias_alias = _bar_alias .globl _bar_alias _bar_alias = _bar -// CHECK: Name = {{_?}}foo -// CHECK-NEXT: Value = [[FOO_VALUE:.*$]] -// CHECK-NEXT: SectionNumber = [[FOO_SECTION_NUMBER:.*$]] -// CHECK-NEXT: SimpleType = [[FOO_SIMPLE_TYPE:.*$]] -// CHECK-NEXT: ComplexType = [[FOO_COMPLEX_TYPE:.*$]] -// CHECK-NEXT: StorageClass = [[FOO_STORAGE_CLASS:.*$]] -// CHECK-NEXT: NumberOfAuxSymbols = [[FOO_NUMBER_OF_AUX_SYMBOLS:.*$]] +// CHECK: Name: {{_?}}foo +// CHECK-NEXT: Value: [[FOO_VALUE:.*$]] +// CHECK-NEXT: Section: [[FOO_SECTION_NUMBER:.*$]] +// CHECK-NEXT: BaseType: [[FOO_SIMPLE_TYPE:.*$]] +// CHECK-NEXT: ComplexType: [[FOO_COMPLEX_TYPE:.*$]] +// CHECK-NEXT: StorageClass: [[FOO_STORAGE_CLASS:.*$]] +// CHECK-NEXT: AuxSymbolCount: [[FOO_NUMBER_OF_AUX_SYMBOLS:.*$]] -// CHECK: Name = {{_?}}bar -// CHECK-NEXT: Value = [[BAR_VALUE:.*$]] -// CHECK-NEXT: SectionNumber = [[BAR_SECTION_NUMBER:.*$]] -// CHECK-NEXT: SimpleType = [[BAR_SIMPLE_TYPE:.*$]] -// CHECK-NEXT: ComplexType = [[BAR_COMPLEX_TYPE:.*$]] -// CHECK-NEXT: StorageClass = [[BAR_STORAGE_CLASS:.*$]] -// CHECK-NEXT: NumberOfAuxSymbols = [[BAR_NUMBER_OF_AUX_SYMBOLS:.*$]] +// CHECK: Name: {{_?}}bar +// CHECK-NEXT: Value: [[BAR_VALUE:.*$]] +// CHECK-NEXT: Section: [[BAR_SECTION_NUMBER:.*$]] +// CHECK-NEXT: BaseType: [[BAR_SIMPLE_TYPE:.*$]] +// CHECK-NEXT: ComplexType: [[BAR_COMPLEX_TYPE:.*$]] +// CHECK-NEXT: StorageClass: [[BAR_STORAGE_CLASS:.*$]] +// CHECK-NEXT: AuxSymbolCount: [[BAR_NUMBER_OF_AUX_SYMBOLS:.*$]] -// CHECK: Name = {{_?}}foo_alias -// CHECK-NEXT: Value = [[FOO_VALUE]] -// CHECK-NEXT: SectionNumber = [[FOO_SECTION_NUMBER]] -// CHECK-NEXT: SimpleType = [[FOO_SIMPLE_TYPE]] -// CHECK-NEXT: ComplexType = [[FOO_COMPLEX_TYPE]] -// CHECK-NEXT: StorageClass = [[FOO_STORAGE_CLASS]] -// CHECK-NEXT: NumberOfAuxSymbols = [[FOO_NUMBER_OF_AUX_SYMBOLS]] +// CHECK: Name: {{_?}}foo_alias +// CHECK-NEXT: Value: [[FOO_VALUE]] +// CHECK-NEXT: Section: [[FOO_SECTION_NUMBER]] +// CHECK-NEXT: BaseType: [[FOO_SIMPLE_TYPE]] +// CHECK-NEXT: ComplexType: [[FOO_COMPLEX_TYPE]] +// CHECK-NEXT: StorageClass: [[FOO_STORAGE_CLASS]] +// CHECK-NEXT: AuxSymbolCount: [[FOO_NUMBER_OF_AUX_SYMBOLS]] -// CHECK: Name = {{_?}}bar_alias_alias -// CHECK-NEXT: Value = [[BAR_VALUE]] -// CHECK-NEXT: SectionNumber = [[BAR_SECTION_NUMBER]] -// CHECK-NEXT: SimpleType = [[BAR_SIMPLE_TYPE]] -// CHECK-NEXT: ComplexType = [[BAR_COMPLEX_TYPE]] -// CHECK-NEXT: StorageClass = [[BAR_STORAGE_CLASS]] -// CHECK-NEXT: NumberOfAuxSymbols = [[BAR_NUMBER_OF_AUX_SYMBOLS]] +// CHECK: Name: {{_?}}bar_alias_alias +// CHECK-NEXT: Value: [[BAR_VALUE]] +// CHECK-NEXT: Section: [[BAR_SECTION_NUMBER]] +// CHECK-NEXT: BaseType: [[BAR_SIMPLE_TYPE]] +// CHECK-NEXT: ComplexType: [[BAR_COMPLEX_TYPE]] +// CHECK-NEXT: StorageClass: [[BAR_STORAGE_CLASS]] +// CHECK-NEXT: AuxSymbolCount: [[BAR_NUMBER_OF_AUX_SYMBOLS]] -// CHECK: Name = {{_?}}bar_alias -// CHECK-NEXT: Value = [[BAR_VALUE]] -// CHECK-NEXT: SectionNumber = [[BAR_SECTION_NUMBER]] -// CHECK-NEXT: SimpleType = [[BAR_SIMPLE_TYPE]] -// CHECK-NEXT: ComplexType = [[BAR_COMPLEX_TYPE]] -// CHECK-NEXT: StorageClass = [[BAR_STORAGE_CLASS]] -// CHECK-NEXT: NumberOfAuxSymbols = [[BAR_NUMBER_OF_AUX_SYMBOLS]] +// CHECK: Name: {{_?}}bar_alias +// CHECK-NEXT: Value: [[BAR_VALUE]] +// CHECK-NEXT: Section: [[BAR_SECTION_NUMBER]] +// CHECK-NEXT: BaseType: [[BAR_SIMPLE_TYPE]] +// CHECK-NEXT: ComplexType: [[BAR_COMPLEX_TYPE]] +// CHECK-NEXT: StorageClass: [[BAR_STORAGE_CLASS]] +// CHECK-NEXT: AuxSymbolCount: [[BAR_NUMBER_OF_AUX_SYMBOLS]] diff --git a/test/MC/COFF/symbol-fragment-offset-64.s b/test/MC/COFF/symbol-fragment-offset-64.s new file mode 100644 index 000000000000..b8244709aa75 --- /dev/null +++ b/test/MC/COFF/symbol-fragment-offset-64.s @@ -0,0 +1,168 @@ +// The purpose of this test is to see if the COFF object writer is emitting the +// proper relocations for multiple pieces of data in a single data fragment. + +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -h -s -sr -sd -t | FileCheck %s + +.def _main; + .scl 2; + .type 32; + .endef + .text + .globl _main + .align 16, 0x90 +_main: # @main +# BB#0: # %entry + subl $4, %esp + movl $.L_.str0, (%esp) + callq _printf + movl $.L_.str1, (%esp) + callq _puts + movl $.L_.str2, (%esp) + callq _puts + xorl %eax, %eax + addl $4, %esp + ret + + .data +.L_.str0: # @.str0 + .asciz "Hello " + +.L_.str1: # @.str1 + .asciz "World!" + + .align 16 # @.str2 +.L_.str2: + .asciz "I'm The Last Line." + +// CHECK: { +// CHECK: Machine: IMAGE_FILE_MACHINE_AMD64 +// CHECK: SectionCount: 2 +// CHECK: TimeDateStamp: {{[0-9]+}} +// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} +// CHECK: SymbolCount: 7 +// CHECK: OptionalHeaderSize: 0 +// CHECK: Characteristics [ (0x0) +// CHECK: ] +// CHECK: } +// CHECK: Sections [ +// CHECK: Section { +// CHECK: Number: 1 +// CHECK: Name: .text +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: {{[0-9]+}} +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 6 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0x60500020) +// CHECK: IMAGE_SCN_ALIGN_16BYTES +// CHECK: IMAGE_SCN_CNT_CODE +// CHECK: IMAGE_SCN_MEM_EXECUTE +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: ] +// CHECK: Relocations [ +// CHECK: 0x7 IMAGE_REL_AMD64_ADDR32 .data +// CHECK: 0xC IMAGE_REL_AMD64_REL32 _printf +// CHECK: 0x14 IMAGE_REL_AMD64_ADDR32 .data +// CHECK: 0x19 IMAGE_REL_AMD64_REL32 _puts +// CHECK: 0x21 IMAGE_REL_AMD64_ADDR32 .data +// CHECK: 0x26 IMAGE_REL_AMD64_REL32 _puts +// CHECK: ] +// CHECK: SectionData ( +// CHECK: 0000: 83EC0467 C7042400 000000E8 00000000 +// CHECK: 0010: 67C70424 07000000 E8000000 0067C704 +// CHECK: 0020: 24100000 00E80000 000031C0 83C404C3 +// CHECK: ) +// CHECK: } +// CHECK: Section { +// CHECK: Number: 2 +// CHECK: Name: .data +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: {{[0-9]+}} +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x0 +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0xC0500040) +// CHECK: IMAGE_SCN_ALIGN_16BYTES +// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: IMAGE_SCN_MEM_WRITE +// CHECK: Relocations [ +// CHECK: ] +// CHECK: SectionData ( +// CHECK: 0000: 48656C6C 6F200057 6F726C64 21000000 |Hello .World!...| +// CHECK: 0010: 49276D20 54686520 4C617374 204C696E |I'm The Last Lin| +// CHECK: 0020: 652E00 |e..| +// CHECK: ) +// CHECK: } +// CHECK: ] +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: .text +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: 48 +// CHECK: RelocationCount: 6 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: 1 +// CHECK: Selection: 0x0 +// CHECK: Unused: (00 00 00) +// CHECK: } +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: .data +// CHECK: Value: 0 +// CHECK: Section: .data +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: 35 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: 2 +// CHECK: Selection: 0x0 +// CHECK: Unused: (00 00 00) +// CHECK: } +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _main +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Function +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _printf +// CHECK: Value: 0 +// CHECK: Section: (0) +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _puts +// CHECK: Value: 0 +// CHECK: Section: (0) +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: ] diff --git a/test/MC/COFF/symbol-fragment-offset.s b/test/MC/COFF/symbol-fragment-offset.s index 1df8baacaf22..71b1703972ab 100644 --- a/test/MC/COFF/symbol-fragment-offset.s +++ b/test/MC/COFF/symbol-fragment-offset.s @@ -1,8 +1,7 @@ // The purpose of this test is to see if the COFF object writer is emitting the // proper relocations for multiple pieces of data in a single data fragment. -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | coff-dump.py | FileCheck %s -// I WOULD RUN, BUT THIS FAILS: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -h -s -sr -sd -t | FileCheck %s .def _main; .scl 2; @@ -36,152 +35,134 @@ L_.str2: .asciz "I'm The Last Line." // CHECK: { -// CHECK: MachineType = IMAGE_FILE_MACHINE_I386 (0x14C) -// CHECK: NumberOfSections = 2 -// CHECK: TimeDateStamp = {{[0-9]+}} -// CHECK: PointerToSymbolTable = 0x{{[0-9A-F]+}} -// CHECK: NumberOfSymbols = 7 -// CHECK: SizeOfOptionalHeader = 0 -// CHECK: Characteristics = 0x0 -// CHECK: Sections = [ -// CHECK: 1 = { -// CHECK: Name = .text -// CHECK: VirtualSize = 0 -// CHECK: VirtualAddress = 0 -// CHECK: SizeOfRawData = {{[0-9]+}} -// CHECK: PointerToRawData = 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations = 0x{{[0-9A-F]+}} -// CHECK: PointerToLineNumbers = 0x0 -// CHECK: NumberOfRelocations = 6 -// CHECK: NumberOfLineNumbers = 0 -// CHECK: Charateristics = 0x60500020 -// CHECK: IMAGE_SCN_CNT_CODE -// CHECK: IMAGE_SCN_ALIGN_16BYTES -// CHECK: IMAGE_SCN_MEM_EXECUTE -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: SectionData = -// CHECK: 83 EC 04 C7 04 24 00 00 - 00 00 E8 00 00 00 00 C7 |.....$..........| -// CHECK: 04 24 07 00 00 00 E8 00 - 00 00 00 C7 04 24 10 00 |.$...........$..| -// CHECK: 00 00 E8 00 00 00 00 31 - C0 83 C4 04 C3 |.......1.....| -// CHECK: Relocations = [ -// CHECK: 0 = { -// CHECK: VirtualAddress = 0x6 -// CHECK: SymbolTableIndex = 2 -// CHECK: Type = IMAGE_REL_I386_DIR32 (6) -// CHECK: SymbolName = .data -// CHECK: } -// CHECK: 1 = { -// CHECK: VirtualAddress = 0xB -// CHECK: SymbolTableIndex = 5 -// CHECK: Type = IMAGE_REL_I386_REL32 (20) -// CHECK: SymbolName = _printf -// CHECK: } -// CHECK: 2 = { -// CHECK: VirtualAddress = 0x12 -// CHECK: SymbolTableIndex = 2 -// CHECK: Type = IMAGE_REL_I386_DIR32 (6) -// CHECK: SymbolName = .data -// CHECK: } -// CHECK: 3 = { -// CHECK: VirtualAddress = 0x17 -// CHECK: SymbolTableIndex = 6 -// CHECK: Type = IMAGE_REL_I386_REL32 (20) -// CHECK: SymbolName = _puts -// CHECK: } -// CHECK: 4 = { -// CHECK: VirtualAddress = 0x1E -// CHECK: SymbolTableIndex = 2 -// CHECK: Type = IMAGE_REL_I386_DIR32 (6) -// CHECK: SymbolName = .data -// CHECK: } -// CHECK: 5 = { -// CHECK: VirtualAddress = 0x23 -// CHECK: SymbolTableIndex = 6 -// CHECK: Type = IMAGE_REL_I386_REL32 (20) -// CHECK: SymbolName = _puts -// CHECK: } -// CHECK: ] -// CHECK: } -// CHECK: 2 = { -// CHECK: Name = .data -// CHECK: VirtualSize = 0 -// CHECK: VirtualAddress = 0 -// CHECK: SizeOfRawData = {{[0-9]+}} -// CHECK: PointerToRawData = 0x{{[0-9A-F]+}} -// CHECK: PointerToRelocations = 0x0 -// CHECK: PointerToLineNumbers = 0x0 -// CHECK: NumberOfRelocations = 0 -// CHECK: NumberOfLineNumbers = 0 -// CHECK: Charateristics = 0xC0500040 -// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA -// CHECK: IMAGE_SCN_ALIGN_16BYTES -// CHECK: IMAGE_SCN_MEM_READ -// CHECK: IMAGE_SCN_MEM_WRITE -// CHECK: SectionData = -// CHECK: 48 65 6C 6C 6F 20 00 57 - 6F 72 6C 64 21 00 00 00 |Hello .World!...| -// CHECK: 49 27 6D 20 54 68 65 20 - 4C 61 73 74 20 4C 69 6E |I'm The Last Lin| -// CHECK: 65 2E 00 |e..| -// CHECK: Relocations = None -// CHECK: } +// CHECK: Machine: IMAGE_FILE_MACHINE_I386 (0x14C) +// CHECK: SectionCount: 2 +// CHECK: TimeDateStamp: {{[0-9]+}} +// CHECK: PointerToSymbolTable: 0x{{[0-9A-F]+}} +// CHECK: SymbolCount: 7 +// CHECK: OptionalHeaderSize: 0 +// CHECK: Characteristics [ (0x0) // CHECK: ] -// CHECK: Symbols = [ -// CHECK: 0 = { -// CHECK: Name = .text -// CHECK: Value = 0 -// CHECK: SectionNumber = 1 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) -// CHECK: NumberOfAuxSymbols = 1 -// CHECK: AuxillaryData = -// CHECK: 2D 00 00 00 06 00 00 00 - 00 00 00 00 01 00 00 00 |-...............| -// CHECK: 00 00 |..| - -// CHECK: } -// CHECK: 2 = { -// CHECK: Name = .data -// CHECK: Value = 0 -// CHECK: SectionNumber = 2 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_STATIC (3) -// CHECK: NumberOfAuxSymbols = 1 -// CHECK: AuxillaryData = -// CHECK: 23 00 00 00 00 00 00 00 - 00 00 00 00 02 00 00 00 |#...............| -// CHECK: 00 00 |..| - -// CHECK: } -// CHECK: 4 = { -// CHECK: Name = _main -// CHECK: Value = 0 -// CHECK: SectionNumber = 1 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_FUNCTION (2) -// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) -// CHECK: NumberOfAuxSymbols = 0 -// CHECK: AuxillaryData = - -// CHECK: 5 = { -// CHECK: Name = _printf -// CHECK: Value = 0 -// CHECK: SectionNumber = 0 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) -// CHECK: NumberOfAuxSymbols = 0 -// CHECK: AuxillaryData = - +// CHECK: } +// CHECK: Sections [ +// CHECK: Section { +// CHECK: Number: 1 +// CHECK: Name: .text +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: {{[0-9]+}} +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x{{[0-9A-F]+}} +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 6 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0x60500020) +// CHECK: IMAGE_SCN_ALIGN_16BYTES +// CHECK: IMAGE_SCN_CNT_CODE +// CHECK: IMAGE_SCN_MEM_EXECUTE +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: ] +// CHECK: Relocations [ +// CHECK: 0x6 IMAGE_REL_I386_DIR32 .data +// CHECK: 0xB IMAGE_REL_I386_REL32 _printf +// CHECK: 0x12 IMAGE_REL_I386_DIR32 .data +// CHECK: 0x17 IMAGE_REL_I386_REL32 _puts +// CHECK: 0x1E IMAGE_REL_I386_DIR32 .data +// CHECK: 0x23 IMAGE_REL_I386_REL32 _puts +// CHECK: ] +// CHECK: SectionData ( +// CHECK: 0000: 83EC04C7 04240000 0000E800 000000C7 |.....$..........| +// CHECK: 0010: 04240700 0000E800 000000C7 04241000 |.$...........$..| +// CHECK: 0020: 0000E800 00000031 C083C404 C3 |.......1.....| +// CHECK: ) +// CHECK: } +// CHECK: Section { +// CHECK: Number: 2 +// CHECK: Name: .data +// CHECK: VirtualSize: 0 +// CHECK: VirtualAddress: 0 +// CHECK: RawDataSize: {{[0-9]+}} +// CHECK: PointerToRawData: 0x{{[0-9A-F]+}} +// CHECK: PointerToRelocations: 0x0 +// CHECK: PointerToLineNumbers: 0x0 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Characteristics [ (0xC0500040) +// CHECK: IMAGE_SCN_ALIGN_16BYTES +// CHECK: IMAGE_SCN_CNT_INITIALIZED_DATA +// CHECK: IMAGE_SCN_MEM_READ +// CHECK: IMAGE_SCN_MEM_WRITE +// CHECK: Relocations [ +// CHECK: ] +// CHECK: SectionData ( +// CHECK: 0000: 48656C6C 6F200057 6F726C64 21000000 |Hello .World!...| +// CHECK: 0010: 49276D20 54686520 4C617374 204C696E |I'm The Last Lin| +// CHECK: 0020: 652E00 |e..| +// CHECK: ) +// CHECK: } +// CHECK: ] +// CHECK: Symbols [ +// CHECK: Symbol { +// CHECK: Name: .text +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: 45 +// CHECK: RelocationCount: 6 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: 1 +// CHECK: Selection: 0x0 +// CHECK: Unused: (00 00 00) // CHECK: } -// CHECK: 6 = { -// CHECK: Name = _puts -// CHECK: Value = 0 -// CHECK: SectionNumber = 0 -// CHECK: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) -// CHECK: NumberOfAuxSymbols = 0 -// CHECK: AuxillaryData = - +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: .data +// CHECK: Value: 0 +// CHECK: Section: .data +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: Static +// CHECK: AuxSymbolCount: 1 +// CHECK: AuxSectionDef { +// CHECK: Length: 35 +// CHECK: RelocationCount: 0 +// CHECK: LineNumberCount: 0 +// CHECK: Checksum: 0x0 +// CHECK: Number: 2 +// CHECK: Selection: 0x0 +// CHECK: Unused: (00 00 00) // CHECK: } -// CHECK: ] -// CHECK: } +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _main +// CHECK: Value: 0 +// CHECK: Section: .text +// CHECK: BaseType: Null +// CHECK: ComplexType: Function +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _printf +// CHECK: Value: 0 +// CHECK: Section: (0) +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: Symbol { +// CHECK: Name: _puts +// CHECK: Value: 0 +// CHECK: Section: (0) +// CHECK: BaseType: Null +// CHECK: ComplexType: Null +// CHECK: StorageClass: External +// CHECK: AuxSymbolCount: 0 +// CHECK: } +// CHECK: ] diff --git a/test/MC/COFF/weak-symbol-section-specification.ll b/test/MC/COFF/weak-symbol-section-specification.ll index 5049372959fb..4772c929f29e 100644 --- a/test/MC/COFF/weak-symbol-section-specification.ll +++ b/test/MC/COFF/weak-symbol-section-specification.ll @@ -1,23 +1,25 @@ ; The purpose of this test is to verify that weak linkage type is not ignored by backend, ; if section was specialized. -; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o - | coff-dump.py | FileCheck %s +; RUN: llc -filetype=obj -mtriple i686-pc-win32 %s -o - | llvm-readobj -s -sd | FileCheck %s @a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data" -; CHECK: Name = .data$a -; CHECK-NEXT: VirtualSize = 0 -; CHECK-NEXT: VirtualAddress = 0 -; CHECK-NEXT: SizeOfRawData = {{[0-9]+}} -; CHECK-NEXT: PointerToRawData = 0x{{[0-9A-F]+}} -; CHECK-NEXT: PointerToRelocations = 0x0 -; CHECK-NEXT: PointerToLineNumbers = 0x0 -; CHECK-NEXT: NumberOfRelocations = 0 -; CHECK-NEXT: NumberOfLineNumbers = 0 -; CHECK-NEXT: Charateristics = 0x40401040 +; CHECK: Name: .data$a +; CHECK-NEXT: VirtualSize: 0 +; CHECK-NEXT: VirtualAddress: 0 +; CHECK-NEXT: RawDataSize: {{[0-9]+}} +; CHECK-NEXT: PointerToRawData: 0x{{[0-9A-F]+}} +; CHECK-NEXT: PointerToRelocations: 0x0 +; CHECK-NEXT: PointerToLineNumbers: 0x0 +; CHECK-NEXT: RelocationCount: 0 +; CHECK-NEXT: LineNumberCount: 0 +; CHECK-NEXT: Characteristics [ (0x40401040) +; CHECK-NEXT: IMAGE_SCN_ALIGN_8BYTES ; CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA ; CHECK-NEXT: IMAGE_SCN_LNK_COMDAT -; CHECK-NEXT: IMAGE_SCN_ALIGN_8BYTES ; CHECK-NEXT: IMAGE_SCN_MEM_READ -; CHECK-NEXT: SectionData = -; CHECK-NEXT: 00 00 00 00 00 00 00 00 - 00 00 00 00 +; CHECK-NEXT: ] +; CHECK-NEXT: SectionData ( +; CHECK-NEXT: 0000: 00000000 00000000 00000000 +; CHECK-NEXT: ) diff --git a/test/MC/COFF/weak.s b/test/MC/COFF/weak.s index 0f99313c9c03..b9df0f1df2fd 100644 --- a/test/MC/COFF/weak.s +++ b/test/MC/COFF/weak.s @@ -1,7 +1,8 @@ // This tests that default-null weak symbols (a GNU extension) are created // properly via the .weak directive. -// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 < %s | coff-dump.py | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -t | FileCheck %s +// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -t | FileCheck %s .def _main; .scl 2; @@ -17,7 +18,7 @@ _main: # @main testl %eax, %eax je LBB0_2 # BB#1: # %if.then - calll _test_weak + call _test_weak movl $1, %eax addl $4, %esp ret @@ -28,24 +29,47 @@ LBB0_2: # %return .weak _test_weak -// CHECK: Symbols = [ - -// CHECK: Name = _test_weak -// CHECK-NEXT: Value = 0 -// CHECK-NEXT: SectionNumber = 0 -// CHECK-NEXT: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK-NEXT: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK-NEXT: StorageClass = IMAGE_SYM_CLASS_WEAK_EXTERNAL (105) -// CHECK-NEXT: NumberOfAuxSymbols = 1 -// CHECK-NEXT: AuxillaryData = -// CHECK-NEXT: 05 00 00 00 02 00 00 00 - 00 00 00 00 00 00 00 00 |................| -// CHECK-NEXT: 00 00 |..| - -// CHECK: Name = .weak._test_weak.default -// CHECK-NEXT: Value = 0 -// CHECK-NEXT: SectionNumber = 65535 -// CHECK-NEXT: SimpleType = IMAGE_SYM_TYPE_NULL (0) -// CHECK-NEXT: ComplexType = IMAGE_SYM_DTYPE_NULL (0) -// CHECK-NEXT: StorageClass = IMAGE_SYM_CLASS_EXTERNAL (2) -// CHECK-NEXT: NumberOfAuxSymbols = 0 -// CHECK-NEXT: AuxillaryData = + .weak _test_weak_alias + _test_weak_alias=_main + +// CHECK: Symbols [ + +// CHECK: Symbol { +// CHECK: Name: _test_weak +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: (0) +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: WeakExternal +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxWeakExternal { +// CHECK-NEXT: Linked: .weak._test_weak.default +// CHECK-NEXT: Search: Library +// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00) +// CHECK-NEXT: } +// CHECK-NEXT: } + +// CHECK: Symbol { +// CHECK: Name: .weak._test_weak.default +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: (-1) +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: External +// CHECK-NEXT: AuxSymbolCount: 0 +// CHECK-NEXT: } + +// CHECK: Symbol { +// CHECK: Name: _test_weak_alias +// CHECK-NEXT: Value: 0 +// CHECK-NEXT: Section: (0) +// CHECK-NEXT: BaseType: Null +// CHECK-NEXT: ComplexType: Null +// CHECK-NEXT: StorageClass: WeakExternal +// CHECK-NEXT: AuxSymbolCount: 1 +// CHECK-NEXT: AuxWeakExternal { +// CHECK-NEXT: Linked: _main +// CHECK-NEXT: Search: Library +// CHECK-NEXT: Unused: (00 00 00 00 00 00 00 00 00 00) +// CHECK-NEXT: } +// CHECK-NEXT: } |