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