1*55c81d42SFangrui Song# RUN: yaml2obj %s -o %t.in.o 278a0b418SMartin Storsjo# 378a0b418SMartin Storsjo# RUN: llvm-objdump --section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE 478a0b418SMartin Storsjo# RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE 578a0b418SMartin Storsjo# 678a0b418SMartin Storsjo# RUN: llvm-objcopy --strip-debug %t.in.o %t.out.o 778a0b418SMartin Storsjo# RUN: llvm-objdump --section-headers %t.out.o | FileCheck %s --check-prefixes=SECTIONS 878a0b418SMartin Storsjo# RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefixes=SYMBOLS 978a0b418SMartin Storsjo# 1078a0b418SMartin Storsjo# Test that --strip-all, --strip-all-gnu, --discard-all and --strip-unneeded, 1178a0b418SMartin Storsjo# plus llvm-strip without arguments all produce a similiar set of sections 1278a0b418SMartin Storsjo# (while they remove symbols differently). 1378a0b418SMartin Storsjo# 1478a0b418SMartin Storsjo# RUN: llvm-objcopy --strip-all %t.in.o %t.strip-all.o 1578a0b418SMartin Storsjo# RUN: llvm-objdump --section-headers %t.strip-all.o | FileCheck %s --check-prefixes=SECTIONS 1678a0b418SMartin Storsjo# 1778a0b418SMartin Storsjo# RUN: llvm-objcopy --strip-all-gnu %t.in.o %t.strip-all-gnu.o 1878a0b418SMartin Storsjo# RUN: llvm-objdump --section-headers %t.strip-all-gnu.o | FileCheck %s --check-prefixes=SECTIONS 1978a0b418SMartin Storsjo# 2078a0b418SMartin Storsjo# RUN: llvm-objcopy --discard-all %t.in.o %t.discard-all.o 2178a0b418SMartin Storsjo# RUN: llvm-objdump --section-headers %t.discard-all.o | FileCheck %s --check-prefixes=SECTIONS 2278a0b418SMartin Storsjo# 2378a0b418SMartin Storsjo# RUN: llvm-objcopy --discard-all %t.in.o %t.strip-unneeded.o 2478a0b418SMartin Storsjo# RUN: llvm-objdump --section-headers %t.strip-unneeded.o | FileCheck %s --check-prefixes=SECTIONS 2578a0b418SMartin Storsjo# 2678a0b418SMartin Storsjo# SECTIONS: Sections: 2778a0b418SMartin Storsjo# SECTIONS-NEXT: Idx Name 2878a0b418SMartin Storsjo# SECTIONS-NEXT: 0 .text 2978a0b418SMartin Storsjo# SECTIONS-NEXT: 1 .data 3078a0b418SMartin Storsjo# SECTIONS-NEXT: 2 .bss 3178a0b418SMartin Storsjo# SECTIONS-NEXT: 3 .xdata 3278a0b418SMartin Storsjo# SECTIONS-NEXT: 4 .reloc 3378a0b418SMartin Storsjo# SECTIONS-PRE-NEXT: 5 .debug_discardable 3478a0b418SMartin Storsjo# SECTIONS-NEXT: {{.*}} .debug_undiscardable 3578a0b418SMartin Storsjo# SECTIONS-NEXT: {{.*}} .llvm_addrsig 3678a0b418SMartin Storsjo# SECTIONS-EMPTY: 3778a0b418SMartin Storsjo# 3878a0b418SMartin Storsjo# Test that --strip-debug doesn't remove e.g. unreferenced local symbols. 3978a0b418SMartin Storsjo# 4078a0b418SMartin Storsjo# SYMBOLS: SYMBOL TABLE: 4178a0b418SMartin Storsjo# SYMBOLS-NEXT: external 4278a0b418SMartin Storsjo# SYMBOLS-NEXT: local_unreferenced 4378a0b418SMartin Storsjo# SYMBOLS-PRE-NEXT: debug_discardable_sym 4478a0b418SMartin Storsjo# SYMBOLS-NEXT: debug_undiscardable_sym 4578a0b418SMartin Storsjo# SYMBOLS-EMPTY: 4678a0b418SMartin Storsjo 4778a0b418SMartin Storsjo--- !COFF 4878a0b418SMartin Storsjoheader: 4978a0b418SMartin Storsjo Machine: IMAGE_FILE_MACHINE_AMD64 5078a0b418SMartin Storsjo Characteristics: [ ] 5178a0b418SMartin Storsjosections: 5278a0b418SMartin Storsjo - Name: .text 5378a0b418SMartin Storsjo Characteristics: [ ] 5478a0b418SMartin Storsjo Alignment: 4 5578a0b418SMartin Storsjo SectionData: 00000000 5678a0b418SMartin Storsjo - Name: .data 5778a0b418SMartin Storsjo Characteristics: [ ] 5878a0b418SMartin Storsjo Alignment: 4 5978a0b418SMartin Storsjo SectionData: 00000000 6078a0b418SMartin Storsjo - Name: .bss 6178a0b418SMartin Storsjo Characteristics: [ ] 6278a0b418SMartin Storsjo Alignment: 4 6378a0b418SMartin Storsjo SectionData: 00000000 6478a0b418SMartin Storsjo - Name: .xdata 6578a0b418SMartin Storsjo Characteristics: [ ] 6678a0b418SMartin Storsjo Alignment: 4 6778a0b418SMartin Storsjo SectionData: 00000000 6878a0b418SMartin Storsjo - Name: .reloc 6978a0b418SMartin Storsjo Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ] 7078a0b418SMartin Storsjo Alignment: 4 7178a0b418SMartin Storsjo SectionData: 00000000 7278a0b418SMartin Storsjo - Name: .debug_discardable 7378a0b418SMartin Storsjo Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ] 7478a0b418SMartin Storsjo Alignment: 4 7578a0b418SMartin Storsjo SectionData: 00000000 7678a0b418SMartin Storsjo - Name: .debug_undiscardable 7778a0b418SMartin Storsjo Characteristics: [ ] 7878a0b418SMartin Storsjo Alignment: 4 7978a0b418SMartin Storsjo SectionData: 00000000 8078a0b418SMartin Storsjo - Name: .llvm_addrsig 8178a0b418SMartin Storsjo Characteristics: [ IMAGE_SCN_LNK_REMOVE ] 8278a0b418SMartin Storsjo Alignment: 4 8378a0b418SMartin Storsjo SectionData: 00000000 8478a0b418SMartin Storsjosymbols: 8578a0b418SMartin Storsjo - Name: external 8678a0b418SMartin Storsjo Value: 0 8778a0b418SMartin Storsjo SectionNumber: 1 8878a0b418SMartin Storsjo SimpleType: IMAGE_SYM_TYPE_NULL 8978a0b418SMartin Storsjo ComplexType: IMAGE_SYM_DTYPE_NULL 9078a0b418SMartin Storsjo StorageClass: IMAGE_SYM_CLASS_EXTERNAL 9178a0b418SMartin Storsjo - Name: local_unreferenced 9278a0b418SMartin Storsjo Value: 0 9378a0b418SMartin Storsjo SectionNumber: 1 9478a0b418SMartin Storsjo SimpleType: IMAGE_SYM_TYPE_NULL 9578a0b418SMartin Storsjo ComplexType: IMAGE_SYM_DTYPE_NULL 9678a0b418SMartin Storsjo StorageClass: IMAGE_SYM_CLASS_STATIC 9778a0b418SMartin Storsjo - Name: debug_discardable_sym 9878a0b418SMartin Storsjo Value: 0 9978a0b418SMartin Storsjo SectionNumber: 6 10078a0b418SMartin Storsjo SimpleType: IMAGE_SYM_TYPE_NULL 10178a0b418SMartin Storsjo ComplexType: IMAGE_SYM_DTYPE_NULL 10278a0b418SMartin Storsjo StorageClass: IMAGE_SYM_CLASS_EXTERNAL 10378a0b418SMartin Storsjo - Name: debug_undiscardable_sym 10478a0b418SMartin Storsjo Value: 0 10578a0b418SMartin Storsjo SectionNumber: 7 10678a0b418SMartin Storsjo SimpleType: IMAGE_SYM_TYPE_NULL 10778a0b418SMartin Storsjo ComplexType: IMAGE_SYM_DTYPE_NULL 10878a0b418SMartin Storsjo StorageClass: IMAGE_SYM_CLASS_EXTERNAL 10978a0b418SMartin Storsjo... 110