OLD | NEW |
1 /* BFD back end for SCO5 core files (U-area and raw sections) | 1 /* BFD back end for SCO5 core files (U-area and raw sections) |
2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, | 2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
3 2010, 2011 | 3 2010, 2011, 2012 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 Written by Jouke Numan <jnuman@hiscom.nl> | 5 Written by Jouke Numan <jnuman@hiscom.nl> |
6 | 6 |
7 This file is part of BFD, the Binary File Descriptor library. | 7 This file is part of BFD, the Binary File Descriptor library. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
12 (at your option) any later version. | 12 (at your option) any later version. |
13 | 13 |
(...skipping 24 matching lines...) Expand all Loading... |
38 #include <sys/region.h> | 38 #include <sys/region.h> |
39 #endif | 39 #endif |
40 | 40 |
41 struct sco5_core_struct | 41 struct sco5_core_struct |
42 { | 42 { |
43 struct user u; | 43 struct user u; |
44 }; | 44 }; |
45 | 45 |
46 /* forward declarations */ | 46 /* forward declarations */ |
47 | 47 |
48 static asection *make_bfd_asection | |
49 PARAMS ((bfd *, const char *, flagword, bfd_size_type, bfd_vma, file_ptr)); | |
50 static struct user *read_uarea PARAMS ((bfd *, int)); | |
51 const bfd_target *sco5_core_file_p PARAMS ((bfd *abfd)); | |
52 char *sco5_core_file_failing_command PARAMS ((bfd *abfd)); | |
53 int sco5_core_file_failing_signal PARAMS ((bfd *abfd)); | |
54 #define sco5_core_file_matches_executable_p generic_core_file_matches_executable
_p | 48 #define sco5_core_file_matches_executable_p generic_core_file_matches_executable
_p |
55 #define sco5_core_file_pid _bfd_nocore_core_file_pid | 49 #define sco5_core_file_pid _bfd_nocore_core_file_pid |
56 static void swap_abort PARAMS ((void)); | |
57 | 50 |
58 static asection * | 51 static asection * |
59 make_bfd_asection (abfd, name, flags, size, vma, filepos) | 52 make_bfd_asection (bfd *abfd, |
60 bfd *abfd; | 53 » » const char *name, |
61 const char *name; | 54 » » flagword flags, |
62 flagword flags; | 55 » » bfd_size_type size, |
63 bfd_size_type size; | 56 » » bfd_vma vma, |
64 bfd_vma vma; | 57 » » file_ptr filepos) |
65 file_ptr filepos; | |
66 { | 58 { |
67 asection *asect; | 59 asection *asect; |
68 | 60 |
69 asect = bfd_make_section_anyway_with_flags (abfd, name, flags); | 61 asect = bfd_make_section_anyway_with_flags (abfd, name, flags); |
70 if (!asect) | 62 if (!asect) |
71 return NULL; | 63 return NULL; |
72 asect->size = size; | 64 asect->size = size; |
73 asect->vma = vma; | 65 asect->vma = vma; |
74 asect->filepos = filepos; | 66 asect->filepos = filepos; |
75 asect->alignment_power = 2; | 67 asect->alignment_power = 2; |
76 | 68 |
77 return asect; | 69 return asect; |
78 } | 70 } |
79 | 71 |
80 static struct user * | 72 static struct user * |
81 read_uarea(abfd, filepos) | 73 read_uarea (bfd *abfd, int filepos) |
82 bfd *abfd; | |
83 int filepos; | |
84 | |
85 { | 74 { |
86 struct sco5_core_struct *rawptr; | 75 struct sco5_core_struct *rawptr; |
87 bfd_size_type amt = sizeof (struct sco5_core_struct); | 76 bfd_size_type amt = sizeof (struct sco5_core_struct); |
88 | 77 |
89 rawptr = (struct sco5_core_struct *) bfd_zmalloc (amt); | 78 rawptr = (struct sco5_core_struct *) bfd_zmalloc (amt); |
90 if (rawptr == NULL) | 79 if (rawptr == NULL) |
91 return NULL; | 80 return NULL; |
92 | 81 |
93 abfd->tdata.sco5_core_data = rawptr; | 82 abfd->tdata.sco5_core_data = rawptr; |
94 | 83 |
(...skipping 13 matching lines...) Expand all Loading... |
108 } | 97 } |
109 if (rawptr->u.u_ssize > 0x1000000) | 98 if (rawptr->u.u_ssize > 0x1000000) |
110 { | 99 { |
111 bfd_set_error (bfd_error_wrong_format); | 100 bfd_set_error (bfd_error_wrong_format); |
112 return NULL; | 101 return NULL; |
113 } | 102 } |
114 return &rawptr->u; | 103 return &rawptr->u; |
115 } | 104 } |
116 | 105 |
117 const bfd_target * | 106 const bfd_target * |
118 sco5_core_file_p (abfd) | 107 sco5_core_file_p (bfd *abfd) |
119 bfd *abfd; | |
120 { | 108 { |
121 int coffset_siz, val, nsecs, cheadoffs; | 109 int coffset_siz, val, nsecs, cheadoffs; |
122 int coresize; | 110 int coresize; |
123 struct user *u; | 111 struct user *u; |
124 struct coreoffsets coffsets; | 112 struct coreoffsets coffsets; |
125 struct coresecthead chead; | 113 struct coresecthead chead; |
126 char *secname; | 114 char *secname; |
127 flagword flags; | 115 flagword flags; |
128 | 116 |
129 /* Read coreoffsets region at end of core (see core(FP)). */ | 117 /* Read coreoffsets region at end of core (see core(FP)). */ |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 if (abfd->tdata.any) | 308 if (abfd->tdata.any) |
321 { | 309 { |
322 bfd_release (abfd, abfd->tdata.any); | 310 bfd_release (abfd, abfd->tdata.any); |
323 abfd->tdata.any = NULL; | 311 abfd->tdata.any = NULL; |
324 } | 312 } |
325 bfd_section_list_clear (abfd); | 313 bfd_section_list_clear (abfd); |
326 return NULL; | 314 return NULL; |
327 } | 315 } |
328 | 316 |
329 char * | 317 char * |
330 sco5_core_file_failing_command (abfd) | 318 sco5_core_file_failing_command (bfd *abfd) |
331 bfd *abfd; | |
332 { | 319 { |
333 char *com = abfd->tdata.sco5_core_data->u.u_comm; | 320 char *com = abfd->tdata.sco5_core_data->u.u_comm; |
334 if (*com) | 321 if (*com) |
335 return com; | 322 return com; |
336 else | 323 else |
337 return NULL; | 324 return NULL; |
338 } | 325 } |
339 | 326 |
340 int | 327 int |
341 sco5_core_file_failing_signal (ignore_abfd) | 328 sco5_core_file_failing_signal (bfd *ignore_abfd) |
342 bfd *ignore_abfd; | |
343 { | 329 { |
344 return ((ignore_abfd->tdata.sco5_core_data->u.u_sysabort != 0) | 330 return ((ignore_abfd->tdata.sco5_core_data->u.u_sysabort != 0) |
345 ? ignore_abfd->tdata.sco5_core_data->u.u_sysabort | 331 ? ignore_abfd->tdata.sco5_core_data->u.u_sysabort |
346 : -1); | 332 : -1); |
347 } | 333 } |
348 | 334 |
349 /* If somebody calls any byte-swapping routines, shoot them. */ | 335 /* If somebody calls any byte-swapping routines, shoot them. */ |
350 static void | 336 static void |
351 swap_abort () | 337 swap_abort (void) |
352 { | 338 { |
353 abort (); /* This way doesn't require any declaration for ANSI to fuck up */ | 339 abort (); /* This way doesn't require any declaration for ANSI to fuck up */ |
354 } | 340 } |
355 | 341 |
356 #define NO_GET ((bfd_vma (*) (const void *)) swap_abort) | 342 #define NO_GET ((bfd_vma (*) (const void *)) swap_abort) |
357 #define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) | 343 #define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort) |
358 #define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) | 344 #define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort) |
359 #define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) | 345 #define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort) |
360 #define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) | 346 #define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort) |
361 #define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) | 347 #define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 BFD_JUMP_TABLE_CORE (sco5), | 387 BFD_JUMP_TABLE_CORE (sco5), |
402 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), | 388 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), |
403 BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), | 389 BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols), |
404 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), | 390 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), |
405 BFD_JUMP_TABLE_WRITE (_bfd_generic), | 391 BFD_JUMP_TABLE_WRITE (_bfd_generic), |
406 BFD_JUMP_TABLE_LINK (_bfd_nolink), | 392 BFD_JUMP_TABLE_LINK (_bfd_nolink), |
407 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), | 393 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
408 | 394 |
409 NULL, | 395 NULL, |
410 | 396 |
411 (PTR) 0» » » /* backend_data */ | 397 NULL» » » /* backend_data */ |
412 }; | 398 }; |
OLD | NEW |