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