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