[HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (#117017)
[llvm-project.git] / llvm / test / MC / COFF / weak.s
blobe700aabc2425390164bbf01922870fac41cb65c9
1 // This tests that default-null weak symbols (a GNU extension) are created
2 // properly via the .weak directive.
4 // RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj --symbols - | FileCheck %s
5 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj --symbols - | FileCheck %s
7 .def _main;
8 .scl 2;
9 .type 32;
10 .endef
11 .text
12 .globl _main
13 .align 16, 0x90
14 _main: # @main
15 # %bb.0: # %entry
16 subl $4, %esp
17 movl $_test_weak, %eax
18 testl %eax, %eax
19 je LBB0_2
20 # %bb.1: # %if.then
21 call _test_weak
22 movl $1, %eax
23 addl $4, %esp
24 ret
25 LBB0_2: # %return
26 xorl %eax, %eax
27 addl $4, %esp
28 ret
30 .weak _test_weak
32 .weak _test_weak_alias
33 _test_weak_alias=_main
35 .weak weakfunc
36 .globl weakfunc
37 weakfunc:
38 ret
40 // CHECK: Symbols [
42 // CHECK: Symbol {
43 // CHECK: Name: _main
44 // CHECK-NEXT: Value: 0
45 // CHECK-NEXT: Section: .text
46 // CHECK-NEXT: BaseType: Null
47 // CHECK-NEXT: ComplexType: Function
48 // CHECK-NEXT: StorageClass: External
49 // CHECK-NEXT: AuxSymbolCount: 0
50 // CHECK-NEXT: }
52 // CHECK: Symbol {
53 // CHECK: Name: _test_weak
54 // CHECK-NEXT: Value: 0
55 // CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED
56 // CHECK-NEXT: BaseType: Null
57 // CHECK-NEXT: ComplexType: Null
58 // CHECK-NEXT: StorageClass: WeakExternal
59 // CHECK-NEXT: AuxSymbolCount: 1
60 // CHECK-NEXT: AuxWeakExternal {
61 // CHECK-NEXT: Linked: .weak._test_weak.default
62 // CHECK-NEXT: Search: Alias
63 // CHECK-NEXT: }
64 // CHECK-NEXT: }
66 // CHECK: Symbol {
67 // CHECK: Name: .weak._test_weak.default._main
68 // CHECK-NEXT: Value: 0
69 // CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE
70 // CHECK-NEXT: BaseType: Null
71 // CHECK-NEXT: ComplexType: Null
72 // CHECK-NEXT: StorageClass: External
73 // CHECK-NEXT: AuxSymbolCount: 0
74 // CHECK-NEXT: }
76 // CHECK: Symbol {
77 // CHECK: Name: _test_weak_alias
78 // CHECK-NEXT: Value: 0
79 // CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED
80 // CHECK-NEXT: BaseType: Null
81 // CHECK-NEXT: ComplexType: Null
82 // CHECK-NEXT: StorageClass: WeakExternal
83 // CHECK-NEXT: AuxSymbolCount: 1
84 // CHECK-NEXT: AuxWeakExternal {
85 // CHECK-NEXT: Linked: _main
86 // CHECK-NEXT: Search: Alias
87 // CHECK-NEXT: }
88 // CHECK-NEXT: }
90 // CHECK: Symbol {
91 // CHECK: Name: weakfunc
92 // CHECK-NEXT: Value: 0
93 // CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED
94 // CHECK-NEXT: BaseType: Null
95 // CHECK-NEXT: ComplexType: Null
96 // CHECK-NEXT: StorageClass: WeakExternal
97 // CHECK-NEXT: AuxSymbolCount: 1
98 // CHECK-NEXT: AuxWeakExternal {
99 // CHECK-NEXT: Linked: .weak.weakfunc.default
100 // CHECK-NEXT: Search: Alias
101 // CHECK-NEXT: }
102 // CHECK-NEXT: }
103 // CHECK: Symbol {
104 // CHECK: Name: .weak.weakfunc.default
105 // CHECK-NOT: Value: 0
106 // CHECK-NOT: Symbol {
107 // CHECK: Section: .text
108 // CHECK-NEXT: BaseType: Null
109 // CHECK-NEXT: ComplexType: Null
110 // CHECK-NEXT: StorageClass: External
111 // CHECK-NEXT: AuxSymbolCount: 0
112 // CHECK-NEXT: }