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