1# RUN: yaml2obj %s > %t
2# RUN: llvm-objcopy -O binary -j .text %t %t2
3# RUN: llvm-objcopy -O binary -only-section .text %t %t3
4# RUN: llvm-objcopy --dump-section .text=%t4 %t %t5
5# RUN: llvm-objcopy --dump-section .foo=%t6 %t %t7
6# RUN: not llvm-objcopy --dump-section .bar=%t8 %t %t9 2>&1 | FileCheck %s --check-prefix=NOBITS
7# RUN: od -t x1 %t2 | FileCheck %s
8# RUN: od -t x1 %t6 | FileCheck %s --check-prefix=NON-ALLOC
9# RUN: wc -c %t2 | FileCheck %s --check-prefix=SIZE
10# RUN: diff %t2 %t3
11# RUN: diff %t4 %t3
12
13!ELF
14FileHeader:
15  Class:           ELFCLASS64
16  Data:            ELFDATA2LSB
17  Type:            ET_EXEC
18  Machine:         EM_X86_64
19Sections:
20  - Name:            .text
21    Type:            SHT_PROGBITS
22    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
23    AddressAlign:    0x0000000000001000
24    Content:         "DEADBEEF"
25  - Name:            .foo
26    Type:            SHT_PROGBITS
27    Flags:           [ SHF_WRITE ]
28    Content:         "CAFE"
29  - Name:            .bar
30    Type:            SHT_NOBITS
31    Flags:           [ SHF_WRITE ]
32ProgramHeaders:
33- Type: PT_LOAD
34  Flags: [ PF_X, PF_R ]
35  Sections:
36    - Section: .text
37
38#CHECK: 0000000 de ad be ef
39
40#NON-ALLOC: 0000000 ca fe
41
42#SIZE: 4
43
44#NOBITS: Can't dump section ".bar": it has no contents
45