aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/COFF/weak-symbol.ll
blob: f23063e59c92c5b8a99c9a93641d7b30e63e6fa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
; 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,"r",discard,_a
; X86: .globl _a
; X86: .zero 12
;
; X64: .section .data,"r",discard,a
; X64: .globl a
; X64: .zero 12
@a = weak unnamed_addr constant { i32, i32, i32 } { i32 0, i32 0, i32 0}, section ".data"