Revert "coff also doesn't have a ReadOnlySection yet, (!)"
[oota-llvm.git] / test / MC / COFF / weak-symbol.ll
1 ; Test that weak functions and globals are placed into selectany COMDAT\r
2 ; sections with the mangled name as suffix. Ensure that the weak linkage\r
3 ; type is not ignored by the backend if the section was specialized.\r
4 ;\r
5 ; RUN: llc -mtriple=i686-pc-win32 %s     -o - | FileCheck %s --check-prefix=X86\r
6 ; RUN: llc -mtriple=i686-pc-mingw32 %s   -o - | FileCheck %s --check-prefix=X86\r
7 ; RUN: llc -mtriple=x86_64-pc-win32 %s   -o - | FileCheck %s --check-prefix=X64\r
8 ; RUN: llc -mtriple=x86_64-pc-mingw32 %s -o - | FileCheck %s --check-prefix=X64\r
9 \r
10 ; Mangled function\r
11 ; X86: .section .text$_Z3foo\r
12 ; X86: .linkonce discard\r
13 ; X86: .globl __Z3foo\r
14 ;\r
15 ; X64: .section .text$_Z3foo\r
16 ; X64: .linkonce discard\r
17 ; X64: .globl _Z3foo\r
18 define weak void @_Z3foo() {\r
19   ret void\r
20 }\r
21 \r
22 ; Unmangled function\r
23 ; X86: .section .sect$f\r
24 ; X86: .linkonce discard\r
25 ; X86: .globl _f\r
26 ;\r
27 ; X64: .section .sect$f\r
28 ; X64: .linkonce discard\r
29 ; X64: .globl f\r
30 define weak void @f() section ".sect" {\r
31   ret void\r
32 }\r
33 \r
34 ; Weak global\r
35 ; X86: .section .data$a\r
36 ; X86: .linkonce discard\r
37 ; X86: .globl _a\r
38 ; X86: .zero 12\r
39 ;\r
40 ; X64: .section .data$a\r
41 ; X64: .linkonce discard\r
42 ; X64: .globl a\r
43 ; X64: .zero 12\r
44 @a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data"\r