xref: /aosp_15_r20/external/llvm/test/MC/COFF/comm-align.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc -triple i686-windows-gnu -filetype obj -o - %s \
2*9880d681SAndroid Build Coastguard Worker# RUN:    | llvm-readobj -coff-directives -symbols | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker# NOTE: this test checks multiple things:
5*9880d681SAndroid Build Coastguard Worker# - that -aligncomm is not emitted for 1-byte alignment
6*9880d681SAndroid Build Coastguard Worker# - that -aligncomm is emitted for the various alignments (greater than 1)
7*9880d681SAndroid Build Coastguard Worker# - that the alignment is represented as a log_2 of the alignment
8*9880d681SAndroid Build Coastguard Worker# - that the section switching occurs correctly
9*9880d681SAndroid Build Coastguard Worker# - that functions after the switch also are emitted into the correct section
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker	.text
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker	.def _a
14*9880d681SAndroid Build Coastguard Worker		.scl 3
15*9880d681SAndroid Build Coastguard Worker		.type 32
16*9880d681SAndroid Build Coastguard Worker	.endef
17*9880d681SAndroid Build Coastguard Worker_a:
18*9880d681SAndroid Build Coastguard Worker	ret
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker	.data
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker	.comm _s_1,4,0                  # @s_1
23*9880d681SAndroid Build Coastguard Worker	.comm _s_2,4,1                  # @s_2
24*9880d681SAndroid Build Coastguard Worker	.comm _s_4,4,2                  # @s_3
25*9880d681SAndroid Build Coastguard Worker	.comm _s_8,4,3                  # @s_4
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker	.comm _small_but_overaligned,1,3                  # @s_4
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker	.text
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker	.def _b
32*9880d681SAndroid Build Coastguard Worker		.scl 3
33*9880d681SAndroid Build Coastguard Worker		.type 32
34*9880d681SAndroid Build Coastguard Worker	.endef
35*9880d681SAndroid Build Coastguard Worker_b:
36*9880d681SAndroid Build Coastguard Worker	ret
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: -aligncomm:"_s_1",0
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker# CHECK: Symbols [
41*9880d681SAndroid Build Coastguard Worker# CHECK:   Symbol {
42*9880d681SAndroid Build Coastguard Worker# CHECK:     Name: _a
43*9880d681SAndroid Build Coastguard Worker# CHECK:     Section: .text (1)
44*9880d681SAndroid Build Coastguard Worker# CHECK:   }
45*9880d681SAndroid Build Coastguard Worker# CHECK:   Symbol {
46*9880d681SAndroid Build Coastguard Worker# CHECK:     Name: _small_but_overaligned
47*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:Value: 1
48*9880d681SAndroid Build Coastguard Worker# CHECK-NEXT:Section: IMAGE_SYM_UNDEFINED (0)
49*9880d681SAndroid Build Coastguard Worker# CHECK:   }
50*9880d681SAndroid Build Coastguard Worker# CHECK:   Symbol {
51*9880d681SAndroid Build Coastguard Worker# CHECK:     Name: _b
52*9880d681SAndroid Build Coastguard Worker# CHECK:     Section: .text (1)
53*9880d681SAndroid Build Coastguard Worker# CHECK:   }
54*9880d681SAndroid Build Coastguard Worker# CHECK: ]
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Worker# CHECK: Directive(s): -aligncomm:"_s_2",1 -aligncomm:"_s_4",2 -aligncomm:"_s_8",3 -aligncomm:"_small_but_overaligned",3
57*9880d681SAndroid Build Coastguard Worker
58