1 # RUN: yaml2obj %s > %t.in.o
3 # RUN: llvm-objdump --section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE
4 # RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE
6 # RUN: llvm-objcopy --strip-debug %t.in.o %t.out.o
7 # RUN: llvm-objdump --section-headers %t.out.o | FileCheck %s --check-prefixes=SECTIONS
8 # RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefixes=SYMBOLS
10 # Test that --strip-all, --strip-all-gnu, --discard-all and --strip-unneeded,
11 # plus llvm-strip without arguments all produce a similiar set of sections
12 # (while they remove symbols differently).
14 # RUN: llvm-objcopy --strip-all %t.in.o %t.strip-all.o
15 # RUN: llvm-objdump --section-headers %t.strip-all.o | FileCheck %s --check-prefixes=SECTIONS
17 # RUN: llvm-objcopy --strip-all-gnu %t.in.o %t.strip-all-gnu.o
18 # RUN: llvm-objdump --section-headers %t.strip-all-gnu.o | FileCheck %s --check-prefixes=SECTIONS
20 # RUN: llvm-objcopy --discard-all %t.in.o %t.discard-all.o
21 # RUN: llvm-objdump --section-headers %t.discard-all.o | FileCheck %s --check-prefixes=SECTIONS
23 # RUN: llvm-objcopy --discard-all %t.in.o %t.strip-unneeded.o
24 # RUN: llvm-objdump --section-headers %t.strip-unneeded.o | FileCheck %s --check-prefixes=SECTIONS
27 # SECTIONS-NEXT: Idx Name
28 # SECTIONS-NEXT: 0 .text
29 # SECTIONS-NEXT: 1 .data
30 # SECTIONS-NEXT: 2 .bss
31 # SECTIONS-NEXT: 3 .xdata
32 # SECTIONS-NEXT: 4 .reloc
33 # SECTIONS-PRE-NEXT: 5 .debug_discardable
34 # SECTIONS-NEXT: {{.*}} .debug_undiscardable
35 # SECTIONS-NEXT: {{.*}} .llvm_addrsig
38 # Test that --strip-debug doesn't remove e.g. unreferenced local symbols.
40 # SYMBOLS: SYMBOL TABLE:
41 # SYMBOLS-NEXT: external
42 # SYMBOLS-NEXT: local_unreferenced
43 # SYMBOLS-PRE-NEXT: debug_discardable_sym
44 # SYMBOLS-NEXT: debug_undiscardable_sym
49 Machine: IMAGE_FILE_MACHINE_AMD64
69 Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
72 - Name: .debug_discardable
73 Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
76 - Name: .debug_undiscardable
81 Characteristics: [ IMAGE_SCN_LNK_REMOVE ]
88 SimpleType: IMAGE_SYM_TYPE_NULL
89 ComplexType: IMAGE_SYM_DTYPE_NULL
90 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
91 - Name: local_unreferenced
94 SimpleType: IMAGE_SYM_TYPE_NULL
95 ComplexType: IMAGE_SYM_DTYPE_NULL
96 StorageClass: IMAGE_SYM_CLASS_STATIC
97 - Name: debug_discardable_sym
100 SimpleType: IMAGE_SYM_TYPE_NULL
101 ComplexType: IMAGE_SYM_DTYPE_NULL
102 StorageClass: IMAGE_SYM_CLASS_EXTERNAL
103 - Name: debug_undiscardable_sym
106 SimpleType: IMAGE_SYM_TYPE_NULL
107 ComplexType: IMAGE_SYM_DTYPE_NULL
108 StorageClass: IMAGE_SYM_CLASS_EXTERNAL