archive.test
3.85 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
## Show how llvm-size behaves when passed in an archive.
# RUN: yaml2obj %s --docnum=1 -o %t1
# RUN: yaml2obj %s --docnum=2 -o %t2
## Case 1: Empty archive. No output expected.
# RUN: rm -f %t1.a
# RUN: llvm-ar rc %t1.a
# RUN: llvm-size -B %t1.a | count 0
# RUN: llvm-size -A %t1.a | count 0
## Case 2: Single member.
# RUN: rm -f %t2.a
# RUN: llvm-ar rc %t2.a %t1
# RUN: llvm-size -B %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=BERKELEY-1
# RUN: llvm-size -A %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=SYSV-1
## Case 3: Multiple members.
# RUN: rm -f %t3.a
# RUN: llvm-ar rc %t3.a %t1 %t2
# RUN: llvm-size -B %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=BERKELEY-1,BERKELEY-2
# RUN: llvm-size -A %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=SYSV-1,SYSV-2
## Case 4: Mixing archives and non-archives produces sensible output:
# RUN: llvm-size -B %t1 %t2.a %t2 %t3.a \
# RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
# RUN: --check-prefixes=BERKELEY-1,BERKELEY-2,BERKELEY-3
# RUN: llvm-size -A %t1 %t2.a %t2 %t3.a \
# RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
# RUN: --check-prefixes=SYSV-1,SYSV-2,SYSV-3
# BERKELEY-1: text data bss dec hex filename
# BERKELEY-3-NEXT: 1 2 4 7 7 [[FILE1]]
# BERKELEY-3-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE2]])
# BERKELEY-3-NEXT: 8 16 32 56 38 [[FILE2]]
# BERKELEY-1-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE]])
# BERKELEY-2-NEXT: 8 16 32 56 38 archive.test.tmp2 (ex [[ARCHIVE]])
# BERKELEY-1-NOT:{{.}}
# SYSV-3: [[FILE1]] :
# SYSV-3-NEXT: section size addr
# SYSV-3-NEXT: .text 1 4
# SYSV-3-NEXT: .data 2 2
# SYSV-3-NEXT: .bss 4 1
# SYSV-3-NEXT: Total 7
# SYSV-3-EMPTY:
# SYSV-3-EMPTY:
# SYSV-3-NEXT: archive.test.tmp1 (ex [[ARCHIVE2]]):
# SYSV-3-NEXT: section size addr
# SYSV-3-NEXT: .text 1 4
# SYSV-3-NEXT: .data 2 2
# SYSV-3-NEXT: .bss 4 1
# SYSV-3-NEXT: Total 7
# SYSV-3-EMPTY:
# SYSV-3-EMPTY:
# SYSV-3-NEXT: [[FILE2]] :
# SYSV-3-NEXT: section size addr
# SYSV-3-NEXT: .text 8 32
# SYSV-3-NEXT: .data 16 16
# SYSV-3-NEXT: .bss 32 8
# SYSV-3-NEXT: Total 56
# SYSV-3-EMPTY:
# SYSV-1: archive.test.tmp1 (ex [[ARCHIVE]]):
# SYSV-1-NEXT: section size addr
# SYSV-1-NEXT: .text 1 4
# SYSV-1-NEXT: .data 2 2
# SYSV-1-NEXT: .bss 4 1
# SYSV-1-NEXT: Total 7
# SYSV-1-EMPTY:
# SYSV-1-EMPTY:
# SYSV-2-NEXT: archive.test.tmp2 (ex [[ARCHIVE]]):
# SYSV-2-NEXT: section size addr
# SYSV-2-NEXT: .text 8 32
# SYSV-2-NEXT: .data 16 16
# SYSV-2-NEXT: .bss 32 8
# SYSV-2-NEXT: Total 56
# SYSV-1-NOT:{{.}}
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Size: 1
Address: 4
- Name: .data
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 2
Address: 2
- Name: .bss
Type: SHT_NOBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 4
Address: 1
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Size: 8
Address: 32
- Name: .data
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 16
Address: 16
- Name: .bss
Type: SHT_NOBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Size: 32
Address: 8