xref: /openbsd-src/gnu/usr.bin/binutils-2.17/bfd/cisco-core.c (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* BFD back-end for CISCO crash dumps.
2*3d8817e4Smiod    Copyright 1994, 1997, 1999, 2000, 2001, 2002, 2004
3*3d8817e4Smiod    Free Software Foundation, Inc.
4*3d8817e4Smiod 
5*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library.
6*3d8817e4Smiod 
7*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
8*3d8817e4Smiod it under the terms of the GNU General Public License as published by
9*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or
10*3d8817e4Smiod (at your option) any later version.
11*3d8817e4Smiod 
12*3d8817e4Smiod This program is distributed in the hope that it will be useful,
13*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
14*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*3d8817e4Smiod GNU General Public License for more details.
16*3d8817e4Smiod 
17*3d8817e4Smiod You should have received a copy of the GNU General Public License
18*3d8817e4Smiod along with this program; if not, write to the Free Software
19*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20*3d8817e4Smiod 
21*3d8817e4Smiod #include "bfd.h"
22*3d8817e4Smiod #include "sysdep.h"
23*3d8817e4Smiod #include "libbfd.h"
24*3d8817e4Smiod /* core_file_failing_signal returns a host signal (this probably should
25*3d8817e4Smiod    be fixed).  */
26*3d8817e4Smiod #include <signal.h>
27*3d8817e4Smiod 
28*3d8817e4Smiod /* for MSVC builds */
29*3d8817e4Smiod #ifndef SIGTRAP
30*3d8817e4Smiod # define SIGTRAP 5
31*3d8817e4Smiod #endif
32*3d8817e4Smiod #ifndef SIGEMT
33*3d8817e4Smiod # define SIGEMT 6
34*3d8817e4Smiod #endif
35*3d8817e4Smiod #ifndef SIGBUS
36*3d8817e4Smiod # define SIGBUS 10
37*3d8817e4Smiod #endif
38*3d8817e4Smiod 
39*3d8817e4Smiod int crash_info_locs[] = {
40*3d8817e4Smiod   0x0250,	/* mips, ppc, x86, i960 */
41*3d8817e4Smiod   0x0400,	/* m68k, mips, x86, i960 */
42*3d8817e4Smiod   0x0FFC,	/* m68k, mips, ppc, x86, i960 */
43*3d8817e4Smiod   0x3000,	/* ppc */
44*3d8817e4Smiod   0x4FFC,	/* m68k */
45*3d8817e4Smiod   -1
46*3d8817e4Smiod };
47*3d8817e4Smiod 
48*3d8817e4Smiod #define CRASH_MAGIC	0xdead1234
49*3d8817e4Smiod #define MASK_ADDR(x)	((x) & 0x0fffffff)	/* Mask crash info address */
50*3d8817e4Smiod 
51*3d8817e4Smiod typedef enum {
52*3d8817e4Smiod     CRASH_REASON_NOTCRASHED = 0,
53*3d8817e4Smiod     CRASH_REASON_EXCEPTION = 1,
54*3d8817e4Smiod     CRASH_REASON_CORRUPT = 2,
55*3d8817e4Smiod } crashreason;
56*3d8817e4Smiod 
57*3d8817e4Smiod typedef struct {
58*3d8817e4Smiod   char magic[4];		/* Magic number */
59*3d8817e4Smiod   char version[4];		/* Version number */
60*3d8817e4Smiod   char reason[4];		/* Crash reason */
61*3d8817e4Smiod   char cpu_vector[4];		/* CPU vector for exceptions */
62*3d8817e4Smiod   char registers[4];		/* Pointer to saved registers */
63*3d8817e4Smiod   char rambase[4];		/* Base of RAM (not in V1 crash info) */
64*3d8817e4Smiod   char textbase[4];		/* Base of .text section (not in V3 crash info) */
65*3d8817e4Smiod   char database[4];		/* Base of .data section (not in V3 crash info) */
66*3d8817e4Smiod   char bssbase[4];		/* Base of .bss section (not in V3 crash info) */
67*3d8817e4Smiod } crashinfo_external;
68*3d8817e4Smiod 
69*3d8817e4Smiod struct cisco_core_struct
70*3d8817e4Smiod {
71*3d8817e4Smiod   int sig;
72*3d8817e4Smiod };
73*3d8817e4Smiod 
74*3d8817e4Smiod static const bfd_target *cisco_core_file_validate PARAMS ((bfd *, int));
75*3d8817e4Smiod static const bfd_target *cisco_core_file_p PARAMS ((bfd *));
76*3d8817e4Smiod char *cisco_core_file_failing_command PARAMS ((bfd *));
77*3d8817e4Smiod int cisco_core_file_failing_signal PARAMS ((bfd *));
78*3d8817e4Smiod #define cisco_core_file_matches_executable_p generic_core_file_matches_executable_p
79*3d8817e4Smiod 
80*3d8817e4Smiod /* Examine the file for a crash info struct at the offset given by
81*3d8817e4Smiod    CRASH_INFO_LOC.  */
82*3d8817e4Smiod 
83*3d8817e4Smiod static const bfd_target *
cisco_core_file_validate(abfd,crash_info_loc)84*3d8817e4Smiod cisco_core_file_validate (abfd, crash_info_loc)
85*3d8817e4Smiod      bfd *abfd;
86*3d8817e4Smiod      int crash_info_loc;
87*3d8817e4Smiod {
88*3d8817e4Smiod   char buf[4];
89*3d8817e4Smiod   unsigned int crashinfo_offset;
90*3d8817e4Smiod   crashinfo_external crashinfo;
91*3d8817e4Smiod   int nread;
92*3d8817e4Smiod   unsigned int magic;
93*3d8817e4Smiod   unsigned int version;
94*3d8817e4Smiod   unsigned int rambase;
95*3d8817e4Smiod   sec_ptr asect;
96*3d8817e4Smiod   struct stat statbuf;
97*3d8817e4Smiod   bfd_size_type amt;
98*3d8817e4Smiod 
99*3d8817e4Smiod   if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
100*3d8817e4Smiod     return NULL;
101*3d8817e4Smiod 
102*3d8817e4Smiod   nread = bfd_bread (buf, (bfd_size_type) 4, abfd);
103*3d8817e4Smiod   if (nread != 4)
104*3d8817e4Smiod     {
105*3d8817e4Smiod       if (bfd_get_error () != bfd_error_system_call)
106*3d8817e4Smiod 	bfd_set_error (bfd_error_wrong_format);
107*3d8817e4Smiod       return NULL;
108*3d8817e4Smiod     }
109*3d8817e4Smiod   crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf));
110*3d8817e4Smiod 
111*3d8817e4Smiod   if (bfd_seek (abfd, (file_ptr) crashinfo_offset, SEEK_SET) != 0)
112*3d8817e4Smiod     {
113*3d8817e4Smiod       /* Most likely we failed because of a bogus (huge) offset */
114*3d8817e4Smiod       bfd_set_error (bfd_error_wrong_format);
115*3d8817e4Smiod       return NULL;
116*3d8817e4Smiod     }
117*3d8817e4Smiod 
118*3d8817e4Smiod   nread = bfd_bread (&crashinfo, (bfd_size_type) sizeof (crashinfo), abfd);
119*3d8817e4Smiod   if (nread != sizeof (crashinfo))
120*3d8817e4Smiod     {
121*3d8817e4Smiod       if (bfd_get_error () != bfd_error_system_call)
122*3d8817e4Smiod 	bfd_set_error (bfd_error_wrong_format);
123*3d8817e4Smiod       return NULL;
124*3d8817e4Smiod     }
125*3d8817e4Smiod 
126*3d8817e4Smiod   if (bfd_stat (abfd, &statbuf) < 0)
127*3d8817e4Smiod     {
128*3d8817e4Smiod       bfd_set_error (bfd_error_system_call);
129*3d8817e4Smiod       return NULL;
130*3d8817e4Smiod     }
131*3d8817e4Smiod 
132*3d8817e4Smiod   magic = bfd_get_32 (abfd, crashinfo.magic);
133*3d8817e4Smiod   if (magic != CRASH_MAGIC)
134*3d8817e4Smiod     {
135*3d8817e4Smiod       bfd_set_error (bfd_error_wrong_format);
136*3d8817e4Smiod       return NULL;
137*3d8817e4Smiod     }
138*3d8817e4Smiod 
139*3d8817e4Smiod   version = bfd_get_32 (abfd, crashinfo.version);
140*3d8817e4Smiod   if (version == 0)
141*3d8817e4Smiod     {
142*3d8817e4Smiod       bfd_set_error (bfd_error_wrong_format);
143*3d8817e4Smiod       return NULL;
144*3d8817e4Smiod     }
145*3d8817e4Smiod   else if (version == 1)
146*3d8817e4Smiod     {
147*3d8817e4Smiod       /* V1 core dumps don't specify the dump base, assume 0 */
148*3d8817e4Smiod       rambase = 0;
149*3d8817e4Smiod     }
150*3d8817e4Smiod   else
151*3d8817e4Smiod     {
152*3d8817e4Smiod       rambase = bfd_get_32 (abfd, crashinfo.rambase);
153*3d8817e4Smiod     }
154*3d8817e4Smiod 
155*3d8817e4Smiod   /* OK, we believe you.  You're a core file.  */
156*3d8817e4Smiod 
157*3d8817e4Smiod   amt = sizeof (struct cisco_core_struct);
158*3d8817e4Smiod   abfd->tdata.cisco_core_data = (struct cisco_core_struct *) bfd_zmalloc (amt);
159*3d8817e4Smiod   if (abfd->tdata.cisco_core_data == NULL)
160*3d8817e4Smiod     return NULL;
161*3d8817e4Smiod 
162*3d8817e4Smiod   switch ((crashreason) bfd_get_32 (abfd, crashinfo.reason))
163*3d8817e4Smiod     {
164*3d8817e4Smiod     case CRASH_REASON_NOTCRASHED:
165*3d8817e4Smiod       /* Crash file probably came from write core.  */
166*3d8817e4Smiod       abfd->tdata.cisco_core_data->sig = 0;
167*3d8817e4Smiod       break;
168*3d8817e4Smiod     case CRASH_REASON_CORRUPT:
169*3d8817e4Smiod       /* The crash context area was corrupt -- proceed with caution.
170*3d8817e4Smiod 	 We have no way of passing this information back to the caller.  */
171*3d8817e4Smiod       abfd->tdata.cisco_core_data->sig = 0;
172*3d8817e4Smiod       break;
173*3d8817e4Smiod     case CRASH_REASON_EXCEPTION:
174*3d8817e4Smiod       /* Crash occured due to CPU exception.  */
175*3d8817e4Smiod 
176*3d8817e4Smiod       /* This is 68k-specific; for MIPS we'll need to interpret
177*3d8817e4Smiod 	 cpu_vector differently based on the target configuration
178*3d8817e4Smiod 	 (since CISCO core files don't seem to have the processor
179*3d8817e4Smiod 	 encoded in them).  */
180*3d8817e4Smiod 
181*3d8817e4Smiod       switch (bfd_get_32 (abfd, crashinfo.cpu_vector))
182*3d8817e4Smiod 	{
183*3d8817e4Smiod 	   /* bus error           */
184*3d8817e4Smiod 	case 2 : abfd->tdata.cisco_core_data->sig = SIGBUS; break;
185*3d8817e4Smiod 	   /* address error       */
186*3d8817e4Smiod 	case 3 : abfd->tdata.cisco_core_data->sig = SIGBUS; break;
187*3d8817e4Smiod 	   /* illegal instruction */
188*3d8817e4Smiod 	case 4 : abfd->tdata.cisco_core_data->sig = SIGILL;  break;
189*3d8817e4Smiod 	   /* zero divide         */
190*3d8817e4Smiod 	case 5 : abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
191*3d8817e4Smiod 	   /* chk instruction     */
192*3d8817e4Smiod 	case 6 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
193*3d8817e4Smiod 	   /* trapv instruction   */
194*3d8817e4Smiod 	case 7 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
195*3d8817e4Smiod 	   /* privilege violation */
196*3d8817e4Smiod 	case 8 : abfd->tdata.cisco_core_data->sig = SIGSEGV; break;
197*3d8817e4Smiod 	   /* trace trap          */
198*3d8817e4Smiod 	case 9 : abfd->tdata.cisco_core_data->sig = SIGTRAP;  break;
199*3d8817e4Smiod 	   /* line 1010 emulator  */
200*3d8817e4Smiod 	case 10: abfd->tdata.cisco_core_data->sig = SIGILL;  break;
201*3d8817e4Smiod 	   /* line 1111 emulator  */
202*3d8817e4Smiod 	case 11: abfd->tdata.cisco_core_data->sig = SIGILL;  break;
203*3d8817e4Smiod 
204*3d8817e4Smiod 	  /* Coprocessor protocol violation.  Using a standard MMU or FPU
205*3d8817e4Smiod 	     this cannot be triggered by software.  Call it a SIGBUS.  */
206*3d8817e4Smiod 	case 13: abfd->tdata.cisco_core_data->sig = SIGBUS;  break;
207*3d8817e4Smiod 
208*3d8817e4Smiod 	  /* interrupt           */
209*3d8817e4Smiod 	case 31: abfd->tdata.cisco_core_data->sig = SIGINT;  break;
210*3d8817e4Smiod 	  /* breakpoint          */
211*3d8817e4Smiod 	case 33: abfd->tdata.cisco_core_data->sig = SIGTRAP;  break;
212*3d8817e4Smiod 
213*3d8817e4Smiod 	  /* floating point err  */
214*3d8817e4Smiod 	case 48: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
215*3d8817e4Smiod 	  /* floating point err  */
216*3d8817e4Smiod 	case 49: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
217*3d8817e4Smiod 	  /* zero divide         */
218*3d8817e4Smiod 	case 50: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
219*3d8817e4Smiod 	  /* underflow           */
220*3d8817e4Smiod 	case 51: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
221*3d8817e4Smiod 	  /* operand error       */
222*3d8817e4Smiod 	case 52: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
223*3d8817e4Smiod 	   /* overflow            */
224*3d8817e4Smiod 	case 53: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
225*3d8817e4Smiod 	  /* NAN                 */
226*3d8817e4Smiod 	case 54: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
227*3d8817e4Smiod 	default:
228*3d8817e4Smiod #ifndef SIGEMT
229*3d8817e4Smiod #define SIGEMT SIGTRAP
230*3d8817e4Smiod #endif
231*3d8817e4Smiod 	  /* "software generated"*/
232*3d8817e4Smiod 	  abfd->tdata.cisco_core_data->sig = SIGEMT;
233*3d8817e4Smiod 	}
234*3d8817e4Smiod       break;
235*3d8817e4Smiod     default:
236*3d8817e4Smiod       /* Unknown crash reason.  */
237*3d8817e4Smiod       abfd->tdata.cisco_core_data->sig = 0;
238*3d8817e4Smiod       break;
239*3d8817e4Smiod     }
240*3d8817e4Smiod 
241*3d8817e4Smiod   /* Create a ".data" section that maps the entire file, which is
242*3d8817e4Smiod      essentially a dump of the target system's RAM.  */
243*3d8817e4Smiod 
244*3d8817e4Smiod   asect = bfd_make_section_anyway (abfd, ".data");
245*3d8817e4Smiod   if (asect == NULL)
246*3d8817e4Smiod     goto error_return;
247*3d8817e4Smiod   asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
248*3d8817e4Smiod   /* The size of memory is the size of the core file itself.  */
249*3d8817e4Smiod   asect->size = statbuf.st_size;
250*3d8817e4Smiod   asect->vma = rambase;
251*3d8817e4Smiod   asect->filepos = 0;
252*3d8817e4Smiod 
253*3d8817e4Smiod   /* Create a ".crash" section to allow access to the saved
254*3d8817e4Smiod      crash information.  */
255*3d8817e4Smiod 
256*3d8817e4Smiod   asect = bfd_make_section_anyway (abfd, ".crash");
257*3d8817e4Smiod   if (asect == NULL)
258*3d8817e4Smiod     goto error_return;
259*3d8817e4Smiod   asect->flags = SEC_HAS_CONTENTS;
260*3d8817e4Smiod   asect->vma = 0;
261*3d8817e4Smiod   asect->filepos = crashinfo_offset;
262*3d8817e4Smiod   asect->size = sizeof (crashinfo);
263*3d8817e4Smiod 
264*3d8817e4Smiod   /* Create a ".reg" section to allow access to the saved
265*3d8817e4Smiod      registers.  */
266*3d8817e4Smiod 
267*3d8817e4Smiod   asect = bfd_make_section_anyway (abfd, ".reg");
268*3d8817e4Smiod   if (asect == NULL)
269*3d8817e4Smiod     goto error_return;
270*3d8817e4Smiod   asect->flags = SEC_HAS_CONTENTS;
271*3d8817e4Smiod   asect->vma = 0;
272*3d8817e4Smiod   asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
273*3d8817e4Smiod   /* Since we don't know the exact size of the saved register info,
274*3d8817e4Smiod      choose a register section size that is either the remaining part
275*3d8817e4Smiod      of the file, or 1024, whichever is smaller.  */
276*3d8817e4Smiod   nread = statbuf.st_size - asect->filepos;
277*3d8817e4Smiod   asect->size = (nread < 1024) ? nread : 1024;
278*3d8817e4Smiod 
279*3d8817e4Smiod   return abfd->xvec;
280*3d8817e4Smiod 
281*3d8817e4Smiod   /* Get here if we have already started filling out the BFD
282*3d8817e4Smiod      and there is an error of some kind.  */
283*3d8817e4Smiod 
284*3d8817e4Smiod  error_return:
285*3d8817e4Smiod   bfd_release (abfd, abfd->tdata.any);
286*3d8817e4Smiod   abfd->tdata.any = NULL;
287*3d8817e4Smiod   bfd_section_list_clear (abfd);
288*3d8817e4Smiod   return NULL;
289*3d8817e4Smiod }
290*3d8817e4Smiod 
291*3d8817e4Smiod static const bfd_target *
cisco_core_file_p(abfd)292*3d8817e4Smiod cisco_core_file_p (abfd)
293*3d8817e4Smiod      bfd *abfd;
294*3d8817e4Smiod {
295*3d8817e4Smiod   int *crash_info_locp;
296*3d8817e4Smiod   const bfd_target *target = NULL;
297*3d8817e4Smiod 
298*3d8817e4Smiod   for (crash_info_locp = crash_info_locs;
299*3d8817e4Smiod        *crash_info_locp != -1  &&  target == NULL;
300*3d8817e4Smiod        crash_info_locp++)
301*3d8817e4Smiod     {
302*3d8817e4Smiod       target = cisco_core_file_validate (abfd, *crash_info_locp);
303*3d8817e4Smiod     }
304*3d8817e4Smiod   return (target);
305*3d8817e4Smiod }
306*3d8817e4Smiod 
307*3d8817e4Smiod char *
cisco_core_file_failing_command(abfd)308*3d8817e4Smiod cisco_core_file_failing_command (abfd)
309*3d8817e4Smiod      bfd *abfd ATTRIBUTE_UNUSED;
310*3d8817e4Smiod {
311*3d8817e4Smiod   return NULL;
312*3d8817e4Smiod }
313*3d8817e4Smiod 
314*3d8817e4Smiod int
cisco_core_file_failing_signal(abfd)315*3d8817e4Smiod cisco_core_file_failing_signal (abfd)
316*3d8817e4Smiod      bfd *abfd ATTRIBUTE_UNUSED;
317*3d8817e4Smiod {
318*3d8817e4Smiod   return abfd->tdata.cisco_core_data->sig;
319*3d8817e4Smiod }
320*3d8817e4Smiod 
321*3d8817e4Smiod extern const bfd_target cisco_core_little_vec;
322*3d8817e4Smiod 
323*3d8817e4Smiod const bfd_target cisco_core_big_vec =
324*3d8817e4Smiod   {
325*3d8817e4Smiod     "cisco-ios-core-big",
326*3d8817e4Smiod     bfd_target_unknown_flavour,
327*3d8817e4Smiod     BFD_ENDIAN_BIG,		/* target byte order */
328*3d8817e4Smiod     BFD_ENDIAN_BIG,		/* target headers byte order */
329*3d8817e4Smiod     (HAS_RELOC | EXEC_P |	/* object flags */
330*3d8817e4Smiod      HAS_LINENO | HAS_DEBUG |
331*3d8817e4Smiod      HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
332*3d8817e4Smiod     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
333*3d8817e4Smiod     0,			                                   /* symbol prefix */
334*3d8817e4Smiod     ' ',						   /* ar_pad_char */
335*3d8817e4Smiod     16,							   /* ar_max_namelen */
336*3d8817e4Smiod     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
337*3d8817e4Smiod     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
338*3d8817e4Smiod     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
339*3d8817e4Smiod     bfd_getb64, bfd_getb_signed_64, bfd_putb64,
340*3d8817e4Smiod     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
341*3d8817e4Smiod     bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
342*3d8817e4Smiod 
343*3d8817e4Smiod     {				/* bfd_check_format */
344*3d8817e4Smiod      _bfd_dummy_target,		/* unknown format */
345*3d8817e4Smiod      _bfd_dummy_target,		/* object file */
346*3d8817e4Smiod      _bfd_dummy_target,		/* archive */
347*3d8817e4Smiod      cisco_core_file_p	/* a core file */
348*3d8817e4Smiod     },
349*3d8817e4Smiod     {				/* bfd_set_format */
350*3d8817e4Smiod      bfd_false, bfd_false,
351*3d8817e4Smiod      bfd_false, bfd_false
352*3d8817e4Smiod     },
353*3d8817e4Smiod     {				/* bfd_write_contents */
354*3d8817e4Smiod      bfd_false, bfd_false,
355*3d8817e4Smiod      bfd_false, bfd_false
356*3d8817e4Smiod     },
357*3d8817e4Smiod 
358*3d8817e4Smiod        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
359*3d8817e4Smiod        BFD_JUMP_TABLE_COPY (_bfd_generic),
360*3d8817e4Smiod        BFD_JUMP_TABLE_CORE (cisco),
361*3d8817e4Smiod        BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
362*3d8817e4Smiod        BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
363*3d8817e4Smiod        BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
364*3d8817e4Smiod        BFD_JUMP_TABLE_WRITE (_bfd_generic),
365*3d8817e4Smiod        BFD_JUMP_TABLE_LINK (_bfd_nolink),
366*3d8817e4Smiod        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
367*3d8817e4Smiod 
368*3d8817e4Smiod     & cisco_core_little_vec,
369*3d8817e4Smiod 
370*3d8817e4Smiod     (PTR) 0			/* backend_data */
371*3d8817e4Smiod };
372*3d8817e4Smiod 
373*3d8817e4Smiod const bfd_target cisco_core_little_vec =
374*3d8817e4Smiod   {
375*3d8817e4Smiod     "cisco-ios-core-little",
376*3d8817e4Smiod     bfd_target_unknown_flavour,
377*3d8817e4Smiod     BFD_ENDIAN_LITTLE,		/* target byte order */
378*3d8817e4Smiod     BFD_ENDIAN_LITTLE,		/* target headers byte order */
379*3d8817e4Smiod     (HAS_RELOC | EXEC_P |	/* object flags */
380*3d8817e4Smiod      HAS_LINENO | HAS_DEBUG |
381*3d8817e4Smiod      HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
382*3d8817e4Smiod     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
383*3d8817e4Smiod     0,			                                   /* symbol prefix */
384*3d8817e4Smiod     ' ',						   /* ar_pad_char */
385*3d8817e4Smiod     16,							   /* ar_max_namelen */
386*3d8817e4Smiod     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
387*3d8817e4Smiod     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
388*3d8817e4Smiod     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
389*3d8817e4Smiod     bfd_getl64, bfd_getl_signed_64, bfd_putl64,
390*3d8817e4Smiod     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
391*3d8817e4Smiod     bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
392*3d8817e4Smiod 
393*3d8817e4Smiod     {				/* bfd_check_format */
394*3d8817e4Smiod      _bfd_dummy_target,		/* unknown format */
395*3d8817e4Smiod      _bfd_dummy_target,		/* object file */
396*3d8817e4Smiod      _bfd_dummy_target,		/* archive */
397*3d8817e4Smiod      cisco_core_file_p	/* a core file */
398*3d8817e4Smiod     },
399*3d8817e4Smiod     {				/* bfd_set_format */
400*3d8817e4Smiod      bfd_false, bfd_false,
401*3d8817e4Smiod      bfd_false, bfd_false
402*3d8817e4Smiod     },
403*3d8817e4Smiod     {				/* bfd_write_contents */
404*3d8817e4Smiod      bfd_false, bfd_false,
405*3d8817e4Smiod      bfd_false, bfd_false
406*3d8817e4Smiod     },
407*3d8817e4Smiod 
408*3d8817e4Smiod        BFD_JUMP_TABLE_GENERIC (_bfd_generic),
409*3d8817e4Smiod        BFD_JUMP_TABLE_COPY (_bfd_generic),
410*3d8817e4Smiod        BFD_JUMP_TABLE_CORE (cisco),
411*3d8817e4Smiod        BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
412*3d8817e4Smiod        BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
413*3d8817e4Smiod        BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
414*3d8817e4Smiod        BFD_JUMP_TABLE_WRITE (_bfd_generic),
415*3d8817e4Smiod        BFD_JUMP_TABLE_LINK (_bfd_nolink),
416*3d8817e4Smiod        BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
417*3d8817e4Smiod 
418*3d8817e4Smiod     &cisco_core_big_vec,
419*3d8817e4Smiod 
420*3d8817e4Smiod     (PTR) 0			/* backend_data */
421*3d8817e4Smiod };
422