2009-06-12 Tristan Gingold <gingold@adacore.com>
[binutils.git] / gold / testsuite / testfile.cc
bloba2a45bec23aae719d7adc5198c27a7552960a03d
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(const General_options&, Symbol_table*, Layout*,
48 Sized_relobj<size, big_endian>*, unsigned int,
49 unsigned int, const unsigned char*, size_t, Output_section*,
50 bool, size_t, const unsigned char*)
51 { ERROR("call to Target_test::gc_process_relocs"); }
53 void
54 scan_relocs(const General_options&, Symbol_table*, Layout*,
55 Sized_relobj<size, big_endian>*, unsigned int,
56 unsigned int, const unsigned char*, size_t, Output_section*,
57 bool, size_t, const unsigned char*)
58 { ERROR("call to Target_test::scan_relocs"); }
60 void
61 relocate_section(const Relocate_info<size, big_endian>*, unsigned int,
62 const unsigned char*, size_t, Output_section*, bool,
63 unsigned char*, typename elfcpp::Elf_types<size>::Elf_Addr,
64 section_size_type)
65 { ERROR("call to Target_test::relocate_section"); }
67 void
68 scan_relocatable_relocs(const General_options&, Symbol_table*, Layout*,
69 Sized_relobj<size, big_endian>*, unsigned int,
70 unsigned int, const unsigned char*,
71 size_t, Output_section*, bool, size_t,
72 const unsigned char*, Relocatable_relocs*)
73 { ERROR("call to Target_test::scan_relocatable_relocs"); }
75 void
76 relocate_for_relocatable(const Relocate_info<size, big_endian>*,
77 unsigned int, const unsigned char*, size_t,
78 Output_section*, off_t, const Relocatable_relocs*,
79 unsigned char*,
80 typename elfcpp::Elf_types<size>::Elf_Addr,
81 section_size_type, unsigned char*,
82 section_size_type)
83 { ERROR("call to Target_test::relocate_for_relocatable"); }
85 static const Target::Target_info test_target_info;
88 template<int size, bool big_endian>
89 const Target::Target_info Target_test<size, big_endian>::test_target_info =
91 size, // size
92 big_endian, // is_big_endian
93 static_cast<elfcpp::EM>(0xffff), // machine_code
94 false, // has_make_symbol
95 false, // has_resolve
96 false, // has_code_fill
97 false, // is_default_stack_executable
98 '\0', // wrap_char
99 "/dummy", // dynamic_linker
100 0x08000000, // default_text_segment_address
101 0x1000, // abi_pagesize
102 0x1000 // common_pagesize
105 // The test targets.
107 #ifdef HAVE_TARGET_32_LITTLE
108 Target_test<32, false> target_test_32_little;
109 #endif
111 #ifdef HAVE_TARGET_32_BIG
112 Target_test<32, true> target_test_32_big;
113 #endif
115 #ifdef HAVE_TARGET_64_LITTLE
116 Target_test<64, false> target_test_64_little;
117 #endif
119 #ifdef HAVE_TARGET_64_BIG
120 Target_test<64, true> target_test_64_big;
121 #endif
123 // A pointer to the test targets. This is used in CHECKs.
125 #ifdef HAVE_TARGET_32_LITTLE
126 Target* target_test_pointer_32_little = &target_test_32_little;
127 #endif
129 #ifdef HAVE_TARGET_32_BIG
130 Target* target_test_pointer_32_big = &target_test_32_big;
131 #endif
133 #ifdef HAVE_TARGET_64_LITTLE
134 Target* target_test_pointer_64_little = &target_test_64_little;
135 #endif
137 #ifdef HAVE_TARGET_64_BIG
138 Target* target_test_pointer_64_big = &target_test_64_big;
139 #endif
141 // Select the test targets.
143 template<int size, bool big_endian>
144 class Target_selector_test : public Target_selector
146 public:
147 Target_selector_test()
148 : Target_selector(0xffff, size, big_endian, NULL)
151 Target*
152 do_instantiate_target()
154 gold_unreachable();
155 return NULL;
158 Target*
159 do_recognize(int, int, int)
161 if (size == 32)
163 if (!big_endian)
165 #ifdef HAVE_TARGET_32_LITTLE
166 return &target_test_32_little;
167 #endif
169 else
171 #ifdef HAVE_TARGET_32_BIG
172 return &target_test_32_big;
173 #endif
176 else
178 if (!big_endian)
180 #ifdef HAVE_TARGET_64_LITTLE
181 return &target_test_64_little;
182 #endif
184 else
186 #ifdef HAVE_TARGET_64_BIG
187 return &target_test_64_big;
188 #endif
192 return NULL;
195 Target*
196 do_recognize_by_name(const char*)
197 { return NULL; }
199 void
200 do_supported_names(std::vector<const char*>*)
204 // Register the test target selectors. These don't need to be
205 // conditionally compiled, as they will return NULL if there is no
206 // support for them.
208 Target_selector_test<32, false> target_selector_test_32_little;
209 Target_selector_test<32, true> target_selector_test_32_big;
210 Target_selector_test<64, false> target_selector_test_64_little;
211 Target_selector_test<64, true> target_selector_test_64_big;
213 // A simple ELF object with one empty section, named ".test" and one
214 // globally visible symbol named "test".
216 const unsigned char test_file_1_32_little[] =
218 // Ehdr
219 // EI_MAG[0-3]
220 0x7f, 'E', 'L', 'F',
221 // EI_CLASS: 32 bit.
223 // EI_DATA: little endian
225 // EI_VERSION
227 // EI_OSABI
229 // EI_ABIVERSION
231 // EI_PAD
232 0, 0, 0, 0, 0, 0, 0,
233 // e_type: ET_REL
234 1, 0,
235 // e_machine: a magic value used for testing.
236 0xff, 0xff,
237 // e_version
238 1, 0, 0, 0,
239 // e_entry
240 0, 0, 0, 0,
241 // e_phoff
242 0, 0, 0, 0,
243 // e_shoff: starts right after file header
244 52, 0, 0, 0,
245 // e_flags
246 0, 0, 0, 0,
247 // e_ehsize
248 52, 0,
249 // e_phentsize
250 32, 0,
251 // e_phnum
252 0, 0,
253 // e_shentsize
254 40, 0,
255 // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab
256 5, 0,
257 // e_shstrndx
258 4, 0,
260 // Offset 52
261 // Shdr 0: dummy entry
262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0,
266 // Offset 92
267 // Shdr 1: .test
268 // sh_name: after initial null
269 1, 0, 0, 0,
270 // sh_type: SHT_PROGBITS
271 1, 0, 0, 0,
272 // sh_flags: SHF_ALLOC
273 2, 0, 0, 0,
274 // sh_addr
275 0, 0, 0, 0,
276 // sh_offset: after file header + 5 section headers
277 252, 0, 0, 0,
278 // sh_size
279 0, 0, 0, 0,
280 // sh_link
281 0, 0, 0, 0,
282 // sh_info
283 0, 0, 0, 0,
284 // sh_addralign
285 1, 0, 0, 0,
286 // sh_entsize
287 0, 0, 0, 0,
289 // Offset 132
290 // Shdr 2: .symtab
291 // sh_name: 1 null byte + ".test\0"
292 7, 0, 0, 0,
293 // sh_type: SHT_SYMTAB
294 2, 0, 0, 0,
295 // sh_flags
296 0, 0, 0, 0,
297 // sh_addr
298 0, 0, 0, 0,
299 // sh_offset: after file header + 5 section headers + empty section
300 252, 0, 0, 0,
301 // sh_size: two symbols: dummy symbol + test symbol
302 32, 0, 0, 0,
303 // sh_link: to .strtab
304 3, 0, 0, 0,
305 // sh_info: one local symbol, the dummy symbol
306 1, 0, 0, 0,
307 // sh_addralign
308 4, 0, 0, 0,
309 // sh_entsize: size of symbol
310 16, 0, 0, 0,
312 // Offset 172
313 // Shdr 3: .strtab
314 // sh_name: 1 null byte + ".test\0" + ".symtab\0"
315 15, 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 .symtab section. 284 == 0x11c
323 0x1c, 0x1, 0, 0,
324 // sh_size: 1 null byte + "test\0"
325 6, 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,
335 // Offset 212
336 // Shdr 4: .shstrtab
337 // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0"
338 23, 0, 0, 0,
339 // sh_type: SHT_STRTAB
340 3, 0, 0, 0,
341 // sh_flags
342 0, 0, 0, 0,
343 // sh_addr
344 0, 0, 0, 0,
345 // sh_offset: after .strtab section. 290 == 0x122
346 0x22, 0x1, 0, 0,
347 // sh_size: all section names
348 33, 0, 0, 0,
349 // sh_link
350 0, 0, 0, 0,
351 // sh_info
352 0, 0, 0, 0,
353 // sh_addralign
354 1, 0, 0, 0,
355 // sh_entsize
356 0, 0, 0, 0,
358 // Offset 252
359 // Contents of .symtab section
360 // Symbol 0
361 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
363 // Offset 268
364 // Symbol 1
365 // st_name
366 1, 0, 0, 0,
367 // st_value
368 0, 0, 0, 0,
369 // st_size
370 0, 0, 0, 0,
371 // st_info: STT_NOTYPE, STB_GLOBAL
372 0x10,
373 // st_other
375 // st_shndx: In .test
376 1, 0,
378 // Offset 284
379 // Contents of .strtab section
380 '\0',
381 't', 'e', 's', 't', '\0',
383 // Offset 290
384 // Contents of .shstrtab section
385 '\0',
386 '.', 't', 'e', 's', 't', '\0',
387 '.', 's', 'y', 'm', 't', 'a', 'b', '\0',
388 '.', 's', 't', 'r', 't', 'a', 'b', '\0',
389 '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0'
392 const unsigned int test_file_1_size_32_little = sizeof test_file_1_32_little;
394 // 32-bit big-endian version of test_file_1_32_little.
396 const unsigned char test_file_1_32_big[] =
398 // Ehdr
399 // EI_MAG[0-3]
400 0x7f, 'E', 'L', 'F',
401 // EI_CLASS: 32 bit.
403 // EI_DATA: big endian
405 // EI_VERSION
407 // EI_OSABI
409 // EI_ABIVERSION
411 // EI_PAD
412 0, 0, 0, 0, 0, 0, 0,
413 // e_type: ET_REL
414 0, 1,
415 // e_machine: a magic value used for testing.
416 0xff, 0xff,
417 // e_version
418 0, 0, 0, 1,
419 // e_entry
420 0, 0, 0, 0,
421 // e_phoff
422 0, 0, 0, 0,
423 // e_shoff: starts right after file header
424 0, 0, 0, 52,
425 // e_flags
426 0, 0, 0, 0,
427 // e_ehsize
428 0, 52,
429 // e_phentsize
430 0, 32,
431 // e_phnum
432 0, 0,
433 // e_shentsize
434 0, 40,
435 // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab
436 0, 5,
437 // e_shstrndx
438 0, 4,
440 // Offset 52
441 // Shdr 0: dummy entry
442 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
443 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
444 0, 0, 0, 0, 0, 0, 0, 0,
446 // Offset 92
447 // Shdr 1: .test
448 // sh_name: after initial null
449 0, 0, 0, 1,
450 // sh_type: SHT_PROGBITS
451 0, 0, 0, 1,
452 // sh_flags: SHF_ALLOC
453 0, 0, 0, 2,
454 // sh_addr
455 0, 0, 0, 0,
456 // sh_offset: after file header + 5 section headers
457 0, 0, 0, 252,
458 // sh_size
459 0, 0, 0, 0,
460 // sh_link
461 0, 0, 0, 0,
462 // sh_info
463 0, 0, 0, 0,
464 // sh_addralign
465 0, 0, 0, 1,
466 // sh_entsize
467 0, 0, 0, 0,
469 // Offset 132
470 // Shdr 2: .symtab
471 // sh_name: 1 null byte + ".test\0"
472 0, 0, 0, 7,
473 // sh_type: SHT_SYMTAB
474 0, 0, 0, 2,
475 // sh_flags
476 0, 0, 0, 0,
477 // sh_addr
478 0, 0, 0, 0,
479 // sh_offset: after file header + 5 section headers + empty section
480 0, 0, 0, 252,
481 // sh_size: two symbols: dummy symbol + test symbol
482 0, 0, 0, 32,
483 // sh_link: to .strtab
484 0, 0, 0, 3,
485 // sh_info: one local symbol, the dummy symbol
486 0, 0, 0, 1,
487 // sh_addralign
488 0, 0, 0, 4,
489 // sh_entsize: size of symbol
490 0, 0, 0, 16,
492 // Offset 172
493 // Shdr 3: .strtab
494 // sh_name: 1 null byte + ".test\0" + ".symtab\0"
495 0, 0, 0, 15,
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 .symtab section. 284 == 0x11c
503 0, 0, 0x1, 0x1c,
504 // sh_size: 1 null byte + "test\0"
505 0, 0, 0, 6,
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,
515 // Offset 212
516 // Shdr 4: .shstrtab
517 // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0"
518 0, 0, 0, 23,
519 // sh_type: SHT_STRTAB
520 0, 0, 0, 3,
521 // sh_flags
522 0, 0, 0, 0,
523 // sh_addr
524 0, 0, 0, 0,
525 // sh_offset: after .strtab section. 290 == 0x122
526 0, 0, 0x1, 0x22,
527 // sh_size: all section names
528 0, 0, 0, 33,
529 // sh_link
530 0, 0, 0, 0,
531 // sh_info
532 0, 0, 0, 0,
533 // sh_addralign
534 0, 0, 0, 1,
535 // sh_entsize
536 0, 0, 0, 0,
538 // Offset 252
539 // Contents of .symtab section
540 // Symbol 0
541 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
543 // Offset 268
544 // Symbol 1
545 // st_name
546 0, 0, 0, 1,
547 // st_value
548 0, 0, 0, 0,
549 // st_size
550 0, 0, 0, 0,
551 // st_info: STT_NOTYPE, STB_GLOBAL
552 0x10,
553 // st_other
555 // st_shndx: In .test
556 0, 1,
558 // Offset 284
559 // Contents of .strtab section
560 '\0',
561 't', 'e', 's', 't', '\0',
563 // Offset 290
564 // Contents of .shstrtab section
565 '\0',
566 '.', 't', 'e', 's', 't', '\0',
567 '.', 's', 'y', 'm', 't', 'a', 'b', '\0',
568 '.', 's', 't', 'r', 't', 'a', 'b', '\0',
569 '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0'
572 const unsigned int test_file_1_size_32_big = sizeof test_file_1_32_big;
574 // 64-bit little-endian version of test_file_1_32_little.
576 const unsigned char test_file_1_64_little[] =
578 // Ehdr
579 // EI_MAG[0-3]
580 0x7f, 'E', 'L', 'F',
581 // EI_CLASS: 64 bit.
583 // EI_DATA: little endian
585 // EI_VERSION
587 // EI_OSABI
589 // EI_ABIVERSION
591 // EI_PAD
592 0, 0, 0, 0, 0, 0, 0,
593 // e_type: ET_REL
594 1, 0,
595 // e_machine: a magic value used for testing.
596 0xff, 0xff,
597 // e_version
598 1, 0, 0, 0,
599 // e_entry
600 0, 0, 0, 0, 0, 0, 0, 0,
601 // e_phoff
602 0, 0, 0, 0, 0, 0, 0, 0,
603 // e_shoff: starts right after file header
604 64, 0, 0, 0, 0, 0, 0, 0,
605 // e_flags
606 0, 0, 0, 0,
607 // e_ehsize
608 64, 0,
609 // e_phentsize
610 56, 0,
611 // e_phnum
612 0, 0,
613 // e_shentsize
614 64, 0,
615 // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab
616 5, 0,
617 // e_shstrndx
618 4, 0,
620 // Offset 64
621 // Shdr 0: dummy entry
622 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
623 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
624 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
625 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
627 // Offset 128
628 // Shdr 1: .test
629 // sh_name: after initial null
630 1, 0, 0, 0,
631 // sh_type: SHT_PROGBITS
632 1, 0, 0, 0,
633 // sh_flags: SHF_ALLOC
634 2, 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. 384 == 0x180.
638 0x80, 0x1, 0, 0, 0, 0, 0, 0,
639 // sh_size
640 0, 0, 0, 0, 0, 0, 0, 0,
641 // sh_link
642 0, 0, 0, 0,
643 // sh_info
644 0, 0, 0, 0,
645 // sh_addralign
646 1, 0, 0, 0, 0, 0, 0, 0,
647 // sh_entsize
648 0, 0, 0, 0, 0, 0, 0, 0,
650 // Offset 192
651 // Shdr 2: .symtab
652 // sh_name: 1 null byte + ".test\0"
653 7, 0, 0, 0,
654 // sh_type: SHT_SYMTAB
655 2, 0, 0, 0,
656 // sh_flags
657 0, 0, 0, 0, 0, 0, 0, 0,
658 // sh_addr
659 0, 0, 0, 0, 0, 0, 0, 0,
660 // sh_offset: after file header + 5 section headers + empty section
661 // 384 == 0x180.
662 0x80, 0x1, 0, 0, 0, 0, 0, 0,
663 // sh_size: two symbols: dummy symbol + test symbol
664 48, 0, 0, 0, 0, 0, 0, 0,
665 // sh_link: to .strtab
666 3, 0, 0, 0,
667 // sh_info: one local symbol, the dummy symbol
668 1, 0, 0, 0,
669 // sh_addralign
670 8, 0, 0, 0, 0, 0, 0, 0,
671 // sh_entsize: size of symbol
672 24, 0, 0, 0, 0, 0, 0, 0,
674 // Offset 256
675 // Shdr 3: .strtab
676 // sh_name: 1 null byte + ".test\0" + ".symtab\0"
677 15, 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 .symtab section. 432 == 0x1b0
685 0xb0, 0x1, 0, 0, 0, 0, 0, 0,
686 // sh_size: 1 null byte + "test\0"
687 6, 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,
697 // Offset 320
698 // Shdr 4: .shstrtab
699 // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0"
700 23, 0, 0, 0,
701 // sh_type: SHT_STRTAB
702 3, 0, 0, 0,
703 // sh_flags
704 0, 0, 0, 0, 0, 0, 0, 0,
705 // sh_addr
706 0, 0, 0, 0, 0, 0, 0, 0,
707 // sh_offset: after .strtab section. 438 == 0x1b6
708 0xb6, 0x1, 0, 0, 0, 0, 0, 0,
709 // sh_size: all section names
710 33, 0, 0, 0, 0, 0, 0, 0,
711 // sh_link
712 0, 0, 0, 0,
713 // sh_info
714 0, 0, 0, 0,
715 // sh_addralign
716 1, 0, 0, 0, 0, 0, 0, 0,
717 // sh_entsize
718 0, 0, 0, 0, 0, 0, 0, 0,
720 // Offset 384
721 // Contents of .symtab section
722 // Symbol 0
723 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
724 0, 0, 0, 0, 0, 0, 0, 0,
726 // Offset 408
727 // Symbol 1
728 // st_name
729 1, 0, 0, 0,
730 // st_info: STT_NOTYPE, STB_GLOBAL
731 0x10,
732 // st_other
734 // st_shndx: In .test
735 1, 0,
736 // st_value
737 0, 0, 0, 0, 0, 0, 0, 0,
738 // st_size
739 0, 0, 0, 0, 0, 0, 0, 0,
741 // Offset 432
742 // Contents of .strtab section
743 '\0',
744 't', 'e', 's', 't', '\0',
746 // Offset 438
747 // Contents of .shstrtab section
748 '\0',
749 '.', 't', 'e', 's', 't', '\0',
750 '.', 's', 'y', 'm', 't', 'a', 'b', '\0',
751 '.', 's', 't', 'r', 't', 'a', 'b', '\0',
752 '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0'
755 const unsigned int test_file_1_size_64_little = sizeof test_file_1_64_little;
757 // 64-bit big-endian version of test_file_1_32_little.
759 const unsigned char test_file_1_64_big[] =
761 // Ehdr
762 // EI_MAG[0-3]
763 0x7f, 'E', 'L', 'F',
764 // EI_CLASS: 64 bit.
766 // EI_DATA: big endian
768 // EI_VERSION
770 // EI_OSABI
772 // EI_ABIVERSION
774 // EI_PAD
775 0, 0, 0, 0, 0, 0, 0,
776 // e_type: ET_REL
777 0, 1,
778 // e_machine: a magic value used for testing.
779 0xff, 0xff,
780 // e_version
781 0, 0, 0, 1,
782 // e_entry
783 0, 0, 0, 0, 0, 0, 0, 0,
784 // e_phoff
785 0, 0, 0, 0, 0, 0, 0, 0,
786 // e_shoff: starts right after file header
787 0, 0, 0, 0, 0, 0, 0, 64,
788 // e_flags
789 0, 0, 0, 0,
790 // e_ehsize
791 0, 64,
792 // e_phentsize
793 0, 56,
794 // e_phnum
795 0, 0,
796 // e_shentsize
797 0, 64,
798 // e_shnum: dummy, .test, .symtab, .strtab, .shstrtab
799 0, 5,
800 // e_shstrndx
801 0, 4,
803 // Offset 64
804 // Shdr 0: dummy entry
805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
808 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
810 // Offset 128
811 // Shdr 1: .test
812 // sh_name: after initial null
813 0, 0, 0, 1,
814 // sh_type: SHT_PROGBITS
815 0, 0, 0, 1,
816 // sh_flags: SHF_ALLOC
817 0, 0, 0, 0, 0, 0, 0, 2,
818 // sh_addr
819 0, 0, 0, 0, 0, 0, 0, 0,
820 // sh_offset: after file header + 5 section headers. 384 == 0x180.
821 0, 0, 0, 0, 0, 0, 0x1, 0x80,
822 // sh_size
823 0, 0, 0, 0, 0, 0, 0, 0,
824 // sh_link
825 0, 0, 0, 0,
826 // sh_info
827 0, 0, 0, 0,
828 // sh_addralign
829 0, 0, 0, 0, 0, 0, 0, 1,
830 // sh_entsize
831 0, 0, 0, 0, 0, 0, 0, 0,
833 // Offset 192
834 // Shdr 2: .symtab
835 // sh_name: 1 null byte + ".test\0"
836 0, 0, 0, 7,
837 // sh_type: SHT_SYMTAB
838 0, 0, 0, 2,
839 // sh_flags
840 0, 0, 0, 0, 0, 0, 0, 0,
841 // sh_addr
842 0, 0, 0, 0, 0, 0, 0, 0,
843 // sh_offset: after file header + 5 section headers + empty section
844 // 384 == 0x180.
845 0, 0, 0, 0, 0, 0, 0x1, 0x80,
846 // sh_size: two symbols: dummy symbol + test symbol
847 0, 0, 0, 0, 0, 0, 0, 48,
848 // sh_link: to .strtab
849 0, 0, 0, 3,
850 // sh_info: one local symbol, the dummy symbol
851 0, 0, 0, 1,
852 // sh_addralign
853 0, 0, 0, 0, 0, 0, 0, 8,
854 // sh_entsize: size of symbol
855 0, 0, 0, 0, 0, 0, 0, 24,
857 // Offset 256
858 // Shdr 3: .strtab
859 // sh_name: 1 null byte + ".test\0" + ".symtab\0"
860 0, 0, 0, 15,
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 .symtab section. 432 == 0x1b0
868 0, 0, 0, 0, 0, 0, 0x1, 0xb0,
869 // sh_size: 1 null byte + "test\0"
870 0, 0, 0, 0, 0, 0, 0, 6,
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,
880 // Offset 320
881 // Shdr 4: .shstrtab
882 // sh_name: 1 null byte + ".test\0" + ".symtab\0" + ".strtab\0"
883 0, 0, 0, 23,
884 // sh_type: SHT_STRTAB
885 0, 0, 0, 3,
886 // sh_flags
887 0, 0, 0, 0, 0, 0, 0, 0,
888 // sh_addr
889 0, 0, 0, 0, 0, 0, 0, 0,
890 // sh_offset: after .strtab section. 438 == 0x1b6
891 0, 0, 0, 0, 0, 0, 0x1, 0xb6,
892 // sh_size: all section names
893 0, 0, 0, 0, 0, 0, 0, 33,
894 // sh_link
895 0, 0, 0, 0,
896 // sh_info
897 0, 0, 0, 0,
898 // sh_addralign
899 0, 0, 0, 0, 0, 0, 0, 1,
900 // sh_entsize
901 0, 0, 0, 0, 0, 0, 0, 0,
903 // Offset 384
904 // Contents of .symtab section
905 // Symbol 0
906 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
907 0, 0, 0, 0, 0, 0, 0, 0,
909 // Offset 408
910 // Symbol 1
911 // st_name
912 0, 0, 0, 1,
913 // st_info: STT_NOTYPE, STB_GLOBAL
914 0x10,
915 // st_other
917 // st_shndx: In .test
918 0, 1,
919 // st_value
920 0, 0, 0, 0, 0, 0, 0, 0,
921 // st_size
922 0, 0, 0, 0, 0, 0, 0, 0,
924 // Offset 432
925 // Contents of .strtab section
926 '\0',
927 't', 'e', 's', 't', '\0',
929 // Offset 438
930 // Contents of .shstrtab section
931 '\0',
932 '.', 't', 'e', 's', 't', '\0',
933 '.', 's', 'y', 'm', 't', 'a', 'b', '\0',
934 '.', 's', 't', 'r', 't', 'a', 'b', '\0',
935 '.', 's', 'h', 's', 't', 'r', 't', 'a', 'b', '\0'
938 const unsigned int test_file_1_size_64_big = sizeof test_file_1_64_big;
940 } // End namespace gold_testsuite.