73 lines · plain
1# RUN: echo -n AAAB > %t.diff2# RUN: echo -n AAA > %t.smaller3# RUN: echo -n AAAAA > %t.larger4 5# RUN: yaml2obj %s -o %t6 7# RUN: llvm-objcopy --update-section=.text=%t.diff %t - | llvm-readobj -S -x .text - | FileCheck %s8# CHECK: Section {9# CHECK-NEXT: Number: 110# CHECK-NEXT: Name: .text11# CHECK-NOT: }12# CHECK: RawDataSize: 413# CHECK: Hex dump of section '.text':14# CHECK-NEXT: 0x00000000 41414142 AAAB15 16# RUN: llvm-objcopy --update-section=.text=%t.smaller %t - | llvm-readobj -S -x .text - | FileCheck %s --check-prefix=SMALLER17# SMALLER: Section {18# SMALLER-NEXT: Number: 119# SMALLER-NEXT: Name: .text20# SMALLER-NOT: }21# SMALLER: RawDataSize: 322# SMALLER: Hex dump of section '.text':23# SMALLER-NEXT: 0x00000000 414141 AAA24 25# RUN: llvm-objcopy --update-section=.text=%t.diff --update-section=.other=%t.diff %t - | \26# RUN: llvm-readobj -S -x .text -x .other - | FileCheck %s --check-prefix=MULTIPLE27# MULTIPLE: Section {28# MULTIPLE-NEXT: Number: 129# MULTIPLE-NEXT: Name: .text30# MULTIPLE-NOT: }31# MULTIPLE: RawDataSize: 432# MULTIPLE: Section {33# MULTIPLE-NEXT: Number: 234# MULTIPLE-NEXT: Name: .other35# MULTIPLE-NOT: }36# MULTIPLE: RawDataSize: 437# MULTIPLE: Hex dump of section '.text':38# MULTIPLE-NEXT: 0x00000000 41414142 AAAB39# MULTIPLE: Hex dump of section '.other':40# MULTIPLE-NEXT: 0x00000000 41414142 AAAB41 42# RUN: not llvm-objcopy --update-section=.text=%t.larger %t /dev/null 2>&1 | FileCheck %s --check-prefix=TOO-LARGE43# TOO-LARGE: error: {{.*}}new section cannot be larger than previous section44 45# RUN: not llvm-objcopy --update-section=.bss=%t.diff %t /dev/null 2>&1 | FileCheck %s --check-prefix=NO-CONTENTS46# NO-CONTENTS: error: {{.*}}section '.bss' cannot be updated because it does not have contents47 48# RUN: not llvm-objcopy --update-section=.text=%t.noexist %t /dev/null 2>&1 | \49# RUN: FileCheck %s --check-prefix=NOENT -DENOENT=%errc_ENOENT50# NOENT: error: {{.*}}: [[ENOENT]]51 52# RUN: not llvm-objcopy --update-section=.noexist=%t.diff %t /dev/null 2>&1 | FileCheck %s --check-prefix=NO-SECTION53# NO-SECTION: error: {{.*}}could not find section with name '.noexist'54 55--- !COFF56header:57 Machine: IMAGE_FILE_MACHINE_AMD6458 Characteristics: [ ]59sections:60 - Name: .text61 Characteristics: [ ]62 Alignment: 463 SectionData: '41414141'64 - Name: .other65 Characteristics: [ ]66 Alignment: 467 SectionData: '42424242'68 - Name: .bss69 Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA ]70 SizeOfRawData: 071symbols:72...73