Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / bss.s
blobd773e6762b14cda133216a8ec2298705c30aa679
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
3 # RUN: %lld -o %t %t.o
4 # RUN: llvm-readobj --section-headers --macho-segment %t | FileCheck %s
6 ## Check that __bss takes up zero file size, is at file offset zero, and appears
7 ## at the end of its segment. Also check that __tbss is placed immediately
8 ## before it.
9 ## Zerofill sections in other segments (i.e. not __DATA) should also be placed
10 ## at the end.
12 # CHECK: Index: 1
13 # CHECK-NEXT: Name: __data
14 # CHECK-NEXT: Segment: __DATA
15 # CHECK-NEXT: Address:
16 # CHECK-NEXT: Size: 0x8
17 # CHECK-NEXT: Offset: 4096
18 # CHECK-NEXT: Alignment: 0
19 # CHECK-NEXT: RelocationOffset: 0x0
20 # CHECK-NEXT: RelocationCount: 0
21 # CHECK-NEXT: Type: Regular (0x0)
22 # CHECK-NEXT: Attributes [ (0x0)
23 # CHECK-NEXT: ]
24 # CHECK-NEXT: Reserved1: 0x0
25 # CHECK-NEXT: Reserved2: 0x0
26 # CHECK-NEXT: Reserved3: 0x0
28 # CHECK: Index: 2
29 # CHECK-NEXT: Name: __thread_bss
30 # CHECK-NEXT: Segment: __DATA
31 # CHECK-NEXT: Address:
32 # CHECK-NEXT: Size: 0x4
33 # CHECK-NEXT: Offset: 0
34 # CHECK-NEXT: Alignment: 0
35 # CHECK-NEXT: RelocationOffset: 0x0
36 # CHECK-NEXT: RelocationCount: 0
37 # CHECK-NEXT: Type: ThreadLocalZerofill (0x12)
38 # CHECK-NEXT: Attributes [ (0x0)
39 # CHECK-NEXT: ]
40 # CHECK-NEXT: Reserved1: 0x0
41 # CHECK-NEXT: Reserved2: 0x0
42 # CHECK-NEXT: Reserved3: 0x0
44 # CHECK: Index: 3
45 # CHECK-NEXT: Name: __bss
46 # CHECK-NEXT: Segment: __DATA
47 # CHECK-NEXT: Address:
48 # CHECK-NEXT: Size: 0x10000
49 # CHECK-NEXT: Offset: 0
50 # CHECK-NEXT: Alignment: 0
51 # CHECK-NEXT: RelocationOffset: 0x0
52 # CHECK-NEXT: RelocationCount: 0
53 # CHECK-NEXT: Type: ZeroFill (0x1)
54 # CHECK-NEXT: Attributes [ (0x0)
55 # CHECK-NEXT: ]
56 # CHECK-NEXT: Reserved1: 0x0
57 # CHECK-NEXT: Reserved2: 0x0
58 # CHECK-NEXT: Reserved3: 0x0
60 # CHECK: Index: 4
61 # CHECK-NEXT: Name: foo
62 # CHECK-NEXT: Segment: FOO
63 # CHECK-NEXT: Address:
64 # CHECK-NEXT: Size: 0x8
65 # CHECK-NEXT: Offset: 8192
66 # CHECK-NEXT: Alignment: 0
67 # CHECK-NEXT: RelocationOffset: 0x0
68 # CHECK-NEXT: RelocationCount: 0
69 # CHECK-NEXT: Type: Regular (0x0)
70 # CHECK-NEXT: Attributes [ (0x0)
71 # CHECK-NEXT: ]
72 # CHECK-NEXT: Reserved1: 0x0
73 # CHECK-NEXT: Reserved2: 0x0
74 # CHECK-NEXT: Reserved3: 0x0
76 # CHECK: Index: 5
77 # CHECK-NEXT: Name: bss
78 # CHECK-NEXT: Segment: FOO
79 # CHECK-NEXT: Address:
80 # CHECK-NEXT: Size: 0x8
81 # CHECK-NEXT: Offset: 0
82 # CHECK-NEXT: Alignment: 0
83 # CHECK-NEXT: RelocationOffset: 0x0
84 # CHECK-NEXT: RelocationCount: 0
85 # CHECK-NEXT: Type: ZeroFill (0x1)
86 # CHECK-NEXT: Attributes [ (0x0)
87 # CHECK-NEXT: ]
88 # CHECK-NEXT: Reserved1: 0x0
89 # CHECK-NEXT: Reserved2: 0x0
90 # CHECK-NEXT: Reserved3: 0x0
92 # CHECK: Name: __DATA
93 # CHECK-NEXT: Size:
94 # CHECK-NEXT: vmaddr:
95 # CHECK-NEXT: vmsize: 0x11000
96 # CHECK-NEXT: fileoff:
97 # CHECK-NEXT: filesize: 4096
99 # CHECK: Name: FOO
100 # CHECK-NEXT: Size:
101 # CHECK-NEXT: vmaddr:
102 # CHECK-NEXT: vmsize: 0x9000
103 # CHECK-NEXT: fileoff:
104 # CHECK-NEXT: filesize: 4096
106 .globl _main
108 .text
109 _main:
110 movq $0, %rax
111 retq
113 .bss
114 .zero 0x8000
116 .tbss _foo, 4
117 .zero 0x8000
119 .data
120 .quad 0x1234
122 .zerofill FOO,bss,_zero_foo,0x8000
124 .section FOO,foo
125 .quad 123