1 # The binary blobs in this file were created like this:
2 # llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu Inputs/elf-packed-relocs1.s -o - | obj2yaml | grep Content:
4 # RUN: yaml2obj --docnum=1 %s -o %t1
5 # RUN: llvm-readobj --relocations %t1 | FileCheck --check-prefix=LLVM1 %s
6 # LLVM1: Section (1) .rela.dyn {
7 # LLVM1-NEXT: 0x1100 R_X86_64_RELATIVE - 0x0
8 # LLVM1-NEXT: 0x1180 R_X86_64_RELATIVE - 0x0
9 # LLVM1-NEXT: 0x1188 R_X86_64_64 sym1 0x0
10 # LLVM1-NEXT: 0x1190 R_X86_64_64 sym2 0x0
11 # LLVM1-NEXT: 0x1191 R_X86_64_64 sym1 0x8
12 # LLVM1-NEXT: 0x1193 R_X86_64_64 sym2 0xC
13 # LLVM1-NEXT: 0x1197 R_X86_64_64 sym1 0xA
14 # LLVM1-NEXT: 0x119F R_X86_64_64 sym2 0xA
17 # RUN: llvm-readelf --relocations %t1 | FileCheck --check-prefix=GNU1 %s
18 # GNU1: Relocation section '.rela.dyn' at offset 0x40 contains 8 entries:
19 # GNU1: 0000000000001100 0000000000000008 R_X86_64_RELATIVE 0
20 # GNU1-NEXT: 0000000000001180 0000000000000008 R_X86_64_RELATIVE 0
21 # GNU1-NEXT: 0000000000001188 0000000100000001 R_X86_64_64 0000000000000000 sym1 + 0
22 # GNU1-NEXT: 0000000000001190 0000000200000001 R_X86_64_64 0000000000000000 sym2 + 0
23 # GNU1-NEXT: 0000000000001191 0000000100000001 R_X86_64_64 0000000000000000 sym1 + 8
24 # GNU1-NEXT: 0000000000001193 0000000200000001 R_X86_64_64 0000000000000000 sym2 + c
25 # GNU1-NEXT: 0000000000001197 0000000100000001 R_X86_64_64 0000000000000000 sym1 + a
26 # GNU1-NEXT: 000000000000119f 0000000200000001 R_X86_64_64 0000000000000000 sym2 + a
28 # elf-packed-relocs1.s
37 Type: SHT_ANDROID_RELA
39 Link: [[LINK=.symtab]]
40 Content: 41505332088020020108800280010202088180808010818080802002080181808080100802818080802004020C7E048180808010088180808020
41 ShOffset: [[SHOFFSET=<none>]]
48 ## Check we report a warning when we are unable to dump relocations for a SHT_ANDROID_RELA section.
50 # RUN: yaml2obj --docnum=1 -DSHOFFSET=0xffffffff %s -o %t1.broken
51 # RUN: llvm-readobj --relocations %t1.broken 2>&1 | FileCheck -DFILE=%t1.broken --check-prefix=BROKEN-RELA-LLVM %s
52 # RUN: llvm-readelf --relocations %t1.broken 2>&1 | FileCheck -DFILE=%t1.broken --check-prefix=BROKEN-RELA-GNU %s
54 # BROKEN-RELA-LLVM: Relocations [
55 # BROKEN-RELA-LLVM-NEXT: Section (1) .rela.dyn {
56 # BROKEN-RELA-LLVM-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_ANDROID_RELA section with index 1: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x3a) that is greater than the file size (0x238)
57 # BROKEN-RELA-LLVM-NEXT: }
58 # BROKEN-RELA-LLVM-NEXT: ]
60 # BROKEN-RELA-GNU: warning: '[[FILE]]': unable to get the number of relocations in SHT_ANDROID_RELA section with index 1: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x3a) that is greater than the file size (0x238)
61 # BROKEN-RELA-GNU: Relocation section '.rela.dyn' at offset 0xffffffff contains <?> entries:
62 # BROKEN-RELA-GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
63 # BROKEN-RELA-GNU-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_ANDROID_RELA section with index 1: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x3a) that is greater than the file size (0x238)
65 ## Check we report a warning when the sh_link field of the SHT_ANDROID_RELA section is broken.
67 # RUN: yaml2obj --docnum=1 -DLINK=0xffffffff %s -o %t1.broken.link
68 # RUN: llvm-readobj --relocations %t1.broken.link 2>&1 | \
69 # RUN: FileCheck -DFILE=%t1.broken.link --check-prefix=BROKEN-RELA-LINK-LLVM %s
70 # RUN: llvm-readelf --relocations %t1.broken.link 2>&1 | \
71 # RUN: FileCheck -DFILE=%t1.broken.link --check-prefix=BROKEN-RELA-LINK-GNU %s
73 # BROKEN-RELA-LINK-LLVM: Relocations [
74 # BROKEN-RELA-LINK-LLVM-NEXT: Section (1) .rela.dyn {
75 # BROKEN-RELA-LINK-LLVM-NEXT: warning: '[[FILE]]': unable to locate a symbol table for SHT_ANDROID_RELA section with index 1: invalid section index: 4294967295
76 # BROKEN-RELA-LINK-LLVM-NEXT: }
77 # BROKEN-RELA-LINK-LLVM-NEXT: ]
79 # BROKEN-RELA-LINK-GNU: Relocation section '.rela.dyn' at offset 0x40 contains 8 entries:
80 # BROKEN-RELA-LINK-GNU-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
81 # BROKEN-RELA-LINK-GNU-NEXT: warning: '[[FILE]]': unable to locate a symbol table for SHT_ANDROID_RELA section with index 1: invalid section index: 4294967295
83 # RUN: yaml2obj --docnum=2 %s -o %t2
84 # RUN: llvm-readobj --relocations %t2 | FileCheck --check-prefix=LLVM2 %s
85 # LLVM2: Section (1) .rel.dyn {
86 # LLVM2-NEXT: 0x1008 R_386_32 sym1 0x0
87 # LLVM2-NEXT: 0x1010 R_386_GOT32 sym2 0x0
88 # LLVM2-NEXT: 0x100C R_386_RELATIVE - 0x0
89 # LLVM2-NEXT: 0x1008 R_386_RELATIVE - 0x0
90 # LLVM2-NEXT: 0x1004 R_386_RELATIVE - 0x0
91 # LLVM2-NEXT: 0x1000 R_386_RELATIVE - 0x0
92 # LLVM2-NEXT: 0xFFC R_386_RELATIVE - 0x0
93 # LLVM2-NEXT: 0xFF8 R_386_RELATIVE - 0x0
94 # LLVM2-NEXT: 0xFF4 R_386_RELATIVE - 0x0
95 # LLVM2-NEXT: 0xFF0 R_386_RELATIVE - 0x0
98 # RUN: llvm-readelf --relocations %t2 | FileCheck --check-prefix=GNU2 %s
99 # GNU2: Relocation section '.rel.dyn' at offset 0x34 contains 10 entries:
100 # GNU2: 00001008 00000101 R_386_32 00000000 sym1
101 # GNU2-NEXT: 00001010 00000203 R_386_GOT32 00000000 sym2
102 # GNU2-NEXT: 0000100c 00000008 R_386_RELATIVE
103 # GNU2-NEXT: 00001008 00000008 R_386_RELATIVE
104 # GNU2-NEXT: 00001004 00000008 R_386_RELATIVE
105 # GNU2-NEXT: 00001000 00000008 R_386_RELATIVE
106 # GNU2-NEXT: 00000ffc 00000008 R_386_RELATIVE
107 # GNU2-NEXT: 00000ff8 00000008 R_386_RELATIVE
108 # GNU2-NEXT: 00000ff4 00000008 R_386_RELATIVE
109 # GNU2-NEXT: 00000ff0 00000008 R_386_RELATIVE
111 # elf-packed-relocs2.s
120 Type: SHT_ANDROID_REL
122 Link: [[LINK=.symtab]]
123 Content: 415053320A80200202088102830408037C08
124 ShOffset: [[SHOFFSET=<none>]]
131 ## Check we report a warning when we are unable to dump relocations for a SHT_ANDROID_REL section.
133 # RUN: yaml2obj --docnum=2 -DSHOFFSET=0xffffffff %s -o %t2.broken
134 # RUN: llvm-readobj --relocations %t2.broken 2>&1 | FileCheck -DFILE=%t2.broken --check-prefix=BROKEN-REL-LLVM %s
135 # RUN: llvm-readelf --relocations %t2.broken 2>&1 | FileCheck -DFILE=%t2.broken --check-prefix=BROKEN-REL-GNU %s
137 # BROKEN-REL-LLVM: Relocations [
138 # BROKEN-REL-LLVM-NEXT: Section (1) .rel.dyn {
139 # BROKEN-REL-LLVM-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_ANDROID_REL section with index 1: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x12) that cannot be represented
140 # BROKEN-REL-LLVM-NEXT: }
141 # BROKEN-REL-LLVM-NEXT: ]
143 # BROKEN-REL-GNU: warning: '[[FILE]]': unable to get the number of relocations in SHT_ANDROID_REL section with index 1: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x12) that cannot be represented
144 # BROKEN-REL-GNU: Relocation section '.rel.dyn' at offset 0xffffffff contains <?> entries:
145 # BROKEN-REL-GNU-NEXT: Offset Info Type Sym. Value Symbol's Name
146 # BROKEN-REL-GNU-NEXT: warning: '[[FILE]]': unable to read relocations from SHT_ANDROID_REL section with index 1: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x12) that cannot be represented
148 ## Check we report a warning when the sh_link field of the SHT_ANDROID_REL section is broken.
150 # RUN: yaml2obj --docnum=2 -DLINK=0xffffffff %s -o %t2.broken.link
151 # RUN: llvm-readobj --relocations %t2.broken.link 2>&1 | \
152 # RUN: FileCheck -DFILE=%t2.broken.link --check-prefix=BROKEN-REL-LINK-LLVM %s
153 # RUN: llvm-readelf --relocations %t2.broken.link 2>&1 | \
154 # RUN: FileCheck -DFILE=%t2.broken.link --check-prefix=BROKEN-REL-LINK-GNU %s
156 # BROKEN-REL-LINK-LLVM: Relocations [
157 # BROKEN-REL-LINK-LLVM-NEXT: Section (1) .rel.dyn {
158 # BROKEN-REL-LINK-LLVM-NEXT: warning: '[[FILE]]': unable to locate a symbol table for SHT_ANDROID_REL section with index 1: invalid section index: 4294967295
159 # BROKEN-REL-LINK-LLVM-NEXT: }
160 # BROKEN-REL-LINK-LLVM-NEXT: ]
162 # BROKEN-REL-LINK-GNU: Relocation section '.rel.dyn' at offset 0x34 contains 10 entries:
163 # BROKEN-REL-LINK-GNU-NEXT: Offset Info Type Sym. Value Symbol's Name
164 # BROKEN-REL-LINK-GNU-NEXT: warning: '[[FILE]]': unable to locate a symbol table for SHT_ANDROID_REL section with index 1: invalid section index: 4294967295
166 # RUN: yaml2obj --docnum=3 %s | llvm-readobj --relocations - | FileCheck --check-prefix=LLVM3 %s
168 # LLVM3: Section (1) .rela.dyn {
169 # LLVM3-NEXT: 0x1100 R_X86_64_RELATIVE - 0x0
170 # LLVM3-NEXT: 0x1180 R_X86_64_RELATIVE - 0x8
171 # LLVM3-NEXT: 0x1200 R_X86_64_64 sym1 0x0
172 # LLVM3-NEXT: 0x1208 R_X86_64_64 sym2 0x0
173 # LLVM3-NEXT: 0x1210 R_X86_64_64 sym1 0x0
174 # LLVM3-NEXT: 0x1218 R_X86_64_64 sym2 0x8
177 # RUN: yaml2obj --docnum=3 %s | llvm-readelf -r - | FileCheck --check-prefix=GNU3 %s
178 # GNU3: Relocation section '.rela.dyn' at offset 0x40 contains 6 entries:
179 # GNU3: 0000000000001100 0000000000000008 R_X86_64_RELATIVE 0
180 # GNU3-NEXT: 0000000000001180 0000000000000008 R_X86_64_RELATIVE 8
181 # GNU3-NEXT: 0000000000001200 0000000100000001 R_X86_64_64 0000000000000000 sym1 + 0
182 # GNU3-NEXT: 0000000000001208 0000000200000001 R_X86_64_64 0000000000000000 sym2 + 0
183 # GNU3-NEXT: 0000000000001210 0000000100000001 R_X86_64_64 0000000000000000 sym1 + 0
184 # GNU3-NEXT: 0000000000001218 0000000200000001 R_X86_64_64 0000000000000000 sym2 + 8
186 # elf-packed-relocs3.s
195 Type: SHT_ANDROID_RELA
198 Content: 415053320680200208800208008001080802008001818080801008818080802002080881808080100008818080802008