1## Check how llvm-readobj prints sections with --sections.
2## We test the --sections flag for llvm-readelf in the gnu-sections.test.
3
4# RUN: yaml2obj %s -o %t64
5# RUN: llvm-readobj --sections %t64 | FileCheck %s --check-prefixes=ELF,ELF64
6# RUN: yaml2obj -DBITS=32 %s -o %t32
7# RUN: llvm-readobj --sections %t32 | FileCheck %s --check-prefixes=ELF,ELF32
8
9## Check flag aliases produce identical output.
10# RUN: llvm-readobj --sections %t64 > %t64.llvm.sections
11# RUN: llvm-readobj -S %t64 > %t64.llvm.upper.s
12# RUN: cmp %t64.llvm.sections %t64.llvm.upper.s
13# RUN: llvm-readobj -s %t64 > %t64.llvm.lower.s
14# RUN: cmp %t64.llvm.sections %t64.llvm.lower.s
15# RUN: llvm-readobj --section-headers %t64 > %t64.llvm.section-headers
16# RUN: cmp %t64.llvm.sections %t64.llvm.section-headers
17
18# RUN: llvm-readobj --sections %t32 > %t32.llvm.sections
19# RUN: llvm-readobj -S %t32 > %t32.llvm.upper.s
20# RUN: cmp %t32.llvm.sections %t32.llvm.upper.s
21# RUN: llvm-readobj -s %t32 > %t32.llvm.lower.s
22# RUN: cmp %t32.llvm.sections %t32.llvm.lower.s
23# RUN: llvm-readobj --section-headers %t32 > %t32.llvm.section-headers
24# RUN: cmp %t32.llvm.sections %t32.llvm.section-headers
25
26# ELF:      Sections [
27# ELF-NEXT:   Section {
28# ELF-NEXT:     Index: 0
29# ELF-NEXT:     Name:  (0)
30# ELF-NEXT:     Type: SHT_NULL (0x0)
31# ELF-NEXT:     Flags [ (0x0)
32# ELF-NEXT:     ]
33# ELF-NEXT:     Address: 0x0
34# ELF-NEXT:     Offset: 0x0
35# ELF-NEXT:     Size: 0
36# ELF-NEXT:     Link: 0
37# ELF-NEXT:     Info: 0
38# ELF-NEXT:     AddressAlignment: 0
39# ELF-NEXT:     EntrySize: 0
40# ELF-NEXT:   }
41# ELF-NEXT:   Section {
42# ELF-NEXT:     Index: 1
43# ELF-NEXT:     Name: .foo (1)
44# ELF-NEXT:     Type: SHT_PROGBITS (0x1)
45# ELF-NEXT:     Flags [ (0x3)
46# ELF-NEXT:       SHF_ALLOC (0x2)
47# ELF-NEXT:       SHF_WRITE (0x1)
48# ELF-NEXT:     ]
49# ELF-NEXT:     Address: 0x2
50# ELF64-NEXT:   Offset: 0x41
51# ELF32-NEXT:   Offset: 0x37
52# ELF-NEXT:     Size: 3
53# ELF-NEXT:     Link: 4
54# ELF-NEXT:     Info: 1
55# ELF-NEXT:     AddressAlignment: 5
56# ELF-NEXT:     EntrySize: 6
57# ELF-NEXT:   }
58# ELF-NEXT:   Section {
59# ELF-NEXT:     Index: 2
60# ELF-NEXT:     Name: .strtab (16)
61# ELF-NEXT:     Type: SHT_STRTAB (0x3)
62# ELF-NEXT:     Flags [ (0x0)
63# ELF-NEXT:     ]
64# ELF-NEXT:     Address: 0x0
65# ELF64-NEXT:   Offset: 0x44
66# ELF32-NEXT:   Offset: 0x3A
67# ELF-NEXT:     Size: 1
68# ELF-NEXT:     Link: 0
69# ELF-NEXT:     Info: 0
70# ELF-NEXT:     AddressAlignment: 1
71# ELF-NEXT:     EntrySize: 0
72# ELF-NEXT:   }
73# ELF-NEXT:   Section {
74# ELF-NEXT:     Index: 3
75# ELF-NEXT:     Name: .shstrtab (6)
76# ELF-NEXT:     Type: SHT_STRTAB (0x3)
77# ELF-NEXT:     Flags [ (0x0)
78# ELF-NEXT:     ]
79# ELF-NEXT:     Address: 0x0
80# ELF64-NEXT:   Offset: 0x45
81# ELF32-NEXT:   Offset: 0x3B
82# ELF-NEXT:     Size: 24
83# ELF-NEXT:     Link: 0
84# ELF-NEXT:     Info: 0
85# ELF-NEXT:     AddressAlignment: 1
86# ELF-NEXT:     EntrySize: 0
87# ELF-NEXT:   }
88# ELF-NEXT: ]
89
90--- !ELF
91FileHeader:
92  Class: ELFCLASS[[BITS=64]]
93  Data:  ELFDATA2LSB
94  Type:  ET_REL
95Sections:
96  - Name:         .foo
97    Type:         SHT_PROGBITS
98    Info:         1
99    Address:      0x2
100    Size:         0x3
101    Flags:        [ SHF_WRITE, SHF_ALLOC ]
102    Link:         4
103    AddressAlign: 5
104    EntSize:      6
105