91 lines · plain
1## Test a basic copy of an archive containing a wasm object.2 3# RUN: yaml2obj %s -o %t4 5## Create an archive and copy it using llvm-objcopy.6# RUN: rm -f %t.a7# RUN: llvm-ar crs %t.a %t8# RUN: cp %t.a %t.copy.a9# RUN: llvm-objcopy %t.a %t2.a10## Create another archive from an objcopy-copied object, verify that they match.11# RUN: llvm-objcopy %t %t212# RUN: llvm-ar p %t2.a > %t313# RUN: cmp %t2 %t314 15## Check that the copied archive has the correct index contents.16# RUN: llvm-nm --print-armap %t.a | FileCheck --check-prefix=INDEX-TABLE %s17# RUN: llvm-nm --print-armap %t2.a | FileCheck --check-prefix=INDEX-TABLE %s18## Verify that llvm-objcopy has not modifed the input.19# RUN: cmp %t.copy.a %t.a20 21# INDEX-TABLE: Archive map22# INDEX-TABLE-NEXT: func1 in23 24## Do the same with an archive that has no index.25# RUN: rm -f %t.no.index.a26# RUN: llvm-ar crS %t.no.index.a %t27# RUN: llvm-objcopy %t.no.index.a %t2.no.index.a28# RUN: llvm-ar p %t2.no.index.a > %t429 30# RUN: llvm-nm --print-armap %t.no.index.a | FileCheck --check-prefix=NO-INDEX-TABLE %s31# RUN: llvm-nm --print-armap %t2.no.index.a | FileCheck --check-prefix=NO-INDEX-TABLE %s32# RUN: cmp %t2 %t433 34# NO-INDEX-TABLE-NOT: Archive map35# NO-INDEX-TABLE-NOT: func1 in36 37--- !WASM38FileHeader:39 Version: 0x0000000140Sections:41 - Type: TYPE42 Signatures:43 - Index: 044 ParamTypes:45 - I3246 ReturnTypes:47 - F3248 - Index: 149 ParamTypes:50 - I3251 - I6452 ReturnTypes: []53 - Type: FUNCTION54 FunctionTypes:55 - 056 - 157 - Type: CODE58 Relocations:59 - Type: R_WASM_TABLE_INDEX_SLEB60 Index: 061 Offset: 0x0000000262 - Type: R_WASM_FUNCTION_INDEX_LEB63 Index: 164 Offset: 0x000000265 Functions:66 - Index: 067 Locals:68 - Type: I3269 Count: 370 Body: 010101010B71 - Index: 172 Locals:73 - Type: I3274 Count: 175 Body: 010101010B76 - Type: CUSTOM77 Name: linking78 Version: 279 SymbolTable:80 - Index: 081 Kind: FUNCTION82 Name: func183 Flags: [ ]84 Function: 085 - Index: 186 Kind: FUNCTION87 Name: func288 Flags: [ ]89 Function: 190...91