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