[yaml2obj/obj2yaml] - Add support for SHT_HASH sections.
[llvm-complete.git] / test / tools / llvm-size / elf-sysv.test
blob54f978069424ac616c5edd0a81c8ee4f6a50aacb
1 ## Show that llvm-sizes works correctly on a typical ELF input for sysv
2 ## format. It also shows that the formatting is correct.
4 ## FIXME: The rules demonstrated by this test are not quite what GNU size
5 ## follows. See https://bugs.llvm.org/show_bug.cgi?id=42934.
7 # RUN: yaml2obj %s > %t.o
8 # RUN: llvm-size --format=sysv %t.o \
9 # RUN:   | FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t.o --implicit-check-not={{.}}
10 # RUN: llvm-size -A %t.o \
11 # RUN:   | FileCheck %s --match-full-lines --strict-whitespace -DFILE=%t.o --implicit-check-not={{.}}
13 #      CHECK:[[FILE]]  :
14 # CHECK-NEXT:section               size      addr
15 # CHECK-NEXT:.progbits                1   2097152
16 # CHECK-NEXT:.symtab_shndx            4    524288
17 # CHECK-NEXT:.hash                   64     65536
18 # CHECK-NEXT:.dynamic               128     32768
19 # CHECK-NEXT:.note                  256     16384
20 # CHECK-NEXT:.nobits                512      8192
21 # CHECK-NEXT:.shlib                2048      2048
22 # CHECK-NEXT:.dynsym               4096      1024
23 # CHECK-NEXT:.init_array           8192       512
24 # CHECK-NEXT:.fini_array          16384       256
25 # CHECK-NEXT:.preinit_array       32768       128
26 # CHECK-NEXT:.group               65536        64
27 # CHECK-NEXT:.relr               131072        32
28 # CHECK-NEXT:.os_specific        262144        16
29 # CHECK-NEXT:.proc_specific      524288         8
30 # CHECK-NEXT:.user_specific     1048576         4
31 # CHECK-NEXT:Total              2096069
33 !ELF
34 FileHeader:
35   Class:   ELFCLASS64
36   Data:    ELFDATA2LSB
37   Type:    ET_REL
38   Machine: EM_X86_64
39 Sections:
40   - Name:    .progbits
41     Type:    SHT_PROGBITS
42     ShSize:  0x1
43     Address: 0x200000
44   - Name:    .strtab
45     Type:    SHT_STRTAB
46     ShSize:  0x2
47     Address: 0x100000
48   - Name:    .symtab_shndx
49     Link:    .symtab
50     Type:    SHT_SYMTAB_SHNDX
51     ShSize:  0x4
52     Address: 0x80000
53     Entries:
54   - Name:    .symtab
55     Type:    SHT_SYMTAB
56     ## .symtab's size has to be based on .symtab_shndx's size, hence the
57     ## size not following the pattern of the other sections.
58     ShSize:  0x18
59     Address: 0x40000
60   - Name:    .rela
61     Type:    SHT_RELA
62     ShSize:  0x20
63     Address: 0x20000
64   - Name:    .hash
65     Type:    SHT_HASH
66     Content: ''
67     ShSize:  0x40
68     Address: 0x10000
69   - Name:    .dynamic
70     Type:    SHT_DYNAMIC
71     ShSize:  0x80
72     Address: 0x8000
73   - Name:    .note
74     Type:    SHT_NOTE
75     ShSize:  0x100
76     Address: 0x4000
77   - Name:    .nobits
78     Type:    SHT_NOBITS
79     ShSize:  0x200
80     Address: 0x2000
81   - Name:    .rel
82     Type:    SHT_REL
83     ShSize:  0x400
84     Address: 0x1000
85   - Name:    .shlib
86     Type:    SHT_SHLIB
87     ShSize:  0x800
88     Address: 0x800
89   - Name:    .dynsym
90     Type:    SHT_DYNSYM
91     ShSize:  0x1000
92     Address: 0x400
93   - Name:    .init_array
94     Type:    SHT_INIT_ARRAY
95     ShSize:  0x2000
96     Address: 0x200
97   - Name:    .fini_array
98     Type:    SHT_FINI_ARRAY
99     ShSize:  0x4000
100     Address: 0x100
101   - Name:    .preinit_array
102     Type:    SHT_PREINIT_ARRAY
103     ShSize:  0x8000
104     Address: 0x80
105   - Name:    .group
106     Type:    SHT_GROUP
107     ShSize:  0x10000
108     Address: 0x40
109     Info:    0
110     Members:
111   - Name:    .relr
112     Type:    SHT_RELR
113     ShSize:  0x20000
114     Address: 0x20
115   - Name:    .os_specific
116     Type:    0x61234567
117     ShSize:  0x40000
118     Address: 0x10
119   - Name:    .proc_specific
120     Type:    0x71234567
121     ShSize:  0x80000
122     Address: 0x8
123   - Name:    .user_specific
124     Type:    0x81234567
125     ShSize:  0x100000
126     Address: 0x4
127   - Name:    .null
128     Type:    SHT_NULL
129     ShSize:  0x200000
130     Address: 0x2