diff options
Diffstat (limited to 'llvm/test/MC/COFF')
-rw-r--r-- | llvm/test/MC/COFF/bss_section.ll | 3 | ||||
-rw-r--r-- | llvm/test/MC/COFF/const-gv-with-rel-init.ll | 2 | ||||
-rw-r--r-- | llvm/test/MC/COFF/weak-symbol.ll | 48 |
3 files changed, 50 insertions, 3 deletions
diff --git a/llvm/test/MC/COFF/bss_section.ll b/llvm/test/MC/COFF/bss_section.ll index f80a0712b7e..1921eeb61a6 100644 --- a/llvm/test/MC/COFF/bss_section.ll +++ b/llvm/test/MC/COFF/bss_section.ll @@ -5,6 +5,5 @@ @"\01?thingy@@3Ufoo@@B" = global %struct.foo zeroinitializer, align 4 ; CHECK: .bss -$thingy_linkonce = comdat any -@thingy_linkonce = linkonce_odr global %struct.foo zeroinitializer, comdat, align 4 +@thingy_linkonce = linkonce_odr global %struct.foo zeroinitializer, align 4 ; CHECK: .section .bss,"wb",discard,_thingy_linkonce diff --git a/llvm/test/MC/COFF/const-gv-with-rel-init.ll b/llvm/test/MC/COFF/const-gv-with-rel-init.ll index 6a89e2faa68..7d3c5f63188 100644 --- a/llvm/test/MC/COFF/const-gv-with-rel-init.ll +++ b/llvm/test/MC/COFF/const-gv-with-rel-init.ll @@ -8,4 +8,4 @@ define void @f() { ; CHECK: .section .CRT$XLB,"rd" @weak_array = weak_odr unnamed_addr constant [1 x i8*] [i8* bitcast (void ()* @f to i8*)] -; CHECK: .section .rdata,"rd" +; CHECK: .section .rdata,"rd",discard,weak_array diff --git a/llvm/test/MC/COFF/weak-symbol.ll b/llvm/test/MC/COFF/weak-symbol.ll new file mode 100644 index 00000000000..fd78307c1f2 --- /dev/null +++ b/llvm/test/MC/COFF/weak-symbol.ll @@ -0,0 +1,48 @@ +; 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
|