Commit | Line | Data |
---|---|---|
5a6f7e2d ILT |
1 | // testfile.cc -- Dummy ELF objects for testing purposes. |
2 | ||
6cb15b7f ILT |
3 | // Copyright 2006, 2007 Free Software Foundation, Inc. |
4 | // Written by Ian Lance Taylor <iant@google.com>. | |
5 | ||
6 | // This file is part of gold. | |
7 | ||
8 | // This program is free software; you can redistribute it and/or modify | |
9 | // it under the terms of the GNU General Public License as published by | |
10 | // the Free Software Foundation; either version 3 of the License, or | |
11 | // (at your option) any later version. | |
12 | ||
13 | // This program is distributed in the hope that it will be useful, | |
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | // GNU General Public License for more details. | |
17 | ||
18 | // You should have received a copy of the GNU General Public License | |
19 | // along with this program; if not, write to the Free Software | |
20 | // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
21 | // MA 02110-1301, USA. | |
22 | ||
5a6f7e2d ILT |
23 | #include "gold.h" |
24 | ||
25 | #include "target.h" | |
26 | #include "target-select.h" | |
27 | ||
28 | #include "test.h" | |
29 | #include "testfile.h" | |
30 | ||
31 | namespace gold_testsuite | |
32 | { | |
33 | ||
34 | using namespace gold; | |
35 | ||
36 | // A Target used for testing purposes. | |
37 | ||
6340166c ILT |
38 | template<int size, bool big_endian> |
39 | class Target_test : public Sized_target<size, big_endian> | |
5a6f7e2d ILT |
40 | { |
41 | public: | |
42 | Target_test() | |
6340166c | 43 | : Sized_target<size, big_endian>(&test_target_info) |
5a6f7e2d ILT |
44 | { } |
45 | ||
46 | void | |
47 | scan_relocs(const General_options&, Symbol_table*, Layout*, | |
6340166c | 48 | Sized_relobj<size, big_endian>*, unsigned int, |
730cdc88 ILT |
49 | unsigned int, const unsigned char*, size_t, Output_section*, |
50 | bool, size_t, const unsigned char*) | |
5a6f7e2d ILT |
51 | { ERROR("call to Target_test::scan_relocs"); } |
52 | ||
53 | void | |
6340166c | 54 | relocate_section(const Relocate_info<size, big_endian>*, unsigned int, |
730cdc88 ILT |
55 | const unsigned char*, size_t, Output_section*, bool, |
56 | unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr, | |
fe8718a4 | 57 | section_size_type) |
5a6f7e2d ILT |
58 | { ERROR("call to Target_test::relocate_section"); } |
59 | ||
6a74a719 ILT |
60 | void |
61 | scan_relocatable_relocs(const General_options&, Symbol_table*, Layout*, | |
62 | Sized_relobj<size, big_endian>*, unsigned int, | |
63 | unsigned int, const unsigned char*, | |
64 | size_t, Output_section*, bool, size_t, | |
65 | const unsigned char*, Relocatable_relocs*) | |
66 | { ERROR("call to Target_test::scan_relocatable_relocs"); } | |
67 | ||
68 | void | |
69 | relocate_for_relocatable(const Relocate_info<size, big_endian>*, | |
70 | unsigned int, const unsigned char*, size_t, | |
71 | Output_section*, off_t, const Relocatable_relocs*, | |
72 | unsigned char*, | |
73 | typename elfcpp::Elf_types<size>::Elf_Addr, | |
74 | section_size_type, unsigned char*, | |
75 | section_size_type) | |
76 | { ERROR("call to Target_test::relocate_for_relocatable"); } | |
77 | ||
5a6f7e2d ILT |
78 | static const Target::Target_info test_target_info; |
79 | }; | |
80 | ||
6340166c ILT |
81 | template<int size, bool big_endian> |
82 | const Target::Target_info Target_test<size, big_endian>::test_target_info = | |
5a6f7e2d | 83 | { |
6340166c ILT |
84 | size, // size |
85 | big_endian, // is_big_endian | |
5a6f7e2d ILT |
86 | static_cast<elfcpp::EM>(0xffff), // machine_code |
87 | false, // has_make_symbol | |
88 | false, // has_resolve | |
be9d5a93 | 89 | false, // has_code_fill |
35cdfc9a | 90 | false, // is_default_stack_executable |
5a6f7e2d | 91 | "/dummy", // dynamic_linker |
0c5e9c22 | 92 | 0x08000000, // default_text_segment_address |
5a6f7e2d ILT |
93 | 0x1000, // abi_pagesize |
94 | 0x1000 // common_pagesize | |
95 | }; | |
96 | ||
6340166c | 97 | // The test targets. |
5a6f7e2d | 98 | |
6340166c ILT |
99 | #ifdef HAVE_TARGET_32_LITTLE |
100 | Target_test<32, false> target_test_32_little; | |
101 | #endif | |
5a6f7e2d | 102 | |
6340166c ILT |
103 | #ifdef HAVE_TARGET_32_BIG |
104 | Target_test<32, true> target_test_32_big; | |
105 | #endif | |
5a6f7e2d | 106 | |
6340166c ILT |
107 | #ifdef HAVE_TARGET_64_LITTLE |
108 | Target_test<64, false> target_test_64_little; | |
109 | #endif | |
5a6f7e2d | 110 | |
6340166c ILT |
111 | #ifdef HAVE_TARGET_64_BIG |
112 | Target_test<64, true> target_test_64_big; | |
113 | #endif | |
5a6f7e2d | 114 | |
6340166c ILT |
115 | // A pointer to the test targets. This is used in CHECKs. |
116 | ||
117 | #ifdef HAVE_TARGET_32_LITTLE | |
118 | Target* target_test_pointer_32_little = &target_test_32_little; | |
119 | #endif | |
120 | ||
121 | #ifdef HAVE_TARGET_32_BIG | |
122 | Target* target_test_pointer_32_big = &target_test_32_big; | |
123 | #endif | |
124 | ||
125 | #ifdef HAVE_TARGET_64_LITTLE | |
126 | Target* target_test_pointer_64_little = &target_test_64_little; | |
127 | #endif | |
128 | ||
129 | #ifdef HAVE_TARGET_64_BIG | |
130 | Target* target_test_pointer_64_big = &target_test_64_big; | |
131 | #endif | |
132 | ||
133 | // Select the test targets. | |
134 | ||
135 | template<int size, bool big_endian> | |
5a6f7e2d ILT |
136 | class Target_selector_test : public Target_selector |
137 | { | |
138 | public: | |
139 | Target_selector_test() | |
6340166c | 140 | : Target_selector(0xffff, size, big_endian) |
5a6f7e2d ILT |
141 | { } |
142 | ||
143 | Target* | |
144 | recognize(int, int, int) | |
6340166c ILT |
145 | { |
146 | if (size == 32) | |
147 | { | |
148 | if (!big_endian) | |
149 | { | |
150 | #ifdef HAVE_TARGET_32_LITTLE | |
151 | return &target_test_32_little; | |
152 | #endif | |
153 | } | |
154 | else | |
155 | { | |
156 | #ifdef HAVE_TARGET_32_BIG | |
157 | return &target_test_32_big; | |
158 | #endif | |
159 | } | |
160 | } | |
161 | else | |
162 | { | |
163 | if (!big_endian) | |
164 | { | |
165 | #ifdef HAVE_TARGET_64_LITTLE | |
166 | return &target_test_64_little; | |
167 | #endif | |
168 | } | |
169 | else | |
170 | { | |
171 | #ifdef HAVE_TARGET_64_BIG | |
172 | return &target_test_64_big; | |
173 | #endif | |
174 | } | |
175 | } | |
176 | ||
177 | return NULL; | |
178 | } | |
5a6f7e2d ILT |
179 | }; |
180 | ||
6340166c ILT |
181 | // Register the test target selectors. These don't need to be |
182 | // conditionally compiled, as they will return NULL if there is no | |
183 | // support for them. | |
5a6f7e2d | 184 | |
6340166c ILT |
185 | Target_selector_test<32, false> target_selector_test_32_little; |
186 | Target_selector_test<32, true> target_selector_test_32_big; | |
187 | Target_selector_test<64, false> target_selector_test_64_little; | |
188 | Target_selector_test<64, true> target_selector_test_64_big; | |
5a6f7e2d ILT |
189 | |
190 | // A simple ELF object with one empty section, named ".test" and one | |
191 | // globally visible symbol named "test". | |
192 | ||
6340166c | 193 | const unsigned char test_file_1_32_little[] = |
5a6f7e2d ILT |
194 | { |
195 | // Ehdr | |
196 | // EI_MAG[0-3] | |
197 | 0x7f, 'E', 'L', 'F', | |
198 | // EI_CLASS: 32 bit. | |
199 | 1, | |
200 | // EI_DATA: little endian | |
201 | 1, | |
202 | // EI_VERSION | |
203 | 1, | |
204 | // EI_OSABI | |
205 | 0, | |
206 | // EI_ABIVERSION | |
207 | 0, | |
208 | // EI_PAD | |
209 | 0, 0, 0, 0, 0, 0, 0, | |
210 | // e_type: ET_REL | |
211 | 1, 0, | |
212 | // e_machine: a magic value used for testing. | |
213 | 0xff, 0xff, | |
214 | // e_version | |
215 | 1, 0, 0, 0, | |
216 | // e_entry | |
217 | 0, 0, 0, 0, | |
218 | // e_phoff | |
219 | 0, 0, 0, 0, | |
220 | // e_shoff: starts right after file header | |
221 | 52, 0, 0, 0, | |
222 | // e_flags | |
223 | 0, 0, 0, 0, | |
224 | // e_ehsize | |
225 | 52, 0, | |
226 | // e_phentsize | |
227 | 32, 0, | |
228 | // e_phnum | |
229 | 0, 0, | |
230 | // e_shentsize | |
231 | 40, 0, | |
232 | // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab | |
233 | 5, 0, | |
234 | // e_shstrndx | |
235 | 4, 0, | |
236 | ||
237 | // Offset 52 | |
238 | // Shdr 0: dummy entry | |
239 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
240 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
241 | 0, 0, 0, 0, 0, 0, 0, 0, | |
242 | ||
243 | // Offset 92 | |
244 | // Shdr 1: .test | |
245 | // sh_name: after initial null | |
246 | 1, 0, 0, 0, | |
247 | // sh_type: SHT_PROGBITS | |
248 | 1, 0, 0, 0, | |
249 | // sh_flags: SHF_ALLOC | |
250 | 2, 0, 0, 0, | |
251 | // sh_addr | |
252 | 0, 0, 0, 0, | |
253 | // sh_offset: after file header + 5 section headers | |
254 | 252, 0, 0, 0, | |
255 | // sh_size | |
256 | 0, 0, 0, 0, | |
257 | // sh_link | |
258 | 0, 0, 0, 0, | |
259 | // sh_info | |
260 | 0, 0, 0, 0, | |
261 | // sh_addralign | |
262 | 1, 0, 0, 0, | |
263 | // sh_entsize | |
264 | 0, 0, 0, 0, | |
265 | ||
266 | // Offset 132 | |
267 | // Shdr 2: .symtab | |
268 | // sh_name: 1 null byte + ".test\0" | |
269 | 7, 0, 0, 0, | |
270 | // sh_type: SHT_SYMTAB | |
271 | 2, 0, 0, 0, | |
272 | // sh_flags | |
273 | 0, 0, 0, 0, | |
274 | // sh_addr | |
275 | 0, 0, 0, 0, | |
276 | // sh_offset: after file header + 5 section headers + empty section | |
277 | 252, 0, 0, 0, | |
278 | // sh_size: two symbols: dummy symbol + test symbol | |
279 | 32, 0, 0, 0, | |
280 | // sh_link: to .strtab | |
281 | 3, 0, 0, 0, | |
282 | // sh_info: one local symbol, the dummy symbol | |
283 | 1, 0, 0, 0, | |
284 | // sh_addralign | |
285 | 4, 0, 0, 0, | |
286 | // sh_entsize: size of symbol | |
287 | 16, 0, 0, 0, | |
288 | ||
289 | // Offset 172 | |
290 | // Shdr 3: .strtab | |
291 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" | |
292 | 15, 0, 0, 0, | |
293 | // sh_type: SHT_STRTAB | |
294 | 3, 0, 0, 0, | |
295 | // sh_flags | |
296 | 0, 0, 0, 0, | |
297 | // sh_addr | |
298 | 0, 0, 0, 0, | |
299 | // sh_offset: after .symtab section. 284 == 0x11c | |
300 | 0x1c, 0x1, 0, 0, | |
301 | // sh_size: 1 null byte + "test\0" | |
302 | 6, 0, 0, 0, | |
303 | // sh_link | |
304 | 0, 0, 0, 0, | |
305 | // sh_info | |
306 | 0, 0, 0, 0, | |
307 | // sh_addralign | |
308 | 1, 0, 0, 0, | |
309 | // sh_entsize | |
310 | 0, 0, 0, 0, | |
311 | ||
312 | // Offset 212 | |
313 | // Shdr 4: .shstrtab | |
314 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0" | |
315 | 23, 0, 0, 0, | |
316 | // sh_type: SHT_STRTAB | |
317 | 3, 0, 0, 0, | |
318 | // sh_flags | |
319 | 0, 0, 0, 0, | |
320 | // sh_addr | |
321 | 0, 0, 0, 0, | |
322 | // sh_offset: after .strtab section. 290 == 0x122 | |
323 | 0x22, 0x1, 0, 0, | |
324 | // sh_size: all section names | |
325 | 33, 0, 0, 0, | |
326 | // sh_link | |
327 | 0, 0, 0, 0, | |
328 | // sh_info | |
329 | 0, 0, 0, 0, | |
330 | // sh_addralign | |
331 | 1, 0, 0, 0, | |
332 | // sh_entsize | |
333 | 0, 0, 0, 0, | |
334 | ||
335 | // Offset 252 | |
336 | // Contents of .symtab section | |
337 | // Symbol 0 | |
338 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
339 | ||
340 | // Offset 268 | |
341 | // Symbol 1 | |
342 | // st_name | |
343 | 1, 0, 0, 0, | |
344 | // st_value | |
345 | 0, 0, 0, 0, | |
346 | // st_size | |
347 | 0, 0, 0, 0, | |
348 | // st_info: STT_NOTYPE, STB_GLOBAL | |
349 | 0x10, | |
350 | // st_other | |
351 | 0, | |
352 | // st_shndx: In .test | |
353 | 1, 0, | |
354 | ||
355 | // Offset 284 | |
356 | // Contents of .strtab section | |
357 | '\0', | |
358 | 't', 'e', 's', 't', '\0', | |
359 | ||
360 | // Offset 290 | |
361 | // Contents of .shstrtab section | |
362 | '\0', | |
363 | '.', 't', 'e', 's', 't', '\0', | |
364 | '.', 's', 'y', 'm', 't', 'a', 'b', '\0', | |
365 | '.', 's', 't', 'r', 't', 'a', 'b', '\0', | |
366 | '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0' | |
367 | }; | |
368 | ||
6340166c ILT |
369 | const unsigned int test_file_1_size_32_little = sizeof test_file_1_32_little; |
370 | ||
371 | // 32-bit big-endian version of test_file_1_32_little. | |
372 | ||
373 | const unsigned char test_file_1_32_big[] = | |
374 | { | |
375 | // Ehdr | |
376 | // EI_MAG[0-3] | |
377 | 0x7f, 'E', 'L', 'F', | |
378 | // EI_CLASS: 32 bit. | |
379 | 1, | |
380 | // EI_DATA: big endian | |
381 | 2, | |
382 | // EI_VERSION | |
383 | 1, | |
384 | // EI_OSABI | |
385 | 0, | |
386 | // EI_ABIVERSION | |
387 | 0, | |
388 | // EI_PAD | |
389 | 0, 0, 0, 0, 0, 0, 0, | |
390 | // e_type: ET_REL | |
391 | 0, 1, | |
392 | // e_machine: a magic value used for testing. | |
393 | 0xff, 0xff, | |
394 | // e_version | |
395 | 0, 0, 0, 1, | |
396 | // e_entry | |
397 | 0, 0, 0, 0, | |
398 | // e_phoff | |
399 | 0, 0, 0, 0, | |
400 | // e_shoff: starts right after file header | |
401 | 0, 0, 0, 52, | |
402 | // e_flags | |
403 | 0, 0, 0, 0, | |
404 | // e_ehsize | |
405 | 0, 52, | |
406 | // e_phentsize | |
407 | 0, 32, | |
408 | // e_phnum | |
409 | 0, 0, | |
410 | // e_shentsize | |
411 | 0, 40, | |
412 | // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab | |
413 | 0, 5, | |
414 | // e_shstrndx | |
415 | 0, 4, | |
416 | ||
417 | // Offset 52 | |
418 | // Shdr 0: dummy entry | |
419 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
420 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
421 | 0, 0, 0, 0, 0, 0, 0, 0, | |
422 | ||
423 | // Offset 92 | |
424 | // Shdr 1: .test | |
425 | // sh_name: after initial null | |
426 | 0, 0, 0, 1, | |
427 | // sh_type: SHT_PROGBITS | |
428 | 0, 0, 0, 1, | |
429 | // sh_flags: SHF_ALLOC | |
430 | 0, 0, 0, 2, | |
431 | // sh_addr | |
432 | 0, 0, 0, 0, | |
433 | // sh_offset: after file header + 5 section headers | |
434 | 0, 0, 0, 252, | |
435 | // sh_size | |
436 | 0, 0, 0, 0, | |
437 | // sh_link | |
438 | 0, 0, 0, 0, | |
439 | // sh_info | |
440 | 0, 0, 0, 0, | |
441 | // sh_addralign | |
442 | 0, 0, 0, 1, | |
443 | // sh_entsize | |
444 | 0, 0, 0, 0, | |
445 | ||
446 | // Offset 132 | |
447 | // Shdr 2: .symtab | |
448 | // sh_name: 1 null byte + ".test\0" | |
449 | 0, 0, 0, 7, | |
450 | // sh_type: SHT_SYMTAB | |
451 | 0, 0, 0, 2, | |
452 | // sh_flags | |
453 | 0, 0, 0, 0, | |
454 | // sh_addr | |
455 | 0, 0, 0, 0, | |
456 | // sh_offset: after file header + 5 section headers + empty section | |
457 | 0, 0, 0, 252, | |
458 | // sh_size: two symbols: dummy symbol + test symbol | |
459 | 0, 0, 0, 32, | |
460 | // sh_link: to .strtab | |
461 | 0, 0, 0, 3, | |
462 | // sh_info: one local symbol, the dummy symbol | |
463 | 0, 0, 0, 1, | |
464 | // sh_addralign | |
465 | 0, 0, 0, 4, | |
466 | // sh_entsize: size of symbol | |
467 | 0, 0, 0, 16, | |
468 | ||
469 | // Offset 172 | |
470 | // Shdr 3: .strtab | |
471 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" | |
472 | 0, 0, 0, 15, | |
473 | // sh_type: SHT_STRTAB | |
474 | 0, 0, 0, 3, | |
475 | // sh_flags | |
476 | 0, 0, 0, 0, | |
477 | // sh_addr | |
478 | 0, 0, 0, 0, | |
479 | // sh_offset: after .symtab section. 284 == 0x11c | |
480 | 0, 0, 0x1, 0x1c, | |
481 | // sh_size: 1 null byte + "test\0" | |
482 | 0, 0, 0, 6, | |
483 | // sh_link | |
484 | 0, 0, 0, 0, | |
485 | // sh_info | |
486 | 0, 0, 0, 0, | |
487 | // sh_addralign | |
488 | 0, 0, 0, 1, | |
489 | // sh_entsize | |
490 | 0, 0, 0, 0, | |
491 | ||
492 | // Offset 212 | |
493 | // Shdr 4: .shstrtab | |
494 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0" | |
495 | 0, 0, 0, 23, | |
496 | // sh_type: SHT_STRTAB | |
497 | 0, 0, 0, 3, | |
498 | // sh_flags | |
499 | 0, 0, 0, 0, | |
500 | // sh_addr | |
501 | 0, 0, 0, 0, | |
502 | // sh_offset: after .strtab section. 290 == 0x122 | |
503 | 0, 0, 0x1, 0x22, | |
504 | // sh_size: all section names | |
505 | 0, 0, 0, 33, | |
506 | // sh_link | |
507 | 0, 0, 0, 0, | |
508 | // sh_info | |
509 | 0, 0, 0, 0, | |
510 | // sh_addralign | |
511 | 0, 0, 0, 1, | |
512 | // sh_entsize | |
513 | 0, 0, 0, 0, | |
514 | ||
515 | // Offset 252 | |
516 | // Contents of .symtab section | |
517 | // Symbol 0 | |
518 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
519 | ||
520 | // Offset 268 | |
521 | // Symbol 1 | |
522 | // st_name | |
523 | 0, 0, 0, 1, | |
524 | // st_value | |
525 | 0, 0, 0, 0, | |
526 | // st_size | |
527 | 0, 0, 0, 0, | |
528 | // st_info: STT_NOTYPE, STB_GLOBAL | |
529 | 0x10, | |
530 | // st_other | |
531 | 0, | |
532 | // st_shndx: In .test | |
533 | 0, 1, | |
534 | ||
535 | // Offset 284 | |
536 | // Contents of .strtab section | |
537 | '\0', | |
538 | 't', 'e', 's', 't', '\0', | |
539 | ||
540 | // Offset 290 | |
541 | // Contents of .shstrtab section | |
542 | '\0', | |
543 | '.', 't', 'e', 's', 't', '\0', | |
544 | '.', 's', 'y', 'm', 't', 'a', 'b', '\0', | |
545 | '.', 's', 't', 'r', 't', 'a', 'b', '\0', | |
546 | '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0' | |
547 | }; | |
548 | ||
549 | const unsigned int test_file_1_size_32_big = sizeof test_file_1_32_big; | |
550 | ||
551 | // 64-bit little-endian version of test_file_1_32_little. | |
552 | ||
553 | const unsigned char test_file_1_64_little[] = | |
554 | { | |
555 | // Ehdr | |
556 | // EI_MAG[0-3] | |
557 | 0x7f, 'E', 'L', 'F', | |
558 | // EI_CLASS: 64 bit. | |
559 | 2, | |
560 | // EI_DATA: little endian | |
561 | 1, | |
562 | // EI_VERSION | |
563 | 1, | |
564 | // EI_OSABI | |
565 | 0, | |
566 | // EI_ABIVERSION | |
567 | 0, | |
568 | // EI_PAD | |
569 | 0, 0, 0, 0, 0, 0, 0, | |
570 | // e_type: ET_REL | |
571 | 1, 0, | |
572 | // e_machine: a magic value used for testing. | |
573 | 0xff, 0xff, | |
574 | // e_version | |
575 | 1, 0, 0, 0, | |
576 | // e_entry | |
577 | 0, 0, 0, 0, 0, 0, 0, 0, | |
578 | // e_phoff | |
579 | 0, 0, 0, 0, 0, 0, 0, 0, | |
580 | // e_shoff: starts right after file header | |
581 | 64, 0, 0, 0, 0, 0, 0, 0, | |
582 | // e_flags | |
583 | 0, 0, 0, 0, | |
584 | // e_ehsize | |
585 | 64, 0, | |
586 | // e_phentsize | |
587 | 56, 0, | |
588 | // e_phnum | |
589 | 0, 0, | |
590 | // e_shentsize | |
591 | 64, 0, | |
592 | // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab | |
593 | 5, 0, | |
594 | // e_shstrndx | |
595 | 4, 0, | |
596 | ||
597 | // Offset 64 | |
598 | // Shdr 0: dummy entry | |
599 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
600 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
601 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
602 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
603 | ||
604 | // Offset 128 | |
605 | // Shdr 1: .test | |
606 | // sh_name: after initial null | |
607 | 1, 0, 0, 0, | |
608 | // sh_type: SHT_PROGBITS | |
609 | 1, 0, 0, 0, | |
610 | // sh_flags: SHF_ALLOC | |
611 | 2, 0, 0, 0, 0, 0, 0, 0, | |
612 | // sh_addr | |
613 | 0, 0, 0, 0, 0, 0, 0, 0, | |
614 | // sh_offset: after file header + 5 section headers. 384 == 0x180. | |
615 | 0x80, 0x1, 0, 0, 0, 0, 0, 0, | |
616 | // sh_size | |
617 | 0, 0, 0, 0, 0, 0, 0, 0, | |
618 | // sh_link | |
619 | 0, 0, 0, 0, | |
620 | // sh_info | |
621 | 0, 0, 0, 0, | |
622 | // sh_addralign | |
623 | 1, 0, 0, 0, 0, 0, 0, 0, | |
624 | // sh_entsize | |
625 | 0, 0, 0, 0, 0, 0, 0, 0, | |
626 | ||
627 | // Offset 192 | |
628 | // Shdr 2: .symtab | |
629 | // sh_name: 1 null byte + ".test\0" | |
630 | 7, 0, 0, 0, | |
631 | // sh_type: SHT_SYMTAB | |
632 | 2, 0, 0, 0, | |
633 | // sh_flags | |
634 | 0, 0, 0, 0, 0, 0, 0, 0, | |
635 | // sh_addr | |
636 | 0, 0, 0, 0, 0, 0, 0, 0, | |
637 | // sh_offset: after file header + 5 section headers + empty section | |
638 | // 384 == 0x180. | |
639 | 0x80, 0x1, 0, 0, 0, 0, 0, 0, | |
640 | // sh_size: two symbols: dummy symbol + test symbol | |
641 | 48, 0, 0, 0, 0, 0, 0, 0, | |
642 | // sh_link: to .strtab | |
643 | 3, 0, 0, 0, | |
644 | // sh_info: one local symbol, the dummy symbol | |
645 | 1, 0, 0, 0, | |
646 | // sh_addralign | |
647 | 8, 0, 0, 0, 0, 0, 0, 0, | |
648 | // sh_entsize: size of symbol | |
649 | 24, 0, 0, 0, 0, 0, 0, 0, | |
650 | ||
651 | // Offset 256 | |
652 | // Shdr 3: .strtab | |
653 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" | |
654 | 15, 0, 0, 0, | |
655 | // sh_type: SHT_STRTAB | |
656 | 3, 0, 0, 0, | |
657 | // sh_flags | |
658 | 0, 0, 0, 0, 0, 0, 0, 0, | |
659 | // sh_addr | |
660 | 0, 0, 0, 0, 0, 0, 0, 0, | |
661 | // sh_offset: after .symtab section. 432 == 0x1b0 | |
662 | 0xb0, 0x1, 0, 0, 0, 0, 0, 0, | |
663 | // sh_size: 1 null byte + "test\0" | |
664 | 6, 0, 0, 0, 0, 0, 0, 0, | |
665 | // sh_link | |
666 | 0, 0, 0, 0, | |
667 | // sh_info | |
668 | 0, 0, 0, 0, | |
669 | // sh_addralign | |
670 | 1, 0, 0, 0, 0, 0, 0, 0, | |
671 | // sh_entsize | |
672 | 0, 0, 0, 0, 0, 0, 0, 0, | |
673 | ||
674 | // Offset 320 | |
675 | // Shdr 4: .shstrtab | |
676 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0" | |
677 | 23, 0, 0, 0, | |
678 | // sh_type: SHT_STRTAB | |
679 | 3, 0, 0, 0, | |
680 | // sh_flags | |
681 | 0, 0, 0, 0, 0, 0, 0, 0, | |
682 | // sh_addr | |
683 | 0, 0, 0, 0, 0, 0, 0, 0, | |
684 | // sh_offset: after .strtab section. 438 == 0x1b6 | |
685 | 0xb6, 0x1, 0, 0, 0, 0, 0, 0, | |
686 | // sh_size: all section names | |
687 | 33, 0, 0, 0, 0, 0, 0, 0, | |
688 | // sh_link | |
689 | 0, 0, 0, 0, | |
690 | // sh_info | |
691 | 0, 0, 0, 0, | |
692 | // sh_addralign | |
693 | 1, 0, 0, 0, 0, 0, 0, 0, | |
694 | // sh_entsize | |
695 | 0, 0, 0, 0, 0, 0, 0, 0, | |
696 | ||
697 | // Offset 384 | |
698 | // Contents of .symtab section | |
699 | // Symbol 0 | |
700 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
701 | 0, 0, 0, 0, 0, 0, 0, 0, | |
702 | ||
703 | // Offset 408 | |
704 | // Symbol 1 | |
705 | // st_name | |
706 | 1, 0, 0, 0, | |
707 | // st_info: STT_NOTYPE, STB_GLOBAL | |
708 | 0x10, | |
709 | // st_other | |
710 | 0, | |
711 | // st_shndx: In .test | |
712 | 1, 0, | |
713 | // st_value | |
714 | 0, 0, 0, 0, 0, 0, 0, 0, | |
715 | // st_size | |
716 | 0, 0, 0, 0, 0, 0, 0, 0, | |
717 | ||
718 | // Offset 432 | |
719 | // Contents of .strtab section | |
720 | '\0', | |
721 | 't', 'e', 's', 't', '\0', | |
722 | ||
723 | // Offset 438 | |
724 | // Contents of .shstrtab section | |
725 | '\0', | |
726 | '.', 't', 'e', 's', 't', '\0', | |
727 | '.', 's', 'y', 'm', 't', 'a', 'b', '\0', | |
728 | '.', 's', 't', 'r', 't', 'a', 'b', '\0', | |
729 | '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0' | |
730 | }; | |
731 | ||
732 | const unsigned int test_file_1_size_64_little = sizeof test_file_1_64_little; | |
733 | ||
734 | // 64-bit big-endian version of test_file_1_32_little. | |
735 | ||
736 | const unsigned char test_file_1_64_big[] = | |
737 | { | |
738 | // Ehdr | |
739 | // EI_MAG[0-3] | |
740 | 0x7f, 'E', 'L', 'F', | |
741 | // EI_CLASS: 64 bit. | |
742 | 2, | |
743 | // EI_DATA: big endian | |
744 | 2, | |
745 | // EI_VERSION | |
746 | 1, | |
747 | // EI_OSABI | |
748 | 0, | |
749 | // EI_ABIVERSION | |
750 | 0, | |
751 | // EI_PAD | |
752 | 0, 0, 0, 0, 0, 0, 0, | |
753 | // e_type: ET_REL | |
754 | 0, 1, | |
755 | // e_machine: a magic value used for testing. | |
756 | 0xff, 0xff, | |
757 | // e_version | |
758 | 0, 0, 0, 1, | |
759 | // e_entry | |
760 | 0, 0, 0, 0, 0, 0, 0, 0, | |
761 | // e_phoff | |
762 | 0, 0, 0, 0, 0, 0, 0, 0, | |
763 | // e_shoff: starts right after file header | |
764 | 0, 0, 0, 0, 0, 0, 0, 64, | |
765 | // e_flags | |
766 | 0, 0, 0, 0, | |
767 | // e_ehsize | |
768 | 0, 64, | |
769 | // e_phentsize | |
770 | 0, 56, | |
771 | // e_phnum | |
772 | 0, 0, | |
773 | // e_shentsize | |
774 | 0, 64, | |
775 | // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab | |
776 | 0, 5, | |
777 | // e_shstrndx | |
778 | 0, 4, | |
779 | ||
780 | // Offset 64 | |
781 | // Shdr 0: dummy entry | |
782 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
783 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
784 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
785 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
786 | ||
787 | // Offset 128 | |
788 | // Shdr 1: .test | |
789 | // sh_name: after initial null | |
790 | 0, 0, 0, 1, | |
791 | // sh_type: SHT_PROGBITS | |
792 | 0, 0, 0, 1, | |
793 | // sh_flags: SHF_ALLOC | |
794 | 0, 0, 0, 0, 0, 0, 0, 2, | |
795 | // sh_addr | |
796 | 0, 0, 0, 0, 0, 0, 0, 0, | |
797 | // sh_offset: after file header + 5 section headers. 384 == 0x180. | |
798 | 0, 0, 0, 0, 0, 0, 0x1, 0x80, | |
799 | // sh_size | |
800 | 0, 0, 0, 0, 0, 0, 0, 0, | |
801 | // sh_link | |
802 | 0, 0, 0, 0, | |
803 | // sh_info | |
804 | 0, 0, 0, 0, | |
805 | // sh_addralign | |
806 | 0, 0, 0, 0, 0, 0, 0, 1, | |
807 | // sh_entsize | |
808 | 0, 0, 0, 0, 0, 0, 0, 0, | |
809 | ||
810 | // Offset 192 | |
811 | // Shdr 2: .symtab | |
812 | // sh_name: 1 null byte + ".test\0" | |
813 | 0, 0, 0, 7, | |
814 | // sh_type: SHT_SYMTAB | |
815 | 0, 0, 0, 2, | |
816 | // sh_flags | |
817 | 0, 0, 0, 0, 0, 0, 0, 0, | |
818 | // sh_addr | |
819 | 0, 0, 0, 0, 0, 0, 0, 0, | |
820 | // sh_offset: after file header + 5 section headers + empty section | |
821 | // 384 == 0x180. | |
822 | 0, 0, 0, 0, 0, 0, 0x1, 0x80, | |
823 | // sh_size: two symbols: dummy symbol + test symbol | |
824 | 0, 0, 0, 0, 0, 0, 0, 48, | |
825 | // sh_link: to .strtab | |
826 | 0, 0, 0, 3, | |
827 | // sh_info: one local symbol, the dummy symbol | |
828 | 0, 0, 0, 1, | |
829 | // sh_addralign | |
830 | 0, 0, 0, 0, 0, 0, 0, 8, | |
831 | // sh_entsize: size of symbol | |
832 | 0, 0, 0, 0, 0, 0, 0, 24, | |
833 | ||
834 | // Offset 256 | |
835 | // Shdr 3: .strtab | |
836 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" | |
837 | 0, 0, 0, 15, | |
838 | // sh_type: SHT_STRTAB | |
839 | 0, 0, 0, 3, | |
840 | // sh_flags | |
841 | 0, 0, 0, 0, 0, 0, 0, 0, | |
842 | // sh_addr | |
843 | 0, 0, 0, 0, 0, 0, 0, 0, | |
844 | // sh_offset: after .symtab section. 432 == 0x1b0 | |
845 | 0, 0, 0, 0, 0, 0, 0x1, 0xb0, | |
846 | // sh_size: 1 null byte + "test\0" | |
847 | 0, 0, 0, 0, 0, 0, 0, 6, | |
848 | // sh_link | |
849 | 0, 0, 0, 0, | |
850 | // sh_info | |
851 | 0, 0, 0, 0, | |
852 | // sh_addralign | |
853 | 0, 0, 0, 0, 0, 0, 0, 1, | |
854 | // sh_entsize | |
855 | 0, 0, 0, 0, 0, 0, 0, 0, | |
856 | ||
857 | // Offset 320 | |
858 | // Shdr 4: .shstrtab | |
859 | // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0" | |
860 | 0, 0, 0, 23, | |
861 | // sh_type: SHT_STRTAB | |
862 | 0, 0, 0, 3, | |
863 | // sh_flags | |
864 | 0, 0, 0, 0, 0, 0, 0, 0, | |
865 | // sh_addr | |
866 | 0, 0, 0, 0, 0, 0, 0, 0, | |
867 | // sh_offset: after .strtab section. 438 == 0x1b6 | |
868 | 0, 0, 0, 0, 0, 0, 0x1, 0xb6, | |
869 | // sh_size: all section names | |
870 | 0, 0, 0, 0, 0, 0, 0, 33, | |
871 | // sh_link | |
872 | 0, 0, 0, 0, | |
873 | // sh_info | |
874 | 0, 0, 0, 0, | |
875 | // sh_addralign | |
876 | 0, 0, 0, 0, 0, 0, 0, 1, | |
877 | // sh_entsize | |
878 | 0, 0, 0, 0, 0, 0, 0, 0, | |
879 | ||
880 | // Offset 384 | |
881 | // Contents of .symtab section | |
882 | // Symbol 0 | |
883 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
884 | 0, 0, 0, 0, 0, 0, 0, 0, | |
885 | ||
886 | // Offset 408 | |
887 | // Symbol 1 | |
888 | // st_name | |
889 | 0, 0, 0, 1, | |
890 | // st_info: STT_NOTYPE, STB_GLOBAL | |
891 | 0x10, | |
892 | // st_other | |
893 | 0, | |
894 | // st_shndx: In .test | |
895 | 0, 1, | |
896 | // st_value | |
897 | 0, 0, 0, 0, 0, 0, 0, 0, | |
898 | // st_size | |
899 | 0, 0, 0, 0, 0, 0, 0, 0, | |
900 | ||
901 | // Offset 432 | |
902 | // Contents of .strtab section | |
903 | '\0', | |
904 | 't', 'e', 's', 't', '\0', | |
905 | ||
906 | // Offset 438 | |
907 | // Contents of .shstrtab section | |
908 | '\0', | |
909 | '.', 't', 'e', 's', 't', '\0', | |
910 | '.', 's', 'y', 'm', 't', 'a', 'b', '\0', | |
911 | '.', 's', 't', 'r', 't', 'a', 'b', '\0', | |
912 | '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0' | |
913 | }; | |
914 | ||
915 | const unsigned int test_file_1_size_64_big = sizeof test_file_1_64_big; | |
5a6f7e2d ILT |
916 | |
917 | } // End namespace gold_testsuite. |