1 /* BFD back-end for Irix core files.
2 Copyright 1993 Free Software Foundation, Inc.
3 Written by Stu Grossman, Cygnus Support.
4 Converted to back-end form by Ian Lance Taylor, Cygnus Support
6 This file is part of BFD, the Binary File Descriptor library.
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 2 of the License, or
11 (at your option) any later version.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
22 /* This file can only be compiled on systems which use Irix style core
23 files (namely, Irix 4 and Irix 5, so far). In the config/XXXXXX.mh
24 file for such a system add
37 struct sgi_core_struct
40 char cmd
[CORE_NAMESIZE
];
43 #define core_hdr(bfd) ((bfd)->tdata.sgi_core_data)
44 #define core_signal(bfd) (core_hdr(bfd)->sig)
45 #define core_command(bfd) (core_hdr(bfd)->cmd)
48 make_bfd_asection (abfd
, name
, flags
, _raw_size
, vma
, filepos
)
52 bfd_size_type _raw_size
;
58 asect
= bfd_make_section_anyway (abfd
, name
);
63 asect
->_raw_size
= _raw_size
;
65 asect
->filepos
= filepos
;
66 asect
->alignment_power
= 4;
72 irix_core_core_file_p (abfd
)
78 struct coreout coreout
;
79 struct idesc
*idg
, *idf
, *ids
;
81 val
= bfd_read ((PTR
)&coreout
, 1, sizeof coreout
, abfd
);
82 if (val
!= sizeof coreout
)
85 if (coreout
.c_magic
!= CORE_MAGIC
86 || coreout
.c_version
!= CORE_VERSION1
)
89 core_hdr (abfd
) = (struct sgi_core_struct
*) bfd_zalloc (abfd
, sizeof (struct sgi_core_struct
));
93 strncpy (core_command (abfd
), coreout
.c_name
, CORE_NAMESIZE
);
94 core_signal (abfd
) = coreout
.c_sigcause
;
96 bfd_seek (abfd
, coreout
.c_vmapoffset
, SEEK_SET
);
98 for (i
= 0; i
< coreout
.c_nvmap
; i
++)
102 val
= bfd_read ((PTR
)&vmap
, 1, sizeof vmap
, abfd
);
103 if (val
!= sizeof vmap
)
116 secname
= ".mapfile";
123 if (!make_bfd_asection (abfd
, secname
,
124 SEC_ALLOC
+SEC_LOAD
+SEC_HAS_CONTENTS
,
132 /* Make sure that the regs are contiguous within the core file. */
134 idg
= &coreout
.c_idesc
[I_GPREGS
];
135 idf
= &coreout
.c_idesc
[I_FPREGS
];
136 ids
= &coreout
.c_idesc
[I_SPECREGS
];
138 if (idg
->i_offset
+ idg
->i_len
!= idf
->i_offset
139 || idf
->i_offset
+ idf
->i_len
!= ids
->i_offset
)
140 return 0; /* Can't deal with non-contig regs */
142 bfd_seek (abfd
, idg
->i_offset
, SEEK_SET
);
144 make_bfd_asection (abfd
, ".reg",
145 SEC_ALLOC
+SEC_HAS_CONTENTS
,
146 idg
->i_len
+ idf
->i_len
+ ids
->i_len
,
150 /* OK, we believe you. You're a core file (sure, sure). */
156 irix_core_core_file_failing_command (abfd
)
159 return core_command (abfd
);
163 irix_core_core_file_failing_signal (abfd
)
166 return core_signal (abfd
);
170 irix_core_core_file_matches_executable_p (core_bfd
, exec_bfd
)
171 bfd
*core_bfd
, *exec_bfd
;
173 return true; /* XXX - FIXME */
177 irix_core_make_empty_symbol (abfd
)
180 asymbol
*new = (asymbol
*) bfd_zalloc (abfd
, sizeof (asymbol
));
185 #define irix_core_openr_next_archived_file bfd_generic_openr_next_archived_file
186 #define irix_core_generic_stat_arch_elt bfd_generic_stat_arch_elt
187 #define irix_core_slurp_armap bfd_false
188 #define irix_core_slurp_extended_name_table bfd_true
189 #define irix_core_write_armap (boolean (*) PARAMS \
190 ((bfd *arch, unsigned int elength, struct orl *map, \
191 unsigned int orl_count, int stridx))) bfd_false
192 #define irix_core_truncate_arname bfd_dont_truncate_arname
194 #define irix_core_close_and_cleanup bfd_generic_close_and_cleanup
195 #define irix_core_set_section_contents (boolean (*) PARAMS \
196 ((bfd *abfd, asection *section, PTR data, file_ptr offset, \
197 bfd_size_type count))) bfd_false
198 #define irix_core_get_section_contents bfd_generic_get_section_contents
199 #define irix_core_new_section_hook (boolean (*) PARAMS \
200 ((bfd *, sec_ptr))) bfd_true
201 #define irix_core_get_symtab_upper_bound bfd_0u
202 #define irix_core_get_symtab (unsigned int (*) PARAMS \
203 ((bfd *, struct symbol_cache_entry **))) bfd_0u
204 #define irix_core_get_reloc_upper_bound (unsigned int (*) PARAMS \
205 ((bfd *, sec_ptr))) bfd_0u
206 #define irix_core_canonicalize_reloc (unsigned int (*) PARAMS \
207 ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0u
208 #define irix_core_print_symbol (void (*) PARAMS \
209 ((bfd *, PTR, struct symbol_cache_entry *, \
210 bfd_print_symbol_type))) bfd_false
211 #define irix_core_get_symbol_info (void (*) PARAMS \
212 ((bfd *, struct symbol_cache_entry *, \
213 symbol_info *))) bfd_false
214 #define irix_core_get_lineno (alent * (*) PARAMS \
215 ((bfd *, struct symbol_cache_entry *))) bfd_nullvoidptr
216 #define irix_core_set_arch_mach (boolean (*) PARAMS \
217 ((bfd *, enum bfd_architecture, unsigned long))) bfd_false
218 #define irix_core_find_nearest_line (boolean (*) PARAMS \
219 ((bfd *abfd, struct sec *section, \
220 struct symbol_cache_entry **symbols,bfd_vma offset, \
221 CONST char **file, CONST char **func, unsigned int *line))) bfd_false
222 #define irix_core_sizeof_headers (int (*) PARAMS \
223 ((bfd *, boolean))) bfd_0
225 #define irix_core_bfd_debug_info_start bfd_void
226 #define irix_core_bfd_debug_info_end bfd_void
227 #define irix_core_bfd_debug_info_accumulate (void (*) PARAMS \
228 ((bfd *, struct sec *))) bfd_void
229 #define irix_core_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
230 #define irix_core_bfd_relax_section bfd_generic_relax_section
231 #define irix_core_bfd_reloc_type_lookup \
232 ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
233 #define irix_core_bfd_make_debug_symbol \
234 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
235 #define irix_core_bfd_link_hash_table_create \
236 ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
237 #define irix_core_bfd_link_add_symbols \
238 ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
239 #define irix_core_bfd_final_link \
240 ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
242 /* If somebody calls any byte-swapping routines, shoot them. */
246 abort(); /* This way doesn't require any declaration for ANSI to fuck up */
248 #define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
249 #define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
250 #define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
252 bfd_target irix_core_vec
=
255 bfd_target_unknown_flavour
,
256 true, /* target byte order */
257 true, /* target headers byte order */
258 (HAS_RELOC
| EXEC_P
| /* object flags */
259 HAS_LINENO
| HAS_DEBUG
|
260 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
261 (SEC_HAS_CONTENTS
| SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
262 0, /* symbol prefix */
263 ' ', /* ar_pad_char */
264 16, /* ar_max_namelen */
265 3, /* minimum alignment power */
266 NO_GET
, NO_SIGNED_GET
, NO_PUT
, /* 64 bit data */
267 NO_GET
, NO_SIGNED_GET
, NO_PUT
, /* 32 bit data */
268 NO_GET
, NO_SIGNED_GET
, NO_PUT
, /* 16 bit data */
269 NO_GET
, NO_SIGNED_GET
, NO_PUT
, /* 64 bit hdrs */
270 NO_GET
, NO_SIGNED_GET
, NO_PUT
, /* 32 bit hdrs */
271 NO_GET
, NO_SIGNED_GET
, NO_PUT
, /* 16 bit hdrs */
273 { /* bfd_check_format */
274 _bfd_dummy_target
, /* unknown format */
275 _bfd_dummy_target
, /* object file */
276 _bfd_dummy_target
, /* archive */
277 irix_core_core_file_p
/* a core file */
279 { /* bfd_set_format */
280 bfd_false
, bfd_false
,
283 { /* bfd_write_contents */
284 bfd_false
, bfd_false
,
288 JUMP_TABLE(irix_core
),
289 (PTR
) 0 /* backend_data */
292 #endif /* IRIX_CORE */