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