17cb25f53SDerek Schuff# RUN: yaml2obj %s -o %t 2*2a6136e5SSam Clegg# RUN: cp %t %t3 3*2a6136e5SSam Clegg# RUN: llvm-objcopy --strip-debug %t %t2 4*2a6136e5SSam Clegg## Test that debug sections (but not linking or names) are stripped with --strip-debug 5*2a6136e5SSam Clegg# RUN: obj2yaml %t2 | FileCheck --implicit-check-not=.debug %s 6*2a6136e5SSam Clegg# 7*2a6136e5SSam Clegg# RUN: llvm-objcopy -g %t %t2g 8*2a6136e5SSam Clegg# Verify that --strip-debug and -g produce the same output 9*2a6136e5SSam Clegg# RUN: cmp %t2 %t2g 10*2a6136e5SSam Clegg 11*2a6136e5SSam Clegg# RUN: llvm-strip --strip-debug %t3 12*2a6136e5SSam Clegg# RUN: cmp %t2 %t3 13*2a6136e5SSam Clegg 14*2a6136e5SSam Clegg# RUN: cp %t %t4 15*2a6136e5SSam Clegg# RUN: llvm-strip -d %t4 16*2a6136e5SSam Clegg# RUN: cmp %t2 %t4 17*2a6136e5SSam Clegg 18*2a6136e5SSam Clegg# RUN: cp %t %t5 19*2a6136e5SSam Clegg# RUN: llvm-strip -g %t5 20*2a6136e5SSam Clegg# RUN: cmp %t2 %t5 21*2a6136e5SSam Clegg 22*2a6136e5SSam Clegg# RUN: cp %t %t6 23*2a6136e5SSam Clegg# RUN: llvm-strip -S %t6 24*2a6136e5SSam Clegg# RUN: cmp %t2 %t6 25*2a6136e5SSam Clegg 26*2a6136e5SSam Clegg# Verify that an archive with multiple object files is handled correctly. 27*2a6136e5SSam Clegg# RUN: cp %t %t.duplicate 28*2a6136e5SSam Clegg# RUN: cp %t2 %t.duplicate.stripped 29*2a6136e5SSam Clegg# RUN: rm -f %t.multiple-stripped-obj.a 30*2a6136e5SSam Clegg# RUN: llvm-ar crs %t.multiple-stripped-obj.a %t2 %t.duplicate.stripped 31*2a6136e5SSam Clegg# RUN: rm -f %t.multiple-obj.a 32*2a6136e5SSam Clegg# RUN: llvm-ar crs %t.multiple-obj.a %t %t.duplicate 33*2a6136e5SSam Clegg# RUN: llvm-objcopy --strip-debug %t.multiple-obj.a %t.multiple-obj.stripped.a 34*2a6136e5SSam Clegg# RUN: llvm-ar p %t.multiple-stripped-obj.a > %t.multiple-stripped-obj.a.dump 35*2a6136e5SSam Clegg# RUN: llvm-ar p %t.multiple-obj.stripped.a > %t.multiple-obj.stripped.a.dump 36*2a6136e5SSam Clegg# RUN: cmp %t.multiple-stripped-obj.a.dump %t.multiple-obj.stripped.a.dump 377cb25f53SDerek Schuff 387cb25f53SDerek Schuff# CHECK: Sections: 397cb25f53SDerek Schuff# CHECK-NEXT: - Type: TYPE 40*2a6136e5SSam Clegg# CHECK: - Type: CUSTOM 41*2a6136e5SSam Clegg## We expect the linking section to be preceeded by the removed `.debug_info` 42*2a6136e5SSam Clegg## section. 43*2a6136e5SSam Clegg# CHECK-NEXT: Name: .objcopy.removed 44*2a6136e5SSam Clegg# CHECK-NEXT: Payload: '' 45*2a6136e5SSam Clegg# CHECK-NEXT: - Type: CUSTOM 46*2a6136e5SSam Clegg# CHECK-NEXT: Name: linking 477cb25f53SDerek Schuff# CHECK: Name: name 487cb25f53SDerek Schuff# CHECK-NEXT: FunctionNames: 497cb25f53SDerek Schuff# CHECK: Name: producers 50*2a6136e5SSam Clegg## Following the producers section we expect to find three removed sections. 51*2a6136e5SSam Clegg## The `.debug_line` section that two reloction section corresponding to the 52*2a6136e5SSam Clegg## two debug sections. 53*2a6136e5SSam Clegg# CHECK: - Type: CUSTOM 54*2a6136e5SSam Clegg# CHECK-NEXT: Name: .objcopy.removed 55*2a6136e5SSam Clegg# CHECK-NEXT: Payload: '' 56*2a6136e5SSam Clegg# CHECK-NEXT: - Type: CUSTOM 57*2a6136e5SSam Clegg# CHECK-NEXT: Name: .objcopy.removed 58*2a6136e5SSam Clegg# CHECK-NEXT: Payload: '' 59*2a6136e5SSam Clegg# CHECK-NEXT: - Type: CUSTOM 60*2a6136e5SSam Clegg# CHECK-NEXT: Name: .objcopy.removed 61*2a6136e5SSam Clegg# CHECK-NEXT: Payload: '' 62*2a6136e5SSam Clegg 637cb25f53SDerek Schuff 647cb25f53SDerek Schuff--- !WASM 657cb25f53SDerek SchuffFileHeader: 667cb25f53SDerek Schuff Version: 0x00000001 677cb25f53SDerek SchuffSections: 687cb25f53SDerek Schuff - Type: TYPE 697cb25f53SDerek Schuff Signatures: 707cb25f53SDerek Schuff - Index: 0 717cb25f53SDerek Schuff ParamTypes: [] 727cb25f53SDerek Schuff ReturnTypes: [] 737cb25f53SDerek Schuff - Type: FUNCTION 747cb25f53SDerek Schuff FunctionTypes: [ 0 ] 757cb25f53SDerek Schuff - Type: CODE 767cb25f53SDerek Schuff Functions: 777cb25f53SDerek Schuff - Index: 0 787cb25f53SDerek Schuff Locals: [] 797cb25f53SDerek Schuff Body: 0B 807cb25f53SDerek Schuff - Type: CUSTOM 817cb25f53SDerek Schuff Name: .debug_info 82*2a6136e5SSam Clegg Payload: 'CAFE123456' 83*2a6136e5SSam Clegg Relocations: 84*2a6136e5SSam Clegg - Type: R_WASM_FUNCTION_INDEX_LEB 85*2a6136e5SSam Clegg Index: 0 86*2a6136e5SSam Clegg Offset: 0x0000000 877cb25f53SDerek Schuff - Type: CUSTOM 887cb25f53SDerek Schuff Name: linking 897cb25f53SDerek Schuff Version: 2 907cb25f53SDerek Schuff SymbolTable: 917cb25f53SDerek Schuff - Index: 0 927cb25f53SDerek Schuff Kind: FUNCTION 937cb25f53SDerek Schuff Name: foo 947cb25f53SDerek Schuff Flags: [ BINDING_LOCAL ] 957cb25f53SDerek Schuff Function: 0 967cb25f53SDerek Schuff - Type: CUSTOM 977cb25f53SDerek Schuff Name: name 987cb25f53SDerek Schuff FunctionNames: 997cb25f53SDerek Schuff - Index: 0 1007cb25f53SDerek Schuff Name: foo 1017cb25f53SDerek Schuff - Type: CUSTOM 1027cb25f53SDerek Schuff Name: producers 1037cb25f53SDerek Schuff Tools: 1047cb25f53SDerek Schuff - Name: clang 1057cb25f53SDerek Schuff Version: 9.0.0 1067cb25f53SDerek Schuff - Type: CUSTOM 1077cb25f53SDerek Schuff Name: .debug_line 108*2a6136e5SSam Clegg Payload: 'DEADBEEF01' 109*2a6136e5SSam Clegg Relocations: 110*2a6136e5SSam Clegg - Type: R_WASM_FUNCTION_INDEX_LEB 111*2a6136e5SSam Clegg Index: 0 112*2a6136e5SSam Clegg Offset: 0x0000000 113