71 lines · plain
1# RUN: yaml2obj %s -o %t2# RUN: llvm-objcopy -O binary -j .text %t %t23# RUN: llvm-objcopy -O binary --only-section .text %t %t34# RUN: llvm-objcopy --dump-section .text=%t4 %t %t55# RUN: llvm-objcopy --dump-section .foo=%t6 %t %t76# RUN: not llvm-objcopy --dump-section .bar=%t8 %t %t9 2>&1 | FileCheck %s --check-prefix=NOBITS -DINPUT=%t7# RUN: llvm-objcopy --dump-section .text=%t10 --dump-section .foo=%t11 %t /dev/null8# RUN: llvm-objcopy --dump-section .empty=%t.empty %t /dev/null9# RUN: od -t x1 %t2 | FileCheck %s --ignore-case10# RUN: od -t x1 %t6 | FileCheck %s --ignore-case --check-prefix=NON-ALLOC11# RUN: wc -c %t2 | FileCheck %s --check-prefix=SIZE12# RUN: wc -c %t.empty | FileCheck %s --check-prefix=EMPTY13# RUN: diff %t2 %t314# RUN: diff %t4 %t315# RUN: diff %t10 %t316# RUN: diff %t11 %t617 18!ELF19FileHeader:20 Class: ELFCLASS6421 Data: ELFDATA2LSB22 Type: ET_EXEC23 Machine: EM_X86_6424Sections:25 - Name: .text26 Type: SHT_PROGBITS27 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]28 AddressAlign: 0x000000000000100029 Content: "DEADBEEF"30 - Name: .foo31 Type: SHT_PROGBITS32 Flags: [ SHF_WRITE ]33 Content: "CAFE"34 - Name: .empty35 Type: SHT_PROGBITS36 Flags: [ SHF_ALLOC ]37 - Name: .bar38 Type: SHT_NOBITS39 Flags: [ SHF_WRITE ]40ProgramHeaders:41 - Type: PT_LOAD42 Flags: [ PF_X, PF_R ]43 FirstSec: .text44 LastSec: .text45 46# CHECK: 0000000 de ad be ef47 48# NON-ALLOC: 0000000 ca fe49 50# SIZE: 451 52# NOBITS: error: '[[INPUT]]': cannot dump section '.bar': it has no contents53 54# EMPTY: 055 56# RUN: not llvm-objcopy --dump-section =/dev/null %t /dev/null 2>&1 | \57# RUN: FileCheck %s --check-prefix=ERR -DFILE=%t "-DSECTION="58# RUN: not llvm-objcopy --dump-section .missing=/dev/null %t /dev/null 2>&1 | \59# RUN: FileCheck %s --check-prefix=ERR -DFILE=%t -DSECTION=.missing60 61# ERR: error: '[[FILE]]': section '[[SECTION]]' not found62 63# RUN: not llvm-objcopy --dump-section .text %t /dev/null 2>&1 | FileCheck %s --check-prefix=ERR264# RUN: not llvm-objcopy --dump-section .text= %t /dev/null 2>&1 | FileCheck %s --check-prefix=ERR265 66# ERR2: error: bad format for --dump-section, expected section=file67 68# RUN: not llvm-objcopy --dump-section .text=not_exists/text-section %t 2>&1 \69# RUN: | FileCheck -DMSG=%errc_ENOENT %s -DINPUT=%t --check-prefix=NO-SUCH-PATH70# NO-SUCH-PATH: error: 'not_exists/text-section': [[MSG]]71