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