1 # RUN: yaml2obj --docnum=1 %s -o %t
2 # RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=LLVM --match-full-lines
3 # RUN: llvm-readelf -r %t | FileCheck %s --check-prefix=GNU --match-full-lines
6 # LLVM-NEXT: Section ([[#]]) .crel.text {
7 # LLVM-NEXT: 0x1 R_X86_64_32 g1 0x1
8 # LLVM-NEXT: 0x2 R_X86_64_64 l1 0x2
9 # LLVM-NEXT: 0x0 R_X86_64_32S g1 0xFFFFFFFFFFFFFFFF
10 # LLVM-NEXT: 0x4 R_X86_64_32S .text 0x8000000000000000
12 # LLVM-NEXT: Section ([[#]]) .crelnonalloc {
13 # LLVM-NEXT: 0x10 R_X86_64_64 g1 0x1
14 # LLVM-NEXT: 0x20 R_X86_64_64 g2 0x2
18 # GNU: Relocation section '.crel.text' at offset 0x48 contains 4 entries:
19 # GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
20 # GNU-NEXT: 0000000000000001 000000030000000a R_X86_64_32 0000000000000000 g1 + 1
21 # GNU-NEXT: 0000000000000002 0000000200000001 R_X86_64_64 0000000000000000 l1 + 2
22 # GNU-NEXT: 0000000000000000 000000030000000b R_X86_64_32S 0000000000000000 g1 - 1
23 # GNU-NEXT: 0000000000000004 000000010000000b R_X86_64_32S 0000000000000000 .text - 8000000000000000
25 # GNU-NEXT: Relocation section '.crelnonalloc' at offset 0xa2 contains 2 entries:
26 # GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
27 # GNU-NEXT: 0000000000000010 0000000300000001 R_X86_64_64 0000000000000000 g1 + 1
28 # GNU-NEXT: 0000000000000020 0000000400000001 R_X86_64_64 0000000000000000 g2 + 2
31 FileHeader: !FileHeader
40 Content: "0000000000000000"
58 Addend: 0xffffffffffffffff
62 Addend: 0x8000000000000000
93 ## Check relocation formatting on ELFCLASS32 as well.
94 # RUN: yaml2obj --docnum=2 %s -o %t2
95 # RUN: llvm-readobj -r %t2 | FileCheck %s --check-prefix=LLVM2 --match-full-lines
96 # RUN: llvm-readelf -r %t2 | FileCheck %s --check-prefix=GNU2 --match-full-lines
98 # LLVM2: Relocations [
99 # LLVM2-NEXT: Section (2) .crel.text {
100 # LLVM2-NEXT: 0x8 R_386_PC32 l1 0x1
101 # LLVM2-NEXT: 0x4 R_386_32 g1 0x0
105 # GNU2: Relocation section '.crel.text' at offset {{.*}} contains 2 entries:
106 # GNU2-NEXT: Offset Info Type Sym. Value Symbol's Name + Addend
107 # GNU2-NEXT: 00000008 00000102 R_386_PC32 00000000 l1 + 1
108 # GNU2-NEXT: 00000004 00000201 R_386_32 00000000 g1 + 0
137 ## Check CREL with implicit addends.
138 # RUN: yaml2obj --docnum=3 %s -o %t3
139 # RUN: llvm-readobj -r %t3 | FileCheck %s --check-prefix=LLVM3 --match-full-lines
140 # RUN: llvm-readelf -r %t3 | FileCheck %s --check-prefix=GNU3 --match-full-lines
142 # LLVM3: Relocations [
143 # LLVM3-NEXT: Section (3) .crel.data {
144 # LLVM3-NEXT: 0x1F R_X86_64_32 g1
145 # LLVM3-NEXT: 0x3F R_X86_64_64 g1
146 # LLVM3-NEXT: 0x0 R_X86_64_32S l1
150 # GNU3: Relocation section '.crel.data' at offset {{.*}} contains 3 entries:
151 # GNU3-NEXT: Offset Info Type Symbol's Value Symbol's Name
152 # GNU3-NEXT: 000000000000001f 000000030000000a R_X86_64_32 0000000000000000 g1
153 # GNU3-NEXT: 000000000000003f 0000000300000001 R_X86_64_64 0000000000000000 g1
154 # GNU3-NEXT: 0000000000000000 000000020000000b R_X86_64_32S 0000000000000000 l1
168 Flags: [ SHF_INFO_LINK ]
171 Content: 187f030a82017787feffffffffffffff077f0a
182 ## Test errors. See also relocation-errors.test.
183 # RUN: yaml2obj --docnum=4 %s -o %t.err
184 # RUN: llvm-readobj -r %t.err 2>&1 | FileCheck %s --check-prefix=ERR-LLVM -DFILE=%t.err
185 # RUN: llvm-readelf -r %t.err 2>&1 | FileCheck %s --check-prefix=ERR-GNU -DFILE=%t.err
187 # ERR-LLVM: Section ([[#]]) .crel.data {
188 # ERR-LLVM-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_CREL section with index 3: unable to decode LEB128 at offset 0x00000000: malformed uleb128, extends past end
191 # ERR-GNU: warning: '[[FILE]]': unable to get the number of relocations in SHT_CREL section with index 3: unable to decode LEB128 at offset 0x00000000: malformed uleb128, extends past end
193 # ERR-GNU-NEXT: Relocation section '.crel.data' at offset 0x40 contains <?> entries:
194 # ERR-GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name
197 # RUN: yaml2obj --docnum=4 -DCONTENT=08 %s -o %t.err2
198 # RUN: llvm-readobj -r %t.err2 2>&1 | FileCheck %s --check-prefix=ERR2-LLVM -DFILE=%t.err2
199 # RUN: llvm-readelf -r %t.err2 2>&1 | FileCheck %s --check-prefix=ERR2-GNU -DFILE=%t.err2
201 # ERR2-LLVM: Section ([[#]]) .crel.data {
202 # ERR2-LLVM-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_CREL section with index 3: unexpected end of data at offset 0x1 while reading [0x1, 0x2)
205 # ERR2-GNU: Relocation section '.crel.data' at offset 0x40 contains 1 entries:
206 # ERR2-GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name
207 # ERR2-GNU: warning: '[[FILE]]': unable to read relocations from SHT_CREL section with index 3: unexpected end of data at offset 0x1 while reading [0x1, 0x2)
208 # ERR2-GNU-NOT: {{.}}
226 Content: [[CONTENT=""]]