OSDN Git Service

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