66 lines · plain
1## Test that only debug sections are kept with --only-keep-debug.2# RUN: yaml2obj %s -o %t.wasm3# RUN: llvm-strip --only-keep-debug %t.wasm -o %t2.wasm4# RUN: obj2yaml %t2.wasm | FileCheck %s -check-prefixes=CHECK,STRIPTYPE,STRIPFOO5 6## Test that keep-section overrides only-keep-debug.7# RUN: llvm-strip --only-keep-debug --keep-section=foo %t.wasm -o %t3.wasm8# RUN: obj2yaml %t3.wasm | FileCheck --implicit-check-not=Name --check-prefixes=CHECK,STRIPTYPE,KEEPFOO %s9 10## Test that keep-section overrides only-keep-debug, even for known sections.11# RUN: llvm-strip --only-keep-debug --keep-section=TYPE %t.wasm -o %t4.wasm12# RUN: obj2yaml %t4.wasm | FileCheck --implicit-check-not=Name --check-prefixes=CHECK,KEEPTYPE,STRIPFOO %s13 14# CHECK: Sections:15# KEEPTYPE: - Type: TYPE16# STRIPTYPE-NOT: - Type: TYPE17# STRIPTYPE: - Type: CUSTOM18# STRIPTYPE-NEXT: Name: .objcopy.removed19# CHECK: - Type: CUSTOM20# CHECK-NEXT: Name: .debug_info21# CHECK: - Type: CUSTOM22# CHECK-NEXT: Name: .objcopy.removed23# CHECK: - Type: CUSTOM24# CHECK-NEXT: Name: .objcopy.removed25# CHECK: - Type: CUSTOM26# CHECK-NEXT: Name: .debug_line27# CHECK: - Type: CUSTOM28# KEEPFOO-NEXT: Name: foo29# STRIPFOO-NEXT: Name: .objcopy.removed30 31## Test that remove-section overrides only-keep-debug.32# RUN: yaml2obj %s -o %t33# RUN: llvm-strip --only-keep-debug --remove-section=.debug_info %t34# RUN: obj2yaml %t | FileCheck %s --check-prefix=NOINFO --implicit-check-not=.debug_info35 36# NOINFO: Name: .debug_line37 38--- !WASM39FileHeader:40 Version: 0x0000000141Sections:42 - Type: TYPE43 Signatures:44 - Index: 045 ParamTypes:46 - I3247 ReturnTypes:48 - F3249 - Type: CUSTOM50 Name: .debug_info51 Payload: CAFE123452 - Type: CUSTOM53 Name: linking54 Version: 255 - Type: CUSTOM56 Name: producers57 Tools:58 - Name: clang59 Version: 9.0.060 - Type: CUSTOM61 Name: .debug_line62 Payload: DEADBEEF63 - Type: CUSTOM64 Name: foo65 Payload: CAFE66