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));
186 #define irix_core_openr_next_archived_file bfd_generic_openr_next_archived_file
187 #define irix_core_generic_stat_arch_elt bfd_generic_stat_arch_elt
188 #define irix_core_slurp_armap bfd_false
189 #define irix_core_slurp_extended_name_table bfd_true
190 #define irix_core_write_armap (boolean (*) PARAMS \
191 ((bfd *arch, unsigned int elength, struct orl *map, \
192 unsigned int orl_count, int stridx))) bfd_false
193 #define irix_core_truncate_arname bfd_dont_truncate_arname
195 #define irix_core_close_and_cleanup bfd_generic_close_and_cleanup
196 #define irix_core_set_section_contents (boolean (*) PARAMS \
197 ((bfd *abfd, asection *section, PTR data, file_ptr offset, \
198 bfd_size_type count))) bfd_generic_set_section_contents
199 #define irix_core_get_section_contents bfd_generic_get_section_contents
200 #define irix_core_new_section_hook (boolean (*) PARAMS \
201 ((bfd *, sec_ptr))) bfd_true
202 #define irix_core_get_symtab_upper_bound bfd_0l
203 #define irix_core_get_symtab (long (*) PARAMS \
204 ((bfd *, struct symbol_cache_entry **))) bfd_0l
205 #define irix_core_get_reloc_upper_bound (long (*) PARAMS \
206 ((bfd *, sec_ptr))) bfd_0l
207 #define irix_core_canonicalize_reloc (long (*) PARAMS \
208 ((bfd *, sec_ptr, arelent **, struct symbol_cache_entry**))) bfd_0l
209 #define irix_core_print_symbol (void (*) PARAMS \
210 ((bfd *, PTR, struct symbol_cache_entry *, \
211 bfd_print_symbol_type))) bfd_false
212 #define irix_core_get_symbol_info (void (*) PARAMS \
213 ((bfd *, struct symbol_cache_entry *, \
214 symbol_info *))) bfd_false
215 #define irix_core_get_lineno (alent * (*) PARAMS \
216 ((bfd *, struct symbol_cache_entry *))) bfd_nullvoidptr
217 #define irix_core_set_arch_mach (boolean (*) PARAMS \
218 ((bfd *, enum bfd_architecture, unsigned long))) bfd_false
219 #define irix_core_find_nearest_line (boolean (*) PARAMS \
220 ((bfd *abfd, struct sec *section, \
221 struct symbol_cache_entry **symbols,bfd_vma offset, \
222 CONST char **file, CONST char **func, unsigned int *line))) bfd_false
223 #define irix_core_sizeof_headers (int (*) PARAMS \
224 ((bfd *, boolean))) bfd_0
226 #define irix_core_bfd_debug_info_start bfd_void
227 #define irix_core_bfd_debug_info_end bfd_void
228 #define irix_core_bfd_debug_info_accumulate (void (*) PARAMS \
229 ((bfd *, struct sec *))) bfd_void
230 #define irix_core_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
231 #define irix_core_bfd_relax_section bfd_generic_relax_section
232 #define irix_core_bfd_reloc_type_lookup \
233 ((CONST struct reloc_howto_struct *(*) PARAMS ((bfd *, bfd_reloc_code_real_type))) bfd_nullvoidptr)
234 #define irix_core_bfd_make_debug_symbol \
235 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
236 #define irix_core_bfd_link_hash_table_create \
237 ((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
238 #define irix_core_bfd_link_add_symbols \
239 ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
240 #define irix_core_bfd_final_link \
241 ((boolean (*) PARAMS ((bfd *, struct bfd_link_info *))) bfd_false)
243 #define irix_core_bfd_copy_private_section_data \
244 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_false)
245 #define irix_core_bfd_copy_private_bfd_data \
246 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_false)
247 #define irix_core_bfd_is_local_label \
248 ((boolean (*) PARAMS ((bfd *, asymbol *))) bfd_false)
249 #define irix_core_bfd_free_cached_info bfd_true
251 /* If somebody calls any byte-swapping routines, shoot them. */
255 abort(); /* This way doesn't require any declaration for ANSI to fuck up */
257 #define NO_GET ((bfd_vma (*) PARAMS (( const bfd_byte *))) swap_abort )
258 #define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
259 #define NO_SIGNED_GET \
260 ((bfd_signed_vma (*) PARAMS ((const bfd_byte *))) swap_abort )
262 bfd_target irix_core_vec =
265 bfd_target_unknown_flavour,
266 true, /* target byte order */
267 true, /* target headers byte order */
268 (HAS_RELOC | EXEC_P | /* object flags */
269 HAS_LINENO | HAS_DEBUG |
270 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
271 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
272 0, /* symbol prefix */
273 ' ', /* ar_pad_char */
274 16, /* ar_max_namelen */
275 3, /* minimum alignment power */
276 NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
277 NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
278 NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
279 NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
280 NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
281 NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
283 { /* bfd_check_format */
284 _bfd_dummy_target, /* unknown format */
285 _bfd_dummy_target, /* object file */
286 _bfd_dummy_target, /* archive */
287 irix_core_core_file_p /* a core file */
289 { /* bfd_set_format */
290 bfd_false, bfd_false,
293 { /* bfd_write_contents */
294 bfd_false, bfd_false,
298 JUMP_TABLE(irix_core),
299 (PTR) 0 /* backend_data */
302 #endif /* IRIX_CORE */