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