1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3
4# RUN: echo "SECTIONS { \
5# RUN:   .aaa         : { *(.aaa) } \
6# RUN:   .bbb         : { *(.bbb) } \
7# RUN:   .ccc         : { *(.ccc) } \
8# RUN:   _aaa = SIZEOF(.aaa); \
9# RUN:   _bbb = SIZEOF(.bbb); \
10# RUN:   _ccc = SIZEOF(.ccc); \
11# RUN:   _ddd = SIZEOF(.not_exist); \
12# RUN: }" > %t.script
13# RUN: ld.lld -T %t.script %t.o -o %t
14# RUN: llvm-readelf -S -s %t | FileCheck %s
15
16# CHECK:      Name Type     Address          Off    Size
17# CHECK:      .aaa PROGBITS 0000000000000000 001000 000008
18# CHECK-NEXT: .bbb PROGBITS 0000000000000008 001008 000010
19# CHECK-NEXT: .ccc PROGBITS 0000000000000018 001018 000018
20
21# CHECK:        Value          Size Type   Bind   Vis     Ndx Name
22# CHECK:      0000000000000008    0 NOTYPE GLOBAL DEFAULT ABS _aaa
23# CHECK-NEXT: 0000000000000010    0 NOTYPE GLOBAL DEFAULT ABS _bbb
24# CHECK-NEXT: 0000000000000018    0 NOTYPE GLOBAL DEFAULT ABS _ccc
25## SIZEOF(.not_exist) has a value of 0.
26# CHECK-NEXT: 0000000000000000    0 NOTYPE GLOBAL DEFAULT ABS _ddd
27
28.global _start
29_start:
30 nop
31
32.section .aaa,"a"
33 .quad 0
34
35.section .bbb,"a"
36 .quad 0
37 .quad 0
38
39.section .ccc,"a"
40 .quad 0
41 .quad 0
42 .quad 0
43