discard-mix-local-and-all.test
3.79 KB
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
# RUN: yaml2obj %s > %t
# Establish baseline objects for further checks. --discard-locals only discards
# compiler-generated local symbols (starting with .L), --discard-all discards
# all regular local symbols.
# RUN: llvm-objcopy %t %t-discard-none
# RUN: llvm-readobj --symbols %t-discard-none | FileCheck %s --check-prefixes=CHECK,LOCAL,COMPILER-LOCAL
# RUN: llvm-objcopy --discard-all %t %t-discard-all
# RUN: llvm-readobj --symbols %t-discard-all | FileCheck %s
# RUN: llvm-objcopy --discard-locals %t %t-discard-locals
# RUN: llvm-readobj --symbols %t-discard-locals | FileCheck %s --check-prefixes=CHECK,LOCAL
# When mixing --discard-all and --discard-locals, the last one wins.
# RUN: llvm-objcopy --discard-all --discard-locals %t %t.1.o
# RUN: cmp %t.1.o %t-discard-locals
# RUN: llvm-objcopy --discard-locals --discard-all %t %t.2.o
# RUN: cmp %t.2.o %t-discard-all
# RUN: llvm-objcopy -x -X %t %t.3.o
# RUN: cmp %t.3.o %t-discard-locals
# RUN: llvm-objcopy -X -x %t %t.4.o
# RUN: cmp %t.4.o %t-discard-all
# RUN: llvm-objcopy -x -X -x -X %t %t.5.o
# RUN: cmp %t.5.o %t-discard-locals
# RUN: llvm-objcopy -X -x -X -x %t %t.6.o
# RUN: cmp %t.6.o %t-discard-all
# RUN: llvm-objcopy -X -x -X -x --discard-locals %t %t.7.o
# RUN: cmp %t.7.o %t-discard-locals
# RUN: llvm-objcopy -X -x -X -x --discard-all %t %t.8.o
# RUN: cmp %t.8.o %t-discard-all
# llvm-strip works in the same way.
# RUN: llvm-strip --discard-all --discard-locals %t -o %t.9.o
# RUN: cmp %t.9.o %t-discard-locals
# RUN: llvm-strip --discard-locals --discard-all %t -o %t.10.o
# RUN: cmp %t.10.o %t-discard-all
# RUN: llvm-strip -x -X %t -o %t.11.o
# RUN: cmp %t.11.o %t-discard-locals
# RUN: llvm-strip -X -x %t -o %t.12.o
# RUN: cmp %t.12.o %t-discard-all
# RUN: llvm-strip -x -X -x -X %t -o %t.13.o
# RUN: cmp %t.13.o %t-discard-locals
# RUN: llvm-strip -X -x -X -x %t -o %t.14.o
# RUN: cmp %t.14.o %t-discard-all
# RUN: llvm-strip -X -x -X -x --discard-locals %t -o %t.15.o
# RUN: cmp %t.15.o %t-discard-locals
# RUN: llvm-strip -X -x -X -x --discard-all %t -o %t.16.o
# RUN: cmp %t.16.o %t-discard-all
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Symbols:
- Name: Local
Type: STT_FUNC
Section: .text
- Name: .L.str
Type: STT_OBJECT
Section: .text
- Name: Global
Type: STT_FUNC
Section: .text
Binding: STB_GLOBAL
# CHECK: Symbols [
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name:
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: Size: 0
# CHECK-NEXT: Binding: Local
# CHECK-NEXT: Type: None
# CHECK-NEXT: Other: 0
# CHECK-NEXT: Section: Undefined
# CHECK-NEXT: }
# LOCAL-NEXT: Symbol {
# LOCAL-NEXT: Name: Local
# LOCAL-NEXT: Value:
# LOCAL-NEXT: Size:
# LOCAL-NEXT: Binding: Local
# LOCAL-NEXT: Type: Function
# LOCAL-NEXT: Other:
# LOCAL-NEXT: Section: .text
# LOCAL-NEXT: }
# COMPILER-LOCAL-NEXT: Symbol {
# COMPILER-LOCAL-NEXT: Name: .L.str
# COMPILER-LOCAL-NEXT: Value:
# COMPILER-LOCAL-NEXT: Size:
# COMPILER-LOCAL-NEXT: Binding: Local
# COMPILER-LOCAL-NEXT: Type: Object
# COMPILER-LOCAL-NEXT: Other:
# COMPILER-LOCAL-NEXT: Section: .text
# COMPILER-LOCAL-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: Global
# CHECK-NEXT: Value:
# CHECK-NEXT: Size:
# CHECK-NEXT: Binding: Global
# CHECK-NEXT: Type: Function
# CHECK-NEXT: Other:
# CHECK-NEXT: Section: .text
# CHECK-NEXT: }
# CHECK-NEXT: ]