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
5
6## Check that __bss takes up zero file size, is at file offset zero, and
7## appears at the end of its segment.
8
9# CHECK:        Index: 1
10# CHECK-NEXT:   Name: __data
11# CHECK-NEXT:   Segment: __DATA
12# CHECK-NEXT:   Address:
13# CHECK-NEXT:   Size: 0x8
14# CHECK-NEXT:   Offset: 4096
15# CHECK-NEXT:   Alignment: 0
16# CHECK-NEXT:   RelocationOffset: 0x0
17# CHECK-NEXT:   RelocationCount: 0
18# CHECK-NEXT:   Type: Regular (0x0)
19# CHECK-NEXT:   Attributes [ (0x0)
20# CHECK-NEXT:   ]
21# CHECK-NEXT:   Reserved1: 0x0
22# CHECK-NEXT:   Reserved2: 0x0
23# CHECK-NEXT:   Reserved3: 0x0
24
25# CHECK:        Index: 2
26# CHECK-NEXT:   Name: __bss
27# CHECK-NEXT:   Segment: __DATA
28# CHECK-NEXT:   Address:
29# CHECK-NEXT:   Size: 0x8
30# CHECK-NEXT:   Offset: 0
31# CHECK-NEXT:   Alignment: 0
32# CHECK-NEXT:   RelocationOffset: 0x0
33# CHECK-NEXT:   RelocationCount: 0
34# CHECK-NEXT:   Type: ZeroFill (0x1)
35# CHECK-NEXT:   Attributes [ (0x0)
36# CHECK-NEXT:   ]
37# CHECK-NEXT:   Reserved1: 0x0
38# CHECK-NEXT:   Reserved2: 0x0
39# CHECK-NEXT:   Reserved3: 0x0
40
41# CHECK:        Index: 3
42# CHECK-NEXT:   Name: __thread_bss
43# CHECK-NEXT:   Segment: __DATA
44# CHECK-NEXT:   Address: 0x100001010
45# CHECK-NEXT:   Size: 0x4
46# CHECK-NEXT:   Offset: 0
47# CHECK-NEXT:   Alignment: 0
48# CHECK-NEXT:   RelocationOffset: 0x0
49# CHECK-NEXT:   RelocationCount: 0
50# CHECK-NEXT:   Type: ThreadLocalZerofill (0x12)
51# CHECK-NEXT:   Attributes [ (0x0)
52# CHECK-NEXT:   ]
53# CHECK-NEXT:   Reserved1: 0x0
54# CHECK-NEXT:   Reserved2: 0x0
55# CHECK-NEXT:   Reserved3: 0x0
56
57# CHECK:      Name: __DATA
58# CHECK-NEXT: Size:
59# CHECK-NEXT: vmaddr:
60# CHECK-NEXT: vmsize: 0x14
61# CHECK-NEXT: fileoff:
62# CHECK-NEXT: filesize: 8
63
64.globl _main
65
66.text
67_main:
68  movq $0, %rax
69  retq
70
71.bss
72.zero 4
73
74.tbss _foo, 4
75.zero 4
76
77.data
78.quad 0x1234
79