95 lines · plain
1## Test --add-section. This test dumps and removes the section first and checks2## that adding it back doesn't change the result.3# RUN: yaml2obj %s -o %t4# RUN: llvm-objcopy --dump-section=producers=%t.sec --remove-section=producers %t %t25# RUN: llvm-objcopy --add-section=producers=%t.sec %t2 %t36# RUN: obj2yaml %t3 | FileCheck %s7 8## Check that the producers section has been added back unchanged.9# CHECK: Name: producers10# CHECK-NEXT: Tools:11# CHECK-NEXT: - Name: clang12# CHECK-NEXT: Version: 9.0.013 14# Check that the section is replaced with new content in one invocation.15# RUN: echo "123" > %t416# RUN: llvm-objcopy --remove-section=foo --add-section=foo=%t4 %t %t517# RUN: obj2yaml %t5 | FileCheck %s --check-prefix=REPLACE18 19# REPLACE: - Type: CUSTOM20# REPLACE: Name: foo21# REPLACE: Payload: 3132330A22 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" > %t625# RUN: llvm-objcopy --add-section=bar=%t6 %t %t726# RUN: llvm-objcopy --dump-section=bar=%t8 %t727# RUN: diff %t8 %t628# RUN: obj2yaml %t7 | FileCheck %s --check-prefix=RAW-DATA29 30## Check that raw data is well formated in the file as well.31# RAW-DATA: Name: bar32# RAW-DATA-NEXT: Payload: '0201000102'33 34--- !WASM35FileHeader:36 Version: 0x0000000137Sections:38 - Type: TYPE39 Signatures:40 - Index: 041 ParamTypes:42 - I3243 ReturnTypes:44 - F3245 - Index: 146 ParamTypes:47 - I3248 - I6449 ReturnTypes: []50 - Type: FUNCTION51 FunctionTypes:52 - 053 - 154 - Type: CODE55 Relocations:56 - Type: R_WASM_TABLE_INDEX_SLEB57 Index: 058 Offset: 0x0000000059 - Type: R_WASM_FUNCTION_INDEX_LEB60 Index: 161 Offset: 0x000000062 Functions:63 - Index: 064 Locals:65 - Type: I3266 Count: 367 Body: 010101010B68 - Index: 169 Locals:70 - Type: I3271 Count: 172 Body: 010101010B73 - Type: CUSTOM74 Name: linking75 Version: 276 SymbolTable:77 - Index: 078 Kind: FUNCTION79 Name: func180 Flags: [ ]81 Function: 082 - Index: 183 Kind: FUNCTION84 Name: func285 Flags: [ ]86 Function: 187 - Type: CUSTOM88 Name: producers89 Tools:90 - Name: clang91 Version: 9.0.092 - Type: CUSTOM93 Name: foo94 Payload: ABC12395