1 ## Show how llvm-size behaves when passed in an archive.
3 # RUN: yaml2obj %s --docnum=1 -o %t1
4 # RUN: yaml2obj %s --docnum=2 -o %t2
6 ## Case 1: Empty archive. No output expected.
8 # RUN: llvm-ar rc %t1.a
10 # RUN: llvm-size -B %t1.a | count 0
11 # RUN: llvm-size -A %t1.a | count 0
13 ## Case 2: Single member.
15 # RUN: llvm-ar rc %t2.a %t1
17 # RUN: llvm-size -B %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=BERKELEY-1
18 # RUN: llvm-size -A %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=SYSV-1
19 # RUN: llvm-size -m %t2.a | FileCheck %s -DARCHIVE=%t2.a --check-prefix=DARWIN-1
21 ## Case 3: Multiple members.
23 # RUN: llvm-ar rc %t3.a %t1 %t2
25 # RUN: llvm-size -B %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=BERKELEY-1,BERKELEY-2
26 # RUN: llvm-size -A %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=SYSV-1,SYSV-2
27 # RUN: llvm-size -m %t3.a | FileCheck %s -DARCHIVE=%t3.a --check-prefixes=DARWIN-1,DARWIN-2
29 ## Case 4: Mixing archives and non-archives produces sensible output:
30 # RUN: llvm-size -B %t1 %t2.a %t2 %t3.a \
31 # RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
32 # RUN: --check-prefixes=BERKELEY-1,BERKELEY-2,BERKELEY-3
33 # RUN: llvm-size -A %t1 %t2.a %t2 %t3.a \
34 # RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
35 # RUN: --check-prefixes=SYSV-1,SYSV-2,SYSV-3
36 # RUN: llvm-size -B %t1 %t2.a %t2 %t3.a \
37 # RUN: | FileCheck %s -DARCHIVE=%t3.a -DARCHIVE2=%t2.a -DFILE1=%t1 -DFILE2=%t2 \
38 # RUN: --check-prefixes=DARWIN-1,DARWIN-2,DARWIN-3
40 # BERKELEY-1: text data bss dec hex filename
41 # BERKELEY-3-NEXT: 1 2 4 7 7 [[FILE1]]
42 # BERKELEY-3-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE2]])
43 # BERKELEY-3-NEXT: 8 16 32 56 38 [[FILE2]]
44 # BERKELEY-1-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE]])
45 # BERKELEY-2-NEXT: 8 16 32 56 38 archive.test.tmp2 (ex [[ARCHIVE]])
46 # BERKELEY-1-NOT:{{.}}
49 # SYSV-3-NEXT: section size addr
50 # SYSV-3-NEXT: .text 1 4
51 # SYSV-3-NEXT: .data 2 2
52 # SYSV-3-NEXT: .bss 4 1
53 # SYSV-3-NEXT: Total 7
56 # SYSV-3-NEXT: archive.test.tmp1 (ex [[ARCHIVE2]]):
57 # SYSV-3-NEXT: section size addr
58 # SYSV-3-NEXT: .text 1 4
59 # SYSV-3-NEXT: .data 2 2
60 # SYSV-3-NEXT: .bss 4 1
61 # SYSV-3-NEXT: Total 7
64 # SYSV-3-NEXT: [[FILE2]] :
65 # SYSV-3-NEXT: section size addr
66 # SYSV-3-NEXT: .text 8 32
67 # SYSV-3-NEXT: .data 16 16
68 # SYSV-3-NEXT: .bss 32 8
69 # SYSV-3-NEXT: Total 56
72 # SYSV-1: archive.test.tmp1 (ex [[ARCHIVE]]):
73 # SYSV-1-NEXT: section size addr
74 # SYSV-1-NEXT: .text 1 4
75 # SYSV-1-NEXT: .data 2 2
76 # SYSV-1-NEXT: .bss 4 1
77 # SYSV-1-NEXT: Total 7
81 # SYSV-2-NEXT: archive.test.tmp2 (ex [[ARCHIVE]]):
82 # SYSV-2-NEXT: section size addr
83 # SYSV-2-NEXT: .text 8 32
84 # SYSV-2-NEXT: .data 16 16
85 # SYSV-2-NEXT: .bss 32 8
86 # SYSV-2-NEXT: Total 56
89 # DARWIN-1: text data bss dec hex filename
90 # DARWIN-3-NEXT: 1 2 4 7 7 [[FILE1]]
91 # DARWIN-3-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE2]])
92 # DARWIN-3-NEXT: 8 16 32 56 38 [[FILE2]]
93 # DARWIN-1-NEXT: 1 2 4 7 7 archive.test.tmp1 (ex [[ARCHIVE]])
94 # DARWIN-2-NEXT: 8 16 32 56 38 archive.test.tmp2 (ex [[ARCHIVE]])
106 Flags: [SHF_ALLOC, SHF_EXECINSTR]
111 Flags: [SHF_ALLOC, SHF_WRITE]
116 Flags: [SHF_ALLOC, SHF_WRITE]
129 Flags: [SHF_ALLOC, SHF_EXECINSTR]
134 Flags: [SHF_ALLOC, SHF_WRITE]
139 Flags: [SHF_ALLOC, SHF_WRITE]