## Test the contents of a custom section dumped from a binary.
# RUN: yaml2obj %s -o %t
# RUN: llvm-objcopy --dump-section=producers=%t.sec %t
# RUN: od -t x1 %t.sec | FileCheck %s
# RUN: not llvm-objcopy --dump-section=nonexistent=%t.sec %t 2>&1 | FileCheck --check-prefix=NONEXISTENT %s
# RUN: not llvm-objcopy --dump-section=producers=%t.dir/bar %t 2>&1 | FileCheck -DMSG=%errc_ENOENT --check-prefix=DIROUT %s
## Raw contents of the producers section.
# CHECK: 0000000 01 0c 70 72 6f 63 65 73 73 65 64 2d 62 79 01 05
# CHECK: 0000020 63 6c 61 6e 67 05 39 2e 30 2e 30
# NONEXISTENT: section 'nonexistent' not found
# DIROUT: error: {{.*}}/bar': [[MSG]]
## Test dumping the type section (a known section).
# RUN: llvm-objcopy --dump-section=TYPE=%t.sec %t
# RUN: od -t x1 %t.sec | FileCheck %s --check-prefix=TYPESEC
## Raw contents of the type section.
# TYPESEC: 000000 01 60 01 7f 01 7d
# TYPESEC: 000006
## Check that dumping and removing a section works in the same invocation
# RUN: llvm-objcopy --dump-section=producers=%t.sec --remove-section=producers %t %t2
# RUN: od -t x1 %t.sec | FileCheck %s
# RUN: obj2yaml %t2 | FileCheck --check-prefix=REMOVED %s
# REMOVED-NOT: producers
--- !WASM
FileHeader:
Version: 0x00000001
Sections:
- Type: TYPE
Signatures:
- Index: 0
ParamTypes:
- I32
ReturnTypes:
- F32
- Type: CUSTOM
Name: producers
Tools:
- Name: clang
Version: 9.0.0