Currently, only custom sections can be selected by operations that use section names, because only custom sections have explicit names (whereas known sections have names defined by the spec and only use their indices in the binary format). This CL makes objdopy use the spec-defined names for these sections, allowing them to be used in operations such as dumping and removal. This is a prerequisite for fixing https://github.com/emscripten-core/emscripten/issues/13084 Differential Revision: https://reviews.llvm.org/D126509
33 lines
896 B
Plaintext
33 lines
896 B
Plaintext
## Test the --remove-section flag.
|
|
# RUN: yaml2obj %s -o %t
|
|
# RUN: llvm-objcopy -R producers %t %t2
|
|
# RUN: obj2yaml %t2 | FileCheck --implicit-check-not=producers %s
|
|
## Check that the producers section has been removed, but not the type section.
|
|
# CHECK: TYPE
|
|
|
|
## Requests to remove nonexistent sections are silently ignored.
|
|
# RUN: llvm-objcopy --remove-section=nonexistent=%t.sec %t 2>&1 | count 0
|
|
|
|
## Remove the type section.
|
|
# RUN: llvm-objcopy -R TYPE %t %t3
|
|
# RUN: obj2yaml %t3 | FileCheck --check-prefix=REMOVETYPE --implicit-check-not=TYPE %s
|
|
## Check that the producers section is still there.
|
|
# REMOVETYPE: 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
|