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
52 # OCT-SYSV-NEXT: [[FILE2]] :
53 # OCT-SYSV-NEXT: section size addr
54 # OCT-SYSV-NEXT: .blob 010 040
55 # OCT-SYSV-NEXT: .blab 020 020
56 # OCT-SYSV-NEXT: .blib 040 010
57 # OCT-SYSV-NEXT: Total 070
59 ## Case 5: Decimal radix (sysv).
60 # RUN: llvm-size %t1.o %t2.o -A --radix=10 \
61 # RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
62 # RUN: llvm-size %t1.o %t2.o -A -d \
63 # RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
65 # DEC-SYSV: [[FILE1]] :
66 # DEC-SYSV-NEXT: section size addr
67 # DEC-SYSV-NEXT: .text 1 4
68 # DEC-SYSV-NEXT: .data 2 2
69 # DEC-SYSV-NEXT: .bss 4 1
70 # DEC-SYSV-NEXT: Total 7
72 # DEC-SYSV-NEXT: [[FILE2]] :
73 # DEC-SYSV-NEXT: section size addr
74 # DEC-SYSV-NEXT: .blob 8 32
75 # DEC-SYSV-NEXT: .blab 16 16
76 # DEC-SYSV-NEXT: .blib 32 8
77 # DEC-SYSV-NEXT: Total 56
79 ## Case 6: Hexadecimal radix (sysv).
80 # RUN: llvm-size %t1.o %t2.o -A --radix=16 \
81 # RUN: | FileCheck %s --check-prefix=HEX-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
82 # RUN: llvm-size %t1.o %t2.o -A -x \
83 # RUN: | FileCheck %s --check-prefix=HEX-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
85 # HEX-SYSV: [[FILE1]] :
86 # HEX-SYSV-NEXT: section size addr
87 # HEX-SYSV-NEXT: .text 0x1 0x4
88 # HEX-SYSV-NEXT: .data 0x2 0x2
89 # HEX-SYSV-NEXT: .bss 0x4 0x1
90 # HEX-SYSV-NEXT: Total 0x7
92 # HEX-SYSV-NEXT: [[FILE2]] :
93 # HEX-SYSV-NEXT: section size addr
94 # HEX-SYSV-NEXT: .blob 0x8 0x20
95 # HEX-SYSV-NEXT: .blab 0x10 0x10
96 # HEX-SYSV-NEXT: .blib 0x20 0x8
97 # HEX-SYSV-NEXT: Total 0x38
99 ## Case 7: Default Berkeley is decimal.
100 # RUN: llvm-size %t1.o %t2.o --totals -B \
101 # RUN: | FileCheck %s --check-prefix=DEC-BERK -DFILE1=%t1.o -DFILE2=%t2.o
103 ## Case 8: Default sysv is decimal.
104 # RUN: llvm-size %t1.o %t2.o -A \
105 # RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o
107 ## Case 9: Bad values.
108 # RUN: not llvm-size %t1.o --radix=0 2>&1 \
109 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=0
110 # RUN: not llvm-size %t1.o --radix=1 2>&1 \
111 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=1
112 # RUN: not llvm-size %t1.o --radix=2 2>&1 \
113 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=2
114 # RUN: not llvm-size %t1.o --radix=32 2>&1 \
115 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=32
116 # RUN: not llvm-size %t1.o --radix=-1 2>&1 \
117 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=-1
118 # RUN: not llvm-size %t1.o --radix=bad 2>&1 \
119 # RUN: | FileCheck %s --check-prefix=BAD-VAL -DNUM=bad
121 # BAD-VAL: {{.*}}llvm-size{{.*}}: for the --radix option: Cannot find option named '[[NUM]]'!
132 Flags: [SHF_ALLOC, SHF_EXECINSTR]
137 Flags: [SHF_ALLOC, SHF_WRITE]
142 Flags: [SHF_ALLOC, SHF_WRITE]
155 Flags: [SHF_ALLOC, SHF_EXECINSTR]
160 Flags: [SHF_ALLOC, SHF_WRITE]
165 Flags: [SHF_ALLOC, SHF_WRITE]