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