172 lines · plain
1## Show that llvm-size prints sizes in different radixes when requested.2 3# RUN: yaml2obj %s --docnum=1 -o %t1.o4# RUN: yaml2obj %s --docnum=2 -o %t2.o5 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.o9# RUN: llvm-size %t1.o %t2.o --totals -B -o \10# RUN: | FileCheck %s --check-prefix=OCT-BERK -DFILE1=%t1.o -DFILE2=%t2.o11 12# OCT-BERK: text data bss oct hex filename13# 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)16 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.o20# RUN: llvm-size %t1.o %t2.o --totals -B -d \21# RUN: | FileCheck %s --check-prefix=DEC-BERK -DFILE1=%t1.o -DFILE2=%t2.o22 23# DEC-BERK: text data bss dec hex filename24# 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)27 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.o31# RUN: llvm-size %t1.o %t2.o --totals -B -x \32# RUN: | FileCheck %s --check-prefix=HEX-BERK -DFILE1=%t1.o -DFILE2=%t2.o33 34# HEX-BERK: text data bss dec hex filename35# 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)38 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.o42# RUN: llvm-size %t1.o %t2.o -A -o \43# RUN: | FileCheck %s --check-prefix=OCT-SYSV -DFILE1=%t1.o -DFILE2=%t2.o44 45# OCT-SYSV: [[FILE1]] :46# OCT-SYSV-NEXT: section size addr47# OCT-SYSV-NEXT: .text 01 0448# OCT-SYSV-NEXT: .data 02 0249# OCT-SYSV-NEXT: .bss 04 0150# OCT-SYSV-NEXT: Total 0751# OCT-SYSV-EMPTY:52# OCT-SYSV-EMPTY:53# OCT-SYSV-NEXT: [[FILE2]] :54# OCT-SYSV-NEXT: section size addr55# OCT-SYSV-NEXT: .blob 010 04056# OCT-SYSV-NEXT: .blab 020 02057# OCT-SYSV-NEXT: .blib 040 01058# OCT-SYSV-NEXT: Total 07059 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.o63# RUN: llvm-size %t1.o %t2.o -A -d \64# RUN: | FileCheck %s --check-prefix=DEC-SYSV -DFILE1=%t1.o -DFILE2=%t2.o65 66# DEC-SYSV: [[FILE1]] :67# DEC-SYSV-NEXT: section size addr68# DEC-SYSV-NEXT: .text 1 469# DEC-SYSV-NEXT: .data 2 270# DEC-SYSV-NEXT: .bss 4 171# DEC-SYSV-NEXT: Total 772# DEC-SYSV-EMPTY:73# DEC-SYSV-EMPTY:74# DEC-SYSV-NEXT: [[FILE2]] :75# DEC-SYSV-NEXT: section size addr76# DEC-SYSV-NEXT: .blob 8 3277# DEC-SYSV-NEXT: .blab 16 1678# DEC-SYSV-NEXT: .blib 32 879# DEC-SYSV-NEXT: Total 5680 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.o84# RUN: llvm-size %t1.o %t2.o -A -x \85# RUN: | FileCheck %s --check-prefix=HEX-SYSV -DFILE1=%t1.o -DFILE2=%t2.o86 87# HEX-SYSV: [[FILE1]] :88# HEX-SYSV-NEXT: section size addr89# HEX-SYSV-NEXT: .text 0x1 0x490# HEX-SYSV-NEXT: .data 0x2 0x291# HEX-SYSV-NEXT: .bss 0x4 0x192# HEX-SYSV-NEXT: Total 0x793# HEX-SYSV-EMPTY:94# HEX-SYSV-EMPTY:95# HEX-SYSV-NEXT: [[FILE2]] :96# HEX-SYSV-NEXT: section size addr97# HEX-SYSV-NEXT: .blob 0x8 0x2098# HEX-SYSV-NEXT: .blab 0x10 0x1099# HEX-SYSV-NEXT: .blib 0x20 0x8100# HEX-SYSV-NEXT: Total 0x38101 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.o105 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.o109 110## Case 9: Bad values.111# RUN: not llvm-size %t1.o --radix=0 2>&1 \112# RUN: | FileCheck %s --check-prefix=BAD-VAL -DFILE1=%t1.o -DNUM=0113# RUN: not llvm-size %t1.o --radix=1 2>&1 \114# RUN: | FileCheck %s --check-prefix=BAD-VAL -DFILE1=%t1.o -DNUM=1115# RUN: not llvm-size %t1.o --radix=2 2>&1 \116# RUN: | FileCheck %s --check-prefix=BAD-VAL -DFILE1=%t1.o -DNUM=2117# RUN: not llvm-size %t1.o --radix=32 2>&1 \118# RUN: | FileCheck %s --check-prefix=BAD-VAL -DFILE1=%t1.o -DNUM=32119# RUN: not llvm-size %t1.o --radix=-1 2>&1 \120# RUN: | FileCheck %s --check-prefix=BAD-VAL -DFILE1=%t1.o -DNUM=-1121# RUN: not llvm-size %t1.o --radix=bad 2>&1 \122# RUN: | FileCheck %s --check-prefix=BAD-VAL -DFILE1=%t1.o -DNUM=bad123 124# BAD-VAL: {{.*}}llvm-size{{.*}}: error: --radix value should be one of: 8, 10, 16125# BAD-VAL: 1 2 4 7 7 [[FILE1]]126 127--- !ELF128FileHeader:129 Class: ELFCLASS64130 Data: ELFDATA2LSB131 Type: ET_REL132 Machine: EM_X86_64133Sections:134 - Name: .text135 Type: SHT_PROGBITS136 Flags: [SHF_ALLOC, SHF_EXECINSTR]137 Size: 1138 Address: 4139 - Name: .data140 Type: SHT_PROGBITS141 Flags: [SHF_ALLOC, SHF_WRITE]142 Size: 2143 Address: 2144 - Name: .bss145 Type: SHT_NOBITS146 Flags: [SHF_ALLOC, SHF_WRITE]147 Size: 4148 Address: 1149 150--- !ELF151FileHeader:152 Class: ELFCLASS64153 Data: ELFDATA2LSB154 Type: ET_REL155 Machine: EM_X86_64156Sections:157 - Name: .blob158 Type: SHT_PROGBITS159 Flags: [SHF_ALLOC, SHF_EXECINSTR]160 Size: 8161 Address: 32162 - Name: .blab163 Type: SHT_PROGBITS164 Flags: [SHF_ALLOC, SHF_WRITE]165 Size: 16166 Address: 16167 - Name: .blib168 Type: SHT_NOBITS169 Flags: [SHF_ALLOC, SHF_WRITE]170 Size: 32171 Address: 8172