1 ## Show that llvm-size prints sizes in different radixes when requested.
3 # RUN: yaml2obj %s --docnum=1 -o %t1.o
4 # RUN: yaml2obj %s --docnum=2 -o %t2.o
6 ## Case 1: Octal radix (Berkeley).
7 # RUN: llvm-size %t1.o %t2.o --totals -B --radix=8 \
8 # RUN: | FileCheck %s --check-prefix=OCT-BERK -DFILE1=%t1.o -DFILE2=%t2.o
9 # RUN: llvm-size %t1.o %t2.o --totals -B -o \
10 # RUN: | FileCheck %s --check-prefix=OCT-BERK -DFILE1=%t1.o -DFILE2=%t2.o
12 # OCT-BERK: text data bss oct hex filename
13 # OCT-BERK-NEXT: 01 02 04 7 7 [[FILE1]]
14 # OCT-BERK-NEXT: 010 020 040 70 38 [[FILE2]]
15 # OCT-BERK-NEXT: 011 022 044 77 3f (TOTALS)
17 ## Case 2: Decimal radix (Berkeley).
18 # RUN: llvm-size %t1.o %t2.o --totals -B --radix=10 \
19 # RUN: | FileCheck %s --check-prefix=DEC-BERK -DFILE1=%t1.o -DFILE2=%t2.o
20 # RUN: llvm-size %t1.o %t2.o --totals -B -d \
21 # RUN: | FileCheck %s --check-prefix=DEC-BERK -DFILE1=%t1.o -DFILE2=%t2.o
23 # DEC-BERK: text data bss dec hex filename
24 # DEC-BERK-NEXT: 1 2 4 7 7 [[FILE1]]
25 # DEC-BERK-NEXT: 8 16 32 56 38 [[FILE2]]
26 # DEC-BERK-NEXT: 9 18 36 63 3f (TOTALS)
28 ## Case 3: Hexadecimal radix (Berkeley).
29 # RUN: llvm-size %t1.o %t2.o --totals -B --radix=16 \
30 # RUN: | FileCheck %s --check-prefix=HEX-BERK -DFILE1=%t1.o -DFILE2=%t2.o
31 # RUN: llvm-size %t1.o %t2.o --totals -B -x \
32 # RUN: | FileCheck %s --check-prefix=HEX-BERK -DFILE1=%t1.o -DFILE2=%t2.o
34 # HEX-BERK: text data bss dec hex filename
35 # HEX-BERK-NEXT: 0x1 0x2 0x4 7 7 [[FILE1]]
36 # HEX-BERK-NEXT: 0x8 0x10 0x20 56 38 [[FILE2]]
37 # HEX-BERK-NEXT: 0x9 0x12 0x24 63 3f (TOTALS)
39 ## Case 4: Octal radix (sysv).
40 # RUN: llvm-size %t1.o %t2.o -A --radix=8 \
41 # RUN: | FileCheck %s --check-prefix=OCT-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
42 # RUN: llvm-size %t1.o %t2.o -A -o \
43 # RUN: | FileCheck %s --check-prefix=OCT-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
45 # OCT-SYSV: [[FILE1]] :
46 # OCT-SYSV-NEXT: section size addr
47 # OCT-SYSV-NEXT: .text 01 04
48 # OCT-SYSV-NEXT: .data 02 02
49 # OCT-SYSV-NEXT: .bss 04 01
50 # OCT-SYSV-NEXT: Total 07
53 # OCT-SYSV-NEXT: [[FILE2]] :
54 # OCT-SYSV-NEXT: section size addr
55 # OCT-SYSV-NEXT: .blob 010 040
56 # OCT-SYSV-NEXT: .blab 020 020
57 # OCT-SYSV-NEXT: .blib 040 010
58 # OCT-SYSV-NEXT: Total 070
60 ## Case 5: Decimal radix (sysv).
61 # RUN: llvm-size %t1.o %t2.o -A --radix=10 \
62 # RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
63 # RUN: llvm-size %t1.o %t2.o -A -d \
64 # RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
66 # DEC-SYSV: [[FILE1]] :
67 # DEC-SYSV-NEXT: section size addr
68 # DEC-SYSV-NEXT: .text 1 4
69 # DEC-SYSV-NEXT: .data 2 2
70 # DEC-SYSV-NEXT: .bss 4 1
71 # DEC-SYSV-NEXT: Total 7
74 # DEC-SYSV-NEXT: [[FILE2]] :
75 # DEC-SYSV-NEXT: section size addr
76 # DEC-SYSV-NEXT: .blob 8 32
77 # DEC-SYSV-NEXT: .blab 16 16
78 # DEC-SYSV-NEXT: .blib 32 8
79 # DEC-SYSV-NEXT: Total 56
81 ## Case 6: Hexadecimal radix (sysv).
82 # RUN: llvm-size %t1.o %t2.o -A --radix=16 \
83 # RUN: | FileCheck %s --check-prefix=HEX-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
84 # RUN: llvm-size %t1.o %t2.o -A -x \
85 # RUN: | FileCheck %s --check-prefix=HEX-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
87 # HEX-SYSV: [[FILE1]] :
88 # HEX-SYSV-NEXT: section size addr
89 # HEX-SYSV-NEXT: .text 0x1 0x4
90 # HEX-SYSV-NEXT: .data 0x2 0x2
91 # HEX-SYSV-NEXT: .bss 0x4 0x1
92 # HEX-SYSV-NEXT: Total 0x7
95 # HEX-SYSV-NEXT: [[FILE2]] :
96 # HEX-SYSV-NEXT: section size addr
97 # HEX-SYSV-NEXT: .blob 0x8 0x20
98 # HEX-SYSV-NEXT: .blab 0x10 0x10
99 # HEX-SYSV-NEXT: .blib 0x20 0x8
100 # HEX-SYSV-NEXT: Total 0x38
102 ## Case 7: Default Berkeley is decimal.
103 # RUN: llvm-size %t1.o %t2.o --totals -B \
104 # RUN: | FileCheck %s --check-prefix=DEC-BERK -DFILE1=%t1.o -DFILE2=%t2.o
106 ## Case 8: Default sysv is decimal.
107 # RUN: llvm-size %t1.o %t2.o -A \
108 # RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
110 ## Case 9: Bad values.
111 # RUN: not llvm-size %t1.o --radix=0 2>&1 \
112 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=0
113 # RUN: not llvm-size %t1.o --radix=1 2>&1 \
114 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=1
115 # RUN: not llvm-size %t1.o --radix=2 2>&1 \
116 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=2
117 # RUN: not llvm-size %t1.o --radix=32 2>&1 \
118 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=32
119 # RUN: not llvm-size %t1.o --radix=-1 2>&1 \
120 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=-1
121 # RUN: not llvm-size %t1.o --radix=bad 2>&1 \
122 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=bad
124 # BAD-VAL: {{.*}}llvm-size{{.*}}: error: --radix value should be one of: 8, 10, 16
135 Flags: [SHF_ALLOC, SHF_EXECINSTR]
140 Flags: [SHF_ALLOC, SHF_WRITE]
145 Flags: [SHF_ALLOC, SHF_WRITE]
158 Flags: [SHF_ALLOC, SHF_EXECINSTR]
163 Flags: [SHF_ALLOC, SHF_WRITE]
168 Flags: [SHF_ALLOC, SHF_WRITE]