1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
| # RUN: yaml2obj %s > %t.in.o
#
# RUN: llvm-objdump --section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE
# RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE
#
# RUN: llvm-objcopy --strip-debug %t.in.o %t.out.o
# RUN: llvm-objdump --section-headers %t.out.o | FileCheck %s --check-prefixes=SECTIONS
# RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefixes=SYMBOLS
#
# Test that --strip-all, --strip-all-gnu, --discard-all and --strip-unneeded,
# plus llvm-strip without arguments all produce a similiar set of sections
# (while they remove symbols differently).
#
# RUN: llvm-objcopy --strip-all %t.in.o %t.strip-all.o
# RUN: llvm-objdump --section-headers %t.strip-all.o | FileCheck %s --check-prefixes=SECTIONS
#
# RUN: llvm-objcopy --strip-all-gnu %t.in.o %t.strip-all-gnu.o
# RUN: llvm-objdump --section-headers %t.strip-all-gnu.o | FileCheck %s --check-prefixes=SECTIONS
#
# RUN: llvm-objcopy --discard-all %t.in.o %t.discard-all.o
# RUN: llvm-objdump --section-headers %t.discard-all.o | FileCheck %s --check-prefixes=SECTIONS
#
# RUN: llvm-objcopy --discard-all %t.in.o %t.strip-unneeded.o
# RUN: llvm-objdump --section-headers %t.strip-unneeded.o | FileCheck %s --check-prefixes=SECTIONS
#
# SECTIONS: Sections:
# SECTIONS-NEXT: Idx Name
# SECTIONS-NEXT: 0 .text
# SECTIONS-NEXT: 1 .data
# SECTIONS-NEXT: 2 .bss
# SECTIONS-NEXT: 3 .xdata
# SECTIONS-NEXT: 4 .reloc
# SECTIONS-PRE-NEXT: 5 .debug_discardable
# SECTIONS-NEXT: {{.*}} .debug_undiscardable
# SECTIONS-NEXT: {{.*}} .llvm_addrsig
# SECTIONS-EMPTY:
#
# Test that --strip-debug doesn't remove e.g. unreferenced local symbols.
#
# SYMBOLS: SYMBOL TABLE:
# SYMBOLS-NEXT: external
# SYMBOLS-NEXT: local_unreferenced
# SYMBOLS-PRE-NEXT: debug_discardable_sym
# SYMBOLS-NEXT: debug_undiscardable_sym
# SYMBOLS-EMPTY:
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_AMD64
Characteristics: [ ]
sections:
- Name: .text
Characteristics: [ ]
Alignment: 4
SectionData: 00000000
- Name: .data
Characteristics: [ ]
Alignment: 4
SectionData: 00000000
- Name: .bss
Characteristics: [ ]
Alignment: 4
SectionData: 00000000
- Name: .xdata
Characteristics: [ ]
Alignment: 4
SectionData: 00000000
- Name: .reloc
Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
Alignment: 4
SectionData: 00000000
- Name: .debug_discardable
Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
Alignment: 4
SectionData: 00000000
- Name: .debug_undiscardable
Characteristics: [ ]
Alignment: 4
SectionData: 00000000
- Name: .llvm_addrsig
Characteristics: [ IMAGE_SCN_LNK_REMOVE ]
Alignment: 4
SectionData: 00000000
symbols:
- Name: external
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: local_unreferenced
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
- Name: debug_discardable_sym
Value: 0
SectionNumber: 6
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
- Name: debug_undiscardable_sym
Value: 0
SectionNumber: 7
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
...
|