aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/COFF
diff options
context:
space:
mode:
Diffstat (limited to 'test/MC/COFF')
-rw-r--r--test/MC/COFF/bss_section.ll5
-rw-r--r--test/MC/COFF/const-gv-with-rel-init.ll4
-rw-r--r--test/MC/COFF/diff.s25
-rw-r--r--test/MC/COFF/directive-section-characteristics.ll6
-rw-r--r--test/MC/COFF/global_ctors_dtors.ll12
-rw-r--r--test/MC/COFF/initialised-data.ll2
-rwxr-xr-xtest/MC/COFF/linker-options.ll10
-rw-r--r--test/MC/COFF/section-passthru-flags.s4
-rw-r--r--test/MC/COFF/seh-section.s74
-rw-r--r--test/MC/COFF/weak-symbol.ll48
10 files changed, 119 insertions, 71 deletions
diff --git a/test/MC/COFF/bss_section.ll b/test/MC/COFF/bss_section.ll
index 1921eeb..d3a8aec 100644
--- a/test/MC/COFF/bss_section.ll
+++ b/test/MC/COFF/bss_section.ll
@@ -5,5 +5,6 @@
@"\01?thingy@@3Ufoo@@B" = global %struct.foo zeroinitializer, align 4
; CHECK: .bss
-@thingy_linkonce = linkonce_odr global %struct.foo zeroinitializer, align 4
-; CHECK: .section .bss,"wb",discard,_thingy_linkonce
+$thingy_linkonce = comdat any
+@thingy_linkonce = linkonce_odr global %struct.foo zeroinitializer, comdat, align 4
+; CHECK: .section .bss,"bw",discard,_thingy_linkonce
diff --git a/test/MC/COFF/const-gv-with-rel-init.ll b/test/MC/COFF/const-gv-with-rel-init.ll
index 7d3c5f6..fde5a17 100644
--- a/test/MC/COFF/const-gv-with-rel-init.ll
+++ b/test/MC/COFF/const-gv-with-rel-init.ll
@@ -5,7 +5,7 @@ define void @f() {
}
@ptr = constant void ()* @f, section ".CRT$XLB", align 8
-; CHECK: .section .CRT$XLB,"rd"
+; CHECK: .section .CRT$XLB,"dr"
@weak_array = weak_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @f to i8*)]
-; CHECK: .section .rdata,"rd",discard,weak_array
+; CHECK: .section .rdata,"dr"
diff --git a/test/MC/COFF/diff.s b/test/MC/COFF/diff.s
index 820272a..5111600 100644
--- a/test/MC/COFF/diff.s
+++ b/test/MC/COFF/diff.s
@@ -1,5 +1,23 @@
// RUN: llvm-mc -filetype=obj -triple i686-pc-mingw32 %s | llvm-readobj -s -sr -sd | FileCheck %s
+.section baz, "xr"
+ .def X
+ .scl 2;
+ .type 32;
+ .endef
+ .globl X
+X:
+ mov Y-X+42, %eax
+ retl
+
+ .def Y
+ .scl 2;
+ .type 32;
+ .endef
+ .globl Y
+Y:
+ retl
+
.def _foobar;
.scl 2;
.type 32;
@@ -30,3 +48,10 @@ _rust_crate:
// CHECK: SectionData (
// CHECK-NEXT: 0000: 00000000 00000000 1C000000 20000000
// CHECK-NEXT: )
+
+// CHECK: Name: baz
+// CHECK: Relocations [
+// CHECK-NEXT: ]
+// CHECK: SectionData (
+// CHECK-NEXT: 0000: A1300000 00C3C3
+// CHECK-NEXT: )
diff --git a/test/MC/COFF/directive-section-characteristics.ll b/test/MC/COFF/directive-section-characteristics.ll
index ca8102a..a44c81d 100644
--- a/test/MC/COFF/directive-section-characteristics.ll
+++ b/test/MC/COFF/directive-section-characteristics.ll
@@ -7,7 +7,13 @@ entry:
}
; CHECK: Section {
+; CHECK: Name: .text
+; CHECK: PointerToRawData: 0xB4
+; CHECK: }
+
+; CHECK: Section {
; CHECK: Name: .drectve
+; CHECK: PointerToRawData: 0xB8
; CHECK: Characteristics [
; CHECK: IMAGE_SCN_ALIGN_1BYTES
; CHECK: IMAGE_SCN_LNK_INFO
diff --git a/test/MC/COFF/global_ctors_dtors.ll b/test/MC/COFF/global_ctors_dtors.ll
index ca17f24..be92c27 100644
--- a/test/MC/COFF/global_ctors_dtors.ll
+++ b/test/MC/COFF/global_ctors_dtors.ll
@@ -49,17 +49,17 @@ define i32 @main() nounwind {
ret i32 0
}
-; WIN32: .section .CRT$XCU,"rd"
+; WIN32: .section .CRT$XCU,"dr"
; WIN32: a_global_ctor
-; WIN32: .section .CRT$XCU,"rd",associative,{{_?}}b
+; WIN32: .section .CRT$XCU,"dr",associative,{{_?}}b
; WIN32: b_global_ctor
; WIN32-NOT: c_global_ctor
-; WIN32: .section .CRT$XTX,"rd"
+; WIN32: .section .CRT$XTX,"dr"
; WIN32: a_global_dtor
-; MINGW32: .section .ctors,"wd"
+; MINGW32: .section .ctors,"dw"
; MINGW32: a_global_ctor
-; MINGW32: .section .ctors,"wd",associative,{{_?}}b
+; MINGW32: .section .ctors,"dw",associative,{{_?}}b
; MINGW32: b_global_ctor
; MINGW32-NOT: c_global_ctor
-; MINGW32: .section .dtors,"wd"
+; MINGW32: .section .dtors,"dw"
; MINGW32: a_global_dtor
diff --git a/test/MC/COFF/initialised-data.ll b/test/MC/COFF/initialised-data.ll
index c428469..a2faac7 100644
--- a/test/MC/COFF/initialised-data.ll
+++ b/test/MC/COFF/initialised-data.ll
@@ -3,5 +3,5 @@
@data = dllexport constant [5 x i8] c"data\00", align 1
-; CHECK: .section .rdata,"rd"
+; CHECK: .section .rdata,"dr"
diff --git a/test/MC/COFF/linker-options.ll b/test/MC/COFF/linker-options.ll
index 60baccf..afc55af 100755
--- a/test/MC/COFF/linker-options.ll
+++ b/test/MC/COFF/linker-options.ll
@@ -1,12 +1,6 @@
; 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 !"/DEFAULTLIB:C:\5Cpath to\5Casan_rt.lib" },
- metadata !{ metadata !"/with spaces" } } }
+!0 = !{i32 6, !"Linker Options", !{!{!"/DEFAULTLIB:msvcrt.lib"}, !{!"/DEFAULTLIB:msvcrt.lib", !"/DEFAULTLIB:secur32.lib"}, !{!"/DEFAULTLIB:\22C:\5Cpath to\5Casan_rt.lib\22"}, !{!"\22/with spaces\22"}}}
!llvm.module.flags = !{ !0 }
@@ -18,6 +12,6 @@ define dllexport void @foo() {
; CHECK: .ascii " /DEFAULTLIB:msvcrt.lib"
; CHECK: .ascii " /DEFAULTLIB:msvcrt.lib"
; CHECK: .ascii " /DEFAULTLIB:secur32.lib"
-; CHECK: .ascii " \"/DEFAULTLIB:C:\\path to\\asan_rt.lib\""
+; CHECK: .ascii " /DEFAULTLIB:\"C:\\path to\\asan_rt.lib\""
; CHECK: .ascii " \"/with spaces\""
; CHECK: .ascii " /EXPORT:_foo"
diff --git a/test/MC/COFF/section-passthru-flags.s b/test/MC/COFF/section-passthru-flags.s
index 3bd061b..96e42d2 100644
--- a/test/MC/COFF/section-passthru-flags.s
+++ b/test/MC/COFF/section-passthru-flags.s
@@ -3,5 +3,5 @@
// CHECK: .section .klaatu,"wn"
.section .barada,"y"
// CHECK: .section .barada,"y"
-.section .nikto,"wds"
-// CHECK: .section .nikto,"wds"
+.section .nikto,"dws"
+// CHECK: .section .nikto,"dws"
diff --git a/test/MC/COFF/seh-section.s b/test/MC/COFF/seh-section.s
index 026c0d7..c95eece 100644
--- a/test/MC/COFF/seh-section.s
+++ b/test/MC/COFF/seh-section.s
@@ -1,5 +1,7 @@
-// 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).
+// This test ensures functions in custom sections get unwind info emitted in a
+// distinct .xdata section. Ideally we'd just emit a second .xdata section with
+// the same name and characteristics, but MC uniques sections by name and
+// characteristics, so that is not possible.
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -s -sd | FileCheck %s
// CHECK: Name: .xdata$foo
@@ -20,6 +22,44 @@
// CHECK-NEXT: 0000: 01050200 05500402
// CHECK-NEXT: )
+// CHECK: Name: .xdata$.mytext
+// CHECK-NEXT: VirtualSize
+// CHECK-NEXT: VirtualAddress
+// CHECK-NEXT: RawDataSize: 8
+// CHECK-NEXT: PointerToRawData
+// CHECK-NEXT: PointerToRelocations
+// CHECK-NEXT: PointerToLineNumbers
+// 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: ]
+// CHECK-NEXT: SectionData (
+// CHECK-NEXT: 0000: 01050200 05500402
+// CHECK-NEXT: )
+
+// CHECK: Name: .xdata
+// CHECK-NEXT: VirtualSize
+// CHECK-NEXT: VirtualAddress
+// CHECK-NEXT: RawDataSize: 8
+// CHECK-NEXT: PointerToRawData
+// CHECK-NEXT: PointerToRelocations
+// CHECK-NEXT: PointerToLineNumbers
+// 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: ]
+// CHECK-NEXT: SectionData (
+// CHECK-NEXT: 0000: 01050200 05500402
+// CHECK-NEXT: )
+
+
+
.section .text$foo,"x"
.globl foo
.def foo; .scl 2; .type 32; .endef
@@ -35,3 +75,33 @@ foo:
ret
.seh_endproc
+ .section .mytext,"x"
+ .globl bar
+ .def bar; .scl 2; .type 32; .endef
+ .seh_proc bar
+bar:
+ subq $8, %rsp
+ .seh_stackalloc 8
+ pushq %rbp
+ .seh_pushreg %rbp
+ .seh_endprologue
+ popq %rbp
+ addq $8, %rsp
+ ret
+ .seh_endproc
+
+ .section .text
+ .globl baz
+ .def baz; .scl 2; .type 32; .endef
+ .seh_proc baz
+baz:
+ subq $8, %rsp
+ .seh_stackalloc 8
+ pushq %rbp
+ .seh_pushreg %rbp
+ .seh_endprologue
+ popq %rbp
+ addq $8, %rsp
+ ret
+ .seh_endproc
+
diff --git a/test/MC/COFF/weak-symbol.ll b/test/MC/COFF/weak-symbol.ll
deleted file mode 100644
index fd78307..0000000
--- a/test/MC/COFF/weak-symbol.ll
+++ /dev/null
@@ -1,48 +0,0 @@
-; Test that weak functions and globals are placed into selectany COMDAT
-; sections with the mangled name as suffix. Ensure that the weak linkage
-; type is not ignored by the backend if the section was specialized.
-;
-; RUN: llc -mtriple=i686-pc-win32 %s -o - | FileCheck %s --check-prefix=X86
-; RUN: llc -mtriple=i686-pc-mingw32 %s -o - | FileCheck %s --check-prefix=X86
-; RUN: llc -mtriple=x86_64-pc-win32 %s -o - | FileCheck %s --check-prefix=X64
-; RUN: llc -mtriple=x86_64-pc-mingw32 %s -o - | FileCheck %s --check-prefix=X64
-
-; Mangled function
-; X86: .section .text,"xr",discard,__Z3foo
-; X86: .globl __Z3foo
-;
-; X64: .section .text,"xr",discard,_Z3foo
-; X64: .globl _Z3foo
-define weak void @_Z3foo() {
- ret void
-}
-
-; Unmangled function
-; X86: .section .sect,"xr",discard,_f
-; X86: .globl _f
-;
-; X64: .section .sect,"xr",discard,f
-; X64: .globl f
-define weak void @f() section ".sect" {
- ret void
-}
-
-; Weak global
-; X86: .section .data,"rd",discard,_a
-; X86: .globl _a
-; X86: .zero 12
-;
-; X64: .section .data,"rd",discard,a
-; X64: .globl a
-; X64: .zero 12
-@a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data"
-
-; X86: .section .tls$,"wd",discard,_b
-; X86: .globl _b
-; X86: .long 0
-;
-; X64: .section .tls$,"wd",discard,b
-; X64: .globl b
-; X64: .long 0
-
-@b = weak_odr thread_local global i32 0, align 4