1# RUN: yaml2obj %s -o %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 -DINPUT=%t 7# RUN: llvm-objcopy --dump-section .empty=%t.empty %t /dev/null 8# RUN: od -t x1 %t2 | FileCheck %s --ignore-case 9# RUN: od -t x1 %t6 | FileCheck %s --ignore-case --check-prefix=NON-ALLOC 10# RUN: wc -c %t2 | FileCheck %s --check-prefix=SIZE 11# RUN: wc -c %t.empty | FileCheck %s --check-prefix=EMPTY 12# RUN: diff %t2 %t3 13# RUN: diff %t4 %t3 14 15!ELF 16FileHeader: 17 Class: ELFCLASS64 18 Data: ELFDATA2LSB 19 Type: ET_EXEC 20 Machine: EM_X86_64 21Sections: 22 - Name: .text 23 Type: SHT_PROGBITS 24 Flags: [ SHF_ALLOC, SHF_EXECINSTR ] 25 AddressAlign: 0x0000000000001000 26 Content: "DEADBEEF" 27 - Name: .foo 28 Type: SHT_PROGBITS 29 Flags: [ SHF_WRITE ] 30 Content: "CAFE" 31 - Name: .empty 32 Type: SHT_PROGBITS 33 Flags: [ SHF_ALLOC ] 34 - Name: .bar 35 Type: SHT_NOBITS 36 Flags: [ SHF_WRITE ] 37ProgramHeaders: 38 - Type: PT_LOAD 39 Flags: [ PF_X, PF_R ] 40 FirstSec: .text 41 LastSec: .text 42 43# CHECK: 0000000 de ad be ef 44 45# NON-ALLOC: 0000000 ca fe 46 47# SIZE: 4 48 49# NOBITS: error: '[[INPUT]]': cannot dump section '.bar': it has no contents 50 51# EMPTY: 0 52