[Alignment][NFC] Instructions::getLoadStoreAlignment
[llvm-complete.git] / test / tools / obj2yaml / elf-null-section.yaml
blob99781ec10677aec0e4219dbad7aa23a2b82ca695
1 ## Check we are able to dump the SHT_NULL section at
2 ## index 0 when it has custom section fields.
4 # RUN: yaml2obj --docnum=1 %s -o %t1
5 # RUN: obj2yaml %t1 | FileCheck %s --check-prefix=FIRST-SEC
7 # FIRST-SEC:      --- !ELF
8 # FIRST-SEC-NEXT: FileHeader:
9 # FIRST-SEC-NEXT:   Class:   ELFCLASS64
10 # FIRST-SEC-NEXT:   Data:    ELFDATA2LSB
11 # FIRST-SEC-NEXT:   Type:    ET_REL
12 # FIRST-SEC-NEXT:   Machine: EM_X86_64
13 # FIRST-SEC-NEXT: Sections:
14 # FIRST-SEC-NEXT:   - Type:         SHT_NULL
15 # FIRST-SEC-NEXT:     Flags:        [ SHF_ALLOC ]
16 # FIRST-SEC-NEXT:     Address:      0x0000000000000006
17 # FIRST-SEC-NEXT:     Link:         .foo
18 # FIRST-SEC-NEXT:     AddressAlign: 0x0000000000000003
19 # FIRST-SEC-NEXT:     EntSize:      0x0000000000000005
20 # FIRST-SEC-NEXT:     Size:         0x0000000000000004
21 # FIRST-SEC-NEXT:     Info:         0x0000000000000002
22 # FIRST-SEC-NEXT:   - Name:         .foo
23 # FIRST-SEC-NEXT:     Type:         SHT_PROGBITS
24 # FIRST-SEC-NEXT: ...
26 --- !ELF
27 FileHeader:
28   Class:   ELFCLASS64
29   Data:    ELFDATA2LSB
30   Type:    ET_REL
31   Machine: EM_X86_64
32 Sections:
33   - Type:         SHT_NULL
34     Name:         ''
35     Flags:        [ SHF_ALLOC ]
36     Link:         1
37     Info:         2
38     AddressAlign: 0x3
39     Size:         0x4
40     EntSize:      0x5
41     Address:      0x6
42   - Type: SHT_PROGBITS
43     Name: .foo
45 ## Check we are able to dump the SHT_NULL section with a non-zero index.
47 # RUN: yaml2obj --docnum=2 %s -o %t2
48 # RUN: obj2yaml %t2 | FileCheck %s --check-prefix=SECOND-SEC
50 # SECOND-SEC:      --- !ELF
51 # SECOND-SEC-NEXT: FileHeader:
52 # SECOND-SEC-NEXT:   Class:   ELFCLASS64
53 # SECOND-SEC-NEXT:   Data:    ELFDATA2LSB
54 # SECOND-SEC-NEXT:   Type:    ET_REL
55 # SECOND-SEC-NEXT:   Machine: EM_X86_64
56 # SECOND-SEC-NEXT: Sections:
57 # SECOND-SEC-NEXT:   - Name:         .foo
58 # SECOND-SEC-NEXT:     Type:         SHT_PROGBITS
59 # SECOND-SEC-NEXT:   - Type:         SHT_NULL
60 # SECOND-SEC-NEXT:     Flags:        [ SHF_ALLOC ]
61 # SECOND-SEC-NEXT:     Address:      0x0000000000000006
62 # SECOND-SEC-NEXT:     Link:         .foo
63 # SECOND-SEC-NEXT:     AddressAlign: 0x0000000000000003
64 # SECOND-SEC-NEXT:     EntSize:      0x0000000000000005
65 # SECOND-SEC-NEXT:     Content:      '00000000'
66 # SECOND-SEC-NEXT:     Info:         0x0000000000000002
67 # SECOND-SEC-NEXT: ...
69 --- !ELF
70 FileHeader:
71   Class:   ELFCLASS64
72   Data:    ELFDATA2LSB
73   Type:    ET_REL
74   Machine: EM_X86_64
75 Sections:
76   - Type: SHT_PROGBITS
77     Name: .foo
78   - Type:         SHT_NULL
79     Name:         ''
80     Flags:        [ SHF_ALLOC ]
81     Link:         1
82     Info:         2
83     AddressAlign: 0x3
84     Size:         0x4
85     EntSize:      0x5
86     Address:      0x6
88 ## Check we do not dump the SHT_NULL section with index 0
89 ## when it does not have any custom fields.
91 # RUN: yaml2obj --docnum=3 %s -o %t3
92 # RUN: obj2yaml %t3 | FileCheck %s --check-prefix=NULL-SEC
94 # NULL-SEC:      --- !ELF
95 # NULL-SEC-NEXT: FileHeader:
96 # NULL-SEC-NEXT:   Class:   ELFCLASS64
97 # NULL-SEC-NEXT:   Data:    ELFDATA2LSB
98 # NULL-SEC-NEXT:   Type:    ET_REL
99 # NULL-SEC-NEXT:   Machine: EM_X86_64
100 # NULL-SEC-NEXT: Sections:
101 # NULL-SEC-NEXT:   - Name: .foo
102 # NULL-SEC-NEXT:     Type: SHT_PROGBITS
103 # NULL-SEC-NEXT: ...
105 --- !ELF
106 FileHeader:
107   Class:   ELFCLASS64
108   Data:    ELFDATA2LSB
109   Type:    ET_REL
110   Machine: EM_X86_64
111 Sections:
112   - Type: SHT_NULL
113   - Type: SHT_PROGBITS
114     Name: .foo
116 ## Check we dump SHT_NULL sections which are not at the beginning
117 ## of the section list even if they don't have any non-null fields.
119 # RUN: yaml2obj --docnum=4 %s -o %t4
120 # RUN: obj2yaml %t4 | FileCheck %s --check-prefix=NULL-SEC-MIDDLE
122 # NULL-SEC-MIDDLE:      --- !ELF
123 # NULL-SEC-MIDDLE-NEXT: FileHeader:
124 # NULL-SEC-MIDDLE-NEXT:   Class:   ELFCLASS64
125 # NULL-SEC-MIDDLE-NEXT:   Data:    ELFDATA2LSB
126 # NULL-SEC-MIDDLE-NEXT:   Type:    ET_REL
127 # NULL-SEC-MIDDLE-NEXT:   Machine: EM_X86_64
128 # NULL-SEC-MIDDLE-NEXT: Sections:
129 # NULL-SEC-MIDDLE-NEXT:   - Name: .foo
130 # NULL-SEC-MIDDLE-NEXT:     Type: SHT_PROGBITS
131 # NULL-SEC-MIDDLE-NEXT:   - Type: SHT_NULL
132 # NULL-SEC-MIDDLE-NEXT: ...
134 --- !ELF
135 FileHeader:
136   Class:   ELFCLASS64
137   Data:    ELFDATA2LSB
138   Type:    ET_REL
139   Machine: EM_X86_64
140 Sections:
141   - Type: SHT_PROGBITS
142     Name: .foo
143   - Type: SHT_NULL