xref: /llvm-project/llvm/test/tools/llvm-dwarfdump/X86/section_sizes_elf.test (revision 7b319df29bf4ebe690ca0c41761e46d8b0081293)
1## Check how llvm-dwarfdump calculates section sizes
2## with --show-section-sizes for ELF objects.
3
4# RUN: yaml2obj %s | llvm-dwarfdump - --show-section-sizes \
5# RUN:   | FileCheck %s --match-full-lines --strict-whitespace
6
7#      CHECK:----------------------------------------------------
8# CHECK-NEXT:file: {{.*}}
9# CHECK-NEXT:----------------------------------------------------
10# CHECK-NEXT:SECTION          SIZE (b)
11# CHECK-NEXT:---------------  --------
12# CHECK-NEXT:.debug_info            17 (1.62%)
13# CHECK-NEXT:.debug_line            19 (1.81%)
14# CHECK-NEXT:.debug_loc              1 (0.10%)
15# CHECK-NEXT:.debug_type            26 (2.48%)
16# CHECK-NEXT:.debug_foo            100 (9.54%)
17# CHECK-NEXT:.debug_info.dwo         9 (0.86%)
18# CHECK-EMPTY:
19# CHECK-NEXT: Total Size: 172  (16.41%)
20# CHECK-NEXT: Total File Size: 1048
21# CHECK-NEXT:----------------------------------------------------
22
23--- !ELF
24FileHeader:
25  Class:   ELFCLASS64
26  Data:    ELFDATA2LSB
27  Type:    ET_REL
28  Machine: EM_X86_64
29Sections:
30  - Name: .debug_info
31    Type: SHT_PROGBITS
32    Size: 17
33  - Name: .debug_line
34    Type: SHT_PROGBITS
35    Size: 19
36  - Name: .debug_loc
37    Type: SHT_PROGBITS
38    Size: 1
39  - Name: .debug_type
40    Type: SHT_PROGBITS
41    Size: 13
42  - Name: .debug_type (1)
43    Type: SHT_PROGBITS
44    Size: 13
45  - Name: .debug_foo
46    Type: SHT_PROGBITS
47    Size: 100
48  - Name: .debug_info.dwo
49    Type: SHT_PROGBITS
50    Size: 9
51## This is a debug section following the Mach-O naming style, and is used
52## to show that such sections are not included in the report.
53  - Name: __debug_bar
54    Type: SHT_PROGBITS
55    Size: 1
56