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