1 # RUN: echo -n AAAB > %t.diff
2 # RUN: echo -n AAA > %t.smaller
3 # RUN: echo -n AAAAA > %t.larger
5 # RUN: yaml2obj %s -o %t
7 # RUN: llvm-objcopy --update-section=.text=%t.diff %t - | llvm-readobj -S -x .text - | FileCheck %s
9 # CHECK-NEXT: Number: 1
10 # CHECK-NEXT: Name: .text
12 # CHECK: RawDataSize: 4
13 # CHECK: Hex dump of section '.text':
14 # CHECK-NEXT: 0x00000000 41414142 AAAB
16 # RUN: llvm-objcopy --update-section=.text=%t.smaller %t - | llvm-readobj -S -x .text - | FileCheck %s --check-prefix=SMALLER
18 # SMALLER-NEXT: Number: 1
19 # SMALLER-NEXT: Name: .text
21 # SMALLER: RawDataSize: 3
22 # SMALLER: Hex dump of section '.text':
23 # SMALLER-NEXT: 0x00000000 414141 AAA
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=MULTIPLE
28 # MULTIPLE-NEXT: Number: 1
29 # MULTIPLE-NEXT: Name: .text
31 # MULTIPLE: RawDataSize: 4
33 # MULTIPLE-NEXT: Number: 2
34 # MULTIPLE-NEXT: Name: .other
36 # MULTIPLE: RawDataSize: 4
37 # MULTIPLE: Hex dump of section '.text':
38 # MULTIPLE-NEXT: 0x00000000 41414142 AAAB
39 # MULTIPLE: Hex dump of section '.other':
40 # MULTIPLE-NEXT: 0x00000000 41414142 AAAB
42 # RUN: not llvm-objcopy --update-section=.text=%t.larger %t /dev/null 2>&1 | FileCheck %s --check-prefix=TOO-LARGE
43 # TOO-LARGE: error: {{.*}}new section cannot be larger than previous section
45 # RUN: not llvm-objcopy --update-section=.bss=%t.diff %t /dev/null 2>&1 | FileCheck %s --check-prefix=NO-CONTENTS
46 # NO-CONTENTS: error: {{.*}}section '.bss' cannot be updated because it does not have contents
48 # RUN: not llvm-objcopy --update-section=.text=%t.noexist %t /dev/null 2>&1 | \
49 # RUN: FileCheck %s --check-prefix=NOENT -DENOENT=%errc_ENOENT
50 # NOENT: error: {{.*}}: [[ENOENT]]
52 # RUN: not llvm-objcopy --update-section=.noexist=%t.diff %t /dev/null 2>&1 | FileCheck %s --check-prefix=NO-SECTION
53 # NO-SECTION: error: {{.*}}could not find section with name '.noexist'
57 Machine: IMAGE_FILE_MACHINE_AMD64
63 SectionData: '41414141'
67 SectionData: '42424242'
69 Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA ]