1 ## Test --add-section. This test dumps and removes the section first and checks
2 ## that adding it back doesn't change the result.
3 # RUN: yaml2obj %s -o %t
4 # RUN: llvm-objcopy --dump-section=producers=%t.sec --remove-section=producers %t %t2
5 # RUN: llvm-objcopy --add-section=producers=%t.sec %t2 %t3
6 # RUN: obj2yaml %t3 | FileCheck %s
8 ## Check that the producers section has been added back unchanged.
9 # CHECK: Name: producers
11 # CHECK-NEXT: - Name: clang
12 # CHECK-NEXT: Version: 9.0.0
14 # Check that the section is replaced with new content in one invocation.
15 # RUN: echo "123" > %t4
16 # RUN: llvm-objcopy --remove-section=foo --add-section=foo=%t4 %t %t5
17 # RUN: obj2yaml %t5 | FileCheck %s --check-prefix=REPLACE
19 # REPLACE: - Type: CUSTOM
21 # REPLACE: Payload: 3132330A
23 ## Check that raw data bytes can be imported and exported unchanged especially the ones containing empty bytes.
24 # RUN: echo -e -n "\x02\x01\x00\x01\x02" > %t6
25 # RUN: llvm-objcopy --add-section=bar=%t6 %t %t7
26 # RUN: llvm-objcopy --dump-section=bar=%t8 %t7
28 # RUN: obj2yaml %t7 | FileCheck %s --check-prefix=RAW-DATA
30 ## Check that raw data is well formated in the file as well.
32 # RAW-DATA-NEXT: Payload: '0201000102'
56 - Type: R_WASM_TABLE_INDEX_SLEB
59 - Type: R_WASM_FUNCTION_INDEX_LEB