1# RUN: yaml2obj %s -o %t 2# RUN: cp %t %t3 3# RUN: llvm-objcopy --strip-debug %t %t2 4## Test that debug sections (but not linking or names) are stripped with --strip-debug 5# RUN: obj2yaml %t2 | FileCheck --implicit-check-not=.debug %s 6# 7# RUN: llvm-objcopy -g %t %t2g 8# Verify that --strip-debug and -g produce the same output 9# RUN: cmp %t2 %t2g 10 11# RUN: llvm-strip --strip-debug %t3 12# RUN: cmp %t2 %t3 13 14# RUN: cp %t %t4 15# RUN: llvm-strip -d %t4 16# RUN: cmp %t2 %t4 17 18# RUN: cp %t %t5 19# RUN: llvm-strip -g %t5 20# RUN: cmp %t2 %t5 21 22# RUN: cp %t %t6 23# RUN: llvm-strip -S %t6 24# RUN: cmp %t2 %t6 25 26# Verify that an archive with multiple object files is handled correctly. 27# RUN: cp %t %t.duplicate 28# RUN: cp %t2 %t.duplicate.stripped 29# RUN: rm -f %t.multiple-stripped-obj.a 30# RUN: llvm-ar crs %t.multiple-stripped-obj.a %t2 %t.duplicate.stripped 31# RUN: rm -f %t.multiple-obj.a 32# RUN: llvm-ar crs %t.multiple-obj.a %t %t.duplicate 33# RUN: llvm-objcopy --strip-debug %t.multiple-obj.a %t.multiple-obj.stripped.a 34# RUN: llvm-ar p %t.multiple-stripped-obj.a > %t.multiple-stripped-obj.a.dump 35# RUN: llvm-ar p %t.multiple-obj.stripped.a > %t.multiple-obj.stripped.a.dump 36# RUN: cmp %t.multiple-stripped-obj.a.dump %t.multiple-obj.stripped.a.dump 37 38# CHECK: Sections: 39# CHECK-NEXT: - Type: TYPE 40# CHECK: - Type: CUSTOM 41## We expect the linking section to be preceeded by the removed `.debug_info` 42## section. 43# CHECK-NEXT: Name: .objcopy.removed 44# CHECK-NEXT: Payload: '' 45# CHECK-NEXT: - Type: CUSTOM 46# CHECK-NEXT: Name: linking 47# CHECK: Name: name 48# CHECK-NEXT: FunctionNames: 49# CHECK: Name: producers 50## Following the producers section we expect to find three removed sections. 51## The `.debug_line` section that two reloction section corresponding to the 52## two debug sections. 53# CHECK: - Type: CUSTOM 54# CHECK-NEXT: Name: .objcopy.removed 55# CHECK-NEXT: Payload: '' 56# CHECK-NEXT: - Type: CUSTOM 57# CHECK-NEXT: Name: .objcopy.removed 58# CHECK-NEXT: Payload: '' 59# CHECK-NEXT: - Type: CUSTOM 60# CHECK-NEXT: Name: .objcopy.removed 61# CHECK-NEXT: Payload: '' 62 63 64--- !WASM 65FileHeader: 66 Version: 0x00000001 67Sections: 68 - Type: TYPE 69 Signatures: 70 - Index: 0 71 ParamTypes: [] 72 ReturnTypes: [] 73 - Type: FUNCTION 74 FunctionTypes: [ 0 ] 75 - Type: CODE 76 Functions: 77 - Index: 0 78 Locals: [] 79 Body: 0B 80 - Type: CUSTOM 81 Name: .debug_info 82 Payload: 'CAFE123456' 83 Relocations: 84 - Type: R_WASM_FUNCTION_INDEX_LEB 85 Index: 0 86 Offset: 0x0000000 87 - Type: CUSTOM 88 Name: linking 89 Version: 2 90 SymbolTable: 91 - Index: 0 92 Kind: FUNCTION 93 Name: foo 94 Flags: [ BINDING_LOCAL ] 95 Function: 0 96 - Type: CUSTOM 97 Name: name 98 FunctionNames: 99 - Index: 0 100 Name: foo 101 - Type: CUSTOM 102 Name: producers 103 Tools: 104 - Name: clang 105 Version: 9.0.0 106 - Type: CUSTOM 107 Name: .debug_line 108 Payload: 'DEADBEEF01' 109 Relocations: 110 - Type: R_WASM_FUNCTION_INDEX_LEB 111 Index: 0 112 Offset: 0x0000000 113