1## Check how SHT_NOBITS sections are created.
2
3## Check we can use the "Size" key alone to create the section.
4
5# RUN: yaml2obj -DSIZE=3 %s -o %t.size.o
6# RUN: llvm-readelf --sections --section-data %t.size.o | FileCheck %s
7
8# CHECK: [Nr] Name    Type   Address          Off    Size   ES Flg Lk Inf Al
9# CHECK: [ 1] .nobits NOBITS 0000000000000000 000040 000003 00      0   0  0
10
11--- !ELF
12FileHeader:
13  Class: ELFCLASS64
14  Data:  ELFDATA2LSB
15  Type:  ET_DYN
16Sections:
17  - Name:    .nobits
18    Type:    SHT_NOBITS
19    Size:    [[SIZE=<none>]]
20    Content: [[CONTENT=<none>]]
21
22## Check we can't use the "Content" key.
23
24# RUN: not yaml2obj -DCONTENT="'112233'" %s 2>&1 | \
25# RUN:   FileCheck %s --check-prefix=CONTENT-ERR
26
27# CONTENT-ERR: error: SHT_NOBITS section cannot have "Content"
28
29## Check we create an empty section when neither of "Size" nor "Content" are specified.
30
31# RUN: yaml2obj %s -o %t.empty.o
32# RUN: llvm-readelf --sections --section-data %t.empty.o | \
33# RUN:   FileCheck %s --check-prefix=EMPTY-SEC
34
35# EMPTY-SEC: [Nr] Name    Type   Address          Off    Size
36# EMPTY-SEC: [ 1] .nobits NOBITS 0000000000000000 000040 000000
37