xref: /netbsd-src/external/gpl3/binutils/dist/bfd/cisco-core.c (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
12a6b7db3Sskrll /* BFD back-end for CISCO crash dumps.
2*cb63e24eSchristos    Copyright (C) 1994-2024 Free Software Foundation, Inc.
32a6b7db3Sskrll 
42a6b7db3Sskrll    This file is part of BFD, the Binary File Descriptor library.
52a6b7db3Sskrll 
62a6b7db3Sskrll    This program is free software; you can redistribute it and/or modify
72a6b7db3Sskrll    it under the terms of the GNU General Public License as published by
82a6b7db3Sskrll    the Free Software Foundation; either version 3 of the License, or
92a6b7db3Sskrll    (at your option) any later version.
102a6b7db3Sskrll 
112a6b7db3Sskrll    This program is distributed in the hope that it will be useful,
122a6b7db3Sskrll    but WITHOUT ANY WARRANTY; without even the implied warranty of
132a6b7db3Sskrll    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
142a6b7db3Sskrll    GNU General Public License for more details.
152a6b7db3Sskrll 
162a6b7db3Sskrll    You should have received a copy of the GNU General Public License
172a6b7db3Sskrll    along with this program; if not, write to the Free Software
182a6b7db3Sskrll    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
192a6b7db3Sskrll    MA 02110-1301, USA.  */
202a6b7db3Sskrll 
212a6b7db3Sskrll #include "sysdep.h"
222a6b7db3Sskrll #include "bfd.h"
232a6b7db3Sskrll #include "libbfd.h"
242a6b7db3Sskrll /* core_file_failing_signal returns a host signal (this probably should
252a6b7db3Sskrll    be fixed).  */
262a6b7db3Sskrll #include <signal.h>
272a6b7db3Sskrll 
282a6b7db3Sskrll /* for MSVC builds */
292a6b7db3Sskrll #ifndef SIGTRAP
302a6b7db3Sskrll # define SIGTRAP 5
312a6b7db3Sskrll #endif
322a6b7db3Sskrll #ifndef SIGEMT
332a6b7db3Sskrll # define SIGEMT 6
342a6b7db3Sskrll #endif
352a6b7db3Sskrll #ifndef SIGBUS
362a6b7db3Sskrll # define SIGBUS 10
372a6b7db3Sskrll #endif
382a6b7db3Sskrll 
39883529b6Schristos int crash_info_locs[] =
40883529b6Schristos {
412a6b7db3Sskrll   0x0250,	/* mips, ppc, x86, i960 */
422a6b7db3Sskrll   0x0400,	/* m68k, mips, x86, i960 */
432a6b7db3Sskrll   0x0FFC,	/* m68k, mips, ppc, x86, i960 */
442a6b7db3Sskrll   0x3000,	/* ppc */
452a6b7db3Sskrll   0x4FFC,	/* m68k */
462a6b7db3Sskrll   -1
472a6b7db3Sskrll };
482a6b7db3Sskrll 
492a6b7db3Sskrll #define CRASH_MAGIC	0xdead1234
502a6b7db3Sskrll #define MASK_ADDR(x)	((x) & 0x0fffffff)	/* Mask crash info address */
512a6b7db3Sskrll 
52883529b6Schristos typedef enum
53883529b6Schristos {
542a6b7db3Sskrll   CRASH_REASON_NOTCRASHED = 0,
552a6b7db3Sskrll   CRASH_REASON_EXCEPTION = 1,
562a6b7db3Sskrll   CRASH_REASON_CORRUPT = 2,
572a6b7db3Sskrll } crashreason;
582a6b7db3Sskrll 
59883529b6Schristos typedef struct
60883529b6Schristos {
612a6b7db3Sskrll   char magic[4];		/* Magic number */
622a6b7db3Sskrll   char version[4];		/* Version number */
632a6b7db3Sskrll   char reason[4];		/* Crash reason */
642a6b7db3Sskrll   char cpu_vector[4];		/* CPU vector for exceptions */
652a6b7db3Sskrll   char registers[4];		/* Pointer to saved registers */
662a6b7db3Sskrll   char rambase[4];		/* Base of RAM (not in V1 crash info) */
672a6b7db3Sskrll   char textbase[4];		/* Base of .text section (not in V3 crash info) */
682a6b7db3Sskrll   char database[4];		/* Base of .data section (not in V3 crash info) */
692a6b7db3Sskrll   char bssbase[4];		/* Base of .bss section (not in V3 crash info) */
702a6b7db3Sskrll } crashinfo_external;
712a6b7db3Sskrll 
722a6b7db3Sskrll struct cisco_core_struct
732a6b7db3Sskrll {
742a6b7db3Sskrll   int sig;
752a6b7db3Sskrll };
762a6b7db3Sskrll 
772a6b7db3Sskrll #define cisco_core_file_matches_executable_p generic_core_file_matches_executable_p
7831799520Schristos #define cisco_core_file_pid _bfd_nocore_core_file_pid
792a6b7db3Sskrll 
802a6b7db3Sskrll /* Examine the file for a crash info struct at the offset given by
812a6b7db3Sskrll    CRASH_INFO_LOC.  */
822a6b7db3Sskrll 
834f645668Schristos static bfd_cleanup
cisco_core_file_validate(bfd * abfd,int crash_info_loc)84883529b6Schristos cisco_core_file_validate (bfd *abfd, int crash_info_loc)
852a6b7db3Sskrll {
862a6b7db3Sskrll   char buf[4];
872a6b7db3Sskrll   unsigned int crashinfo_offset;
882a6b7db3Sskrll   crashinfo_external crashinfo;
892a6b7db3Sskrll   bfd_size_type nread;
902a6b7db3Sskrll   unsigned int magic;
912a6b7db3Sskrll   unsigned int version;
922a6b7db3Sskrll   unsigned int rambase;
932a6b7db3Sskrll   sec_ptr asect;
942a6b7db3Sskrll   struct stat statbuf;
954f645668Schristos   size_t amt;
962a6b7db3Sskrll   flagword flags;
972a6b7db3Sskrll 
98*cb63e24eSchristos   if (bfd_seek (abfd, crash_info_loc, SEEK_SET) != 0)
992a6b7db3Sskrll     return NULL;
1002a6b7db3Sskrll 
101*cb63e24eSchristos   nread = bfd_read (buf, 4, abfd);
1022a6b7db3Sskrll   if (nread != 4)
1032a6b7db3Sskrll     {
1042a6b7db3Sskrll       if (bfd_get_error () != bfd_error_system_call)
1052a6b7db3Sskrll 	bfd_set_error (bfd_error_wrong_format);
1062a6b7db3Sskrll       return NULL;
1072a6b7db3Sskrll     }
1082a6b7db3Sskrll   crashinfo_offset = MASK_ADDR (bfd_get_32 (abfd, buf));
1092a6b7db3Sskrll 
110*cb63e24eSchristos   if (bfd_seek (abfd, crashinfo_offset, SEEK_SET) != 0)
1112a6b7db3Sskrll     {
1122a6b7db3Sskrll       /* Most likely we failed because of a bogus (huge) offset */
1132a6b7db3Sskrll       bfd_set_error (bfd_error_wrong_format);
1142a6b7db3Sskrll       return NULL;
1152a6b7db3Sskrll     }
1162a6b7db3Sskrll 
117*cb63e24eSchristos   nread = bfd_read (&crashinfo, sizeof (crashinfo), abfd);
1182a6b7db3Sskrll   if (nread != sizeof (crashinfo))
1192a6b7db3Sskrll     {
1202a6b7db3Sskrll       if (bfd_get_error () != bfd_error_system_call)
1212a6b7db3Sskrll 	bfd_set_error (bfd_error_wrong_format);
1222a6b7db3Sskrll       return NULL;
1232a6b7db3Sskrll     }
1242a6b7db3Sskrll 
1252a6b7db3Sskrll   if (bfd_stat (abfd, &statbuf) < 0)
1262a6b7db3Sskrll     {
1272a6b7db3Sskrll       bfd_set_error (bfd_error_system_call);
1282a6b7db3Sskrll       return NULL;
1292a6b7db3Sskrll     }
1302a6b7db3Sskrll 
1312a6b7db3Sskrll   magic = bfd_get_32 (abfd, crashinfo.magic);
1322a6b7db3Sskrll   if (magic != CRASH_MAGIC)
1332a6b7db3Sskrll     {
1342a6b7db3Sskrll       bfd_set_error (bfd_error_wrong_format);
1352a6b7db3Sskrll       return NULL;
1362a6b7db3Sskrll     }
1372a6b7db3Sskrll 
1382a6b7db3Sskrll   version = bfd_get_32 (abfd, crashinfo.version);
1392a6b7db3Sskrll   if (version == 0)
1402a6b7db3Sskrll     {
1412a6b7db3Sskrll       bfd_set_error (bfd_error_wrong_format);
1422a6b7db3Sskrll       return NULL;
1432a6b7db3Sskrll     }
1442a6b7db3Sskrll   else if (version == 1)
1452a6b7db3Sskrll     {
1462a6b7db3Sskrll       /* V1 core dumps don't specify the dump base, assume 0 */
1472a6b7db3Sskrll       rambase = 0;
1482a6b7db3Sskrll     }
1492a6b7db3Sskrll   else
1502a6b7db3Sskrll     {
1512a6b7db3Sskrll       rambase = bfd_get_32 (abfd, crashinfo.rambase);
1522a6b7db3Sskrll     }
1532a6b7db3Sskrll 
1542a6b7db3Sskrll   /* OK, we believe you.  You're a core file.  */
1552a6b7db3Sskrll 
1562a6b7db3Sskrll   amt = sizeof (struct cisco_core_struct);
1572a6b7db3Sskrll   abfd->tdata.cisco_core_data = (struct cisco_core_struct *) bfd_zmalloc (amt);
1582a6b7db3Sskrll   if (abfd->tdata.cisco_core_data == NULL)
1592a6b7db3Sskrll     return NULL;
1602a6b7db3Sskrll 
1612a6b7db3Sskrll   switch ((crashreason) bfd_get_32 (abfd, crashinfo.reason))
1622a6b7db3Sskrll     {
1632a6b7db3Sskrll     case CRASH_REASON_NOTCRASHED:
1642a6b7db3Sskrll       /* Crash file probably came from write core.  */
1652a6b7db3Sskrll       abfd->tdata.cisco_core_data->sig = 0;
1662a6b7db3Sskrll       break;
1672a6b7db3Sskrll     case CRASH_REASON_CORRUPT:
1682a6b7db3Sskrll       /* The crash context area was corrupt -- proceed with caution.
1692a6b7db3Sskrll 	 We have no way of passing this information back to the caller.  */
1702a6b7db3Sskrll       abfd->tdata.cisco_core_data->sig = 0;
1712a6b7db3Sskrll       break;
1722a6b7db3Sskrll     case CRASH_REASON_EXCEPTION:
1732a6b7db3Sskrll       /* Crash occured due to CPU exception.  */
1742a6b7db3Sskrll 
1752a6b7db3Sskrll       /* This is 68k-specific; for MIPS we'll need to interpret
1762a6b7db3Sskrll 	 cpu_vector differently based on the target configuration
1772a6b7db3Sskrll 	 (since CISCO core files don't seem to have the processor
1782a6b7db3Sskrll 	 encoded in them).  */
1792a6b7db3Sskrll 
1802a6b7db3Sskrll       switch (bfd_get_32 (abfd, crashinfo.cpu_vector))
1812a6b7db3Sskrll 	{
1822a6b7db3Sskrll 	   /* bus error		  */
1832a6b7db3Sskrll 	case 2 : abfd->tdata.cisco_core_data->sig = SIGBUS; break;
1842a6b7db3Sskrll 	   /* address error	  */
1852a6b7db3Sskrll 	case 3 : abfd->tdata.cisco_core_data->sig = SIGBUS; break;
1862a6b7db3Sskrll 	   /* illegal instruction */
1872a6b7db3Sskrll 	case 4 : abfd->tdata.cisco_core_data->sig = SIGILL;  break;
1882a6b7db3Sskrll 	   /* zero divide	  */
1892a6b7db3Sskrll 	case 5 : abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
1902a6b7db3Sskrll 	   /* chk instruction	  */
1912a6b7db3Sskrll 	case 6 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
1922a6b7db3Sskrll 	   /* trapv instruction	  */
1932a6b7db3Sskrll 	case 7 : abfd->tdata.cisco_core_data->sig = SIGFPE; break;
1942a6b7db3Sskrll 	   /* privilege violation */
1952a6b7db3Sskrll 	case 8 : abfd->tdata.cisco_core_data->sig = SIGSEGV; break;
1962a6b7db3Sskrll 	   /* trace trap	  */
1972a6b7db3Sskrll 	case 9 : abfd->tdata.cisco_core_data->sig = SIGTRAP;  break;
1982a6b7db3Sskrll 	   /* line 1010 emulator  */
1992a6b7db3Sskrll 	case 10: abfd->tdata.cisco_core_data->sig = SIGILL;  break;
2002a6b7db3Sskrll 	   /* line 1111 emulator  */
2012a6b7db3Sskrll 	case 11: abfd->tdata.cisco_core_data->sig = SIGILL;  break;
2022a6b7db3Sskrll 
2032a6b7db3Sskrll 	  /* Coprocessor protocol violation.  Using a standard MMU or FPU
2042a6b7db3Sskrll 	     this cannot be triggered by software.  Call it a SIGBUS.  */
2052a6b7db3Sskrll 	case 13: abfd->tdata.cisco_core_data->sig = SIGBUS;  break;
2062a6b7db3Sskrll 
2072a6b7db3Sskrll 	  /* interrupt		 */
2082a6b7db3Sskrll 	case 31: abfd->tdata.cisco_core_data->sig = SIGINT;  break;
2092a6b7db3Sskrll 	  /* breakpoint		 */
2102a6b7db3Sskrll 	case 33: abfd->tdata.cisco_core_data->sig = SIGTRAP;  break;
2112a6b7db3Sskrll 
2122a6b7db3Sskrll 	  /* floating point err	 */
2132a6b7db3Sskrll 	case 48: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2142a6b7db3Sskrll 	  /* floating point err	 */
2152a6b7db3Sskrll 	case 49: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2162a6b7db3Sskrll 	  /* zero divide	 */
2172a6b7db3Sskrll 	case 50: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2182a6b7db3Sskrll 	  /* underflow		 */
2192a6b7db3Sskrll 	case 51: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2202a6b7db3Sskrll 	  /* operand error	 */
2212a6b7db3Sskrll 	case 52: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2222a6b7db3Sskrll 	   /* overflow		  */
2232a6b7db3Sskrll 	case 53: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2242a6b7db3Sskrll 	  /* NAN		 */
2252a6b7db3Sskrll 	case 54: abfd->tdata.cisco_core_data->sig = SIGFPE;  break;
2262a6b7db3Sskrll 	default:
2272a6b7db3Sskrll #ifndef SIGEMT
2282a6b7db3Sskrll #define SIGEMT SIGTRAP
2292a6b7db3Sskrll #endif
2302a6b7db3Sskrll 	  /* "software generated"*/
2312a6b7db3Sskrll 	  abfd->tdata.cisco_core_data->sig = SIGEMT;
2322a6b7db3Sskrll 	}
2332a6b7db3Sskrll       break;
2342a6b7db3Sskrll     default:
2352a6b7db3Sskrll       /* Unknown crash reason.  */
2362a6b7db3Sskrll       abfd->tdata.cisco_core_data->sig = 0;
2372a6b7db3Sskrll       break;
2382a6b7db3Sskrll     }
2392a6b7db3Sskrll 
2402a6b7db3Sskrll   /* Create a ".data" section that maps the entire file, which is
2412a6b7db3Sskrll      essentially a dump of the target system's RAM.  */
2422a6b7db3Sskrll 
2432a6b7db3Sskrll   flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
2442a6b7db3Sskrll   asect = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
2452a6b7db3Sskrll   if (asect == NULL)
2462a6b7db3Sskrll     goto error_return;
2472a6b7db3Sskrll   /* The size of memory is the size of the core file itself.  */
2482a6b7db3Sskrll   asect->size = statbuf.st_size;
2492a6b7db3Sskrll   asect->vma = rambase;
2502a6b7db3Sskrll   asect->filepos = 0;
2512a6b7db3Sskrll 
2522a6b7db3Sskrll   /* Create a ".crash" section to allow access to the saved
2532a6b7db3Sskrll      crash information.  */
2542a6b7db3Sskrll 
2552a6b7db3Sskrll   flags = SEC_HAS_CONTENTS;
2562a6b7db3Sskrll   asect = bfd_make_section_anyway_with_flags (abfd, ".crash", flags);
2572a6b7db3Sskrll   if (asect == NULL)
2582a6b7db3Sskrll     goto error_return;
2592a6b7db3Sskrll   asect->vma = 0;
2602a6b7db3Sskrll   asect->filepos = crashinfo_offset;
2612a6b7db3Sskrll   asect->size = sizeof (crashinfo);
2622a6b7db3Sskrll 
2632a6b7db3Sskrll   /* Create a ".reg" section to allow access to the saved
2642a6b7db3Sskrll      registers.  */
2652a6b7db3Sskrll 
2662a6b7db3Sskrll   asect = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
2672a6b7db3Sskrll   if (asect == NULL)
2682a6b7db3Sskrll     goto error_return;
2692a6b7db3Sskrll   asect->vma = 0;
2702a6b7db3Sskrll   asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
2712a6b7db3Sskrll   /* Since we don't know the exact size of the saved register info,
2722a6b7db3Sskrll      choose a register section size that is either the remaining part
2732a6b7db3Sskrll      of the file, or 1024, whichever is smaller.  */
2742a6b7db3Sskrll   nread = statbuf.st_size - asect->filepos;
2752a6b7db3Sskrll   asect->size = (nread < 1024) ? nread : 1024;
2762a6b7db3Sskrll 
2774f645668Schristos   return _bfd_no_cleanup;
2782a6b7db3Sskrll 
2792a6b7db3Sskrll   /* Get here if we have already started filling out the BFD
2802a6b7db3Sskrll      and there is an error of some kind.  */
2812a6b7db3Sskrll 
2822a6b7db3Sskrll  error_return:
2832a6b7db3Sskrll   bfd_release (abfd, abfd->tdata.any);
2842a6b7db3Sskrll   abfd->tdata.any = NULL;
2852a6b7db3Sskrll   bfd_section_list_clear (abfd);
2862a6b7db3Sskrll   return NULL;
2872a6b7db3Sskrll }
2882a6b7db3Sskrll 
2894f645668Schristos static bfd_cleanup
cisco_core_file_p(bfd * abfd)290883529b6Schristos cisco_core_file_p (bfd *abfd)
2912a6b7db3Sskrll {
2922a6b7db3Sskrll   int *crash_info_locp;
2934f645668Schristos   bfd_cleanup cleanup = NULL;
2942a6b7db3Sskrll 
2952a6b7db3Sskrll   for (crash_info_locp = crash_info_locs;
2964f645668Schristos        *crash_info_locp != -1 && cleanup == NULL;
2972a6b7db3Sskrll        crash_info_locp++)
2982a6b7db3Sskrll     {
2994f645668Schristos       cleanup = cisco_core_file_validate (abfd, *crash_info_locp);
3002a6b7db3Sskrll     }
3014f645668Schristos   return cleanup;
3022a6b7db3Sskrll }
3032a6b7db3Sskrll 
304883529b6Schristos static char *
cisco_core_file_failing_command(bfd * abfd ATTRIBUTE_UNUSED)305883529b6Schristos cisco_core_file_failing_command (bfd *abfd ATTRIBUTE_UNUSED)
3062a6b7db3Sskrll {
3072a6b7db3Sskrll   return NULL;
3082a6b7db3Sskrll }
3092a6b7db3Sskrll 
310883529b6Schristos static int
cisco_core_file_failing_signal(bfd * abfd ATTRIBUTE_UNUSED)311883529b6Schristos cisco_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
3122a6b7db3Sskrll {
3132a6b7db3Sskrll   return abfd->tdata.cisco_core_data->sig;
3142a6b7db3Sskrll }
3152a6b7db3Sskrll 
3169573673dSchristos extern const bfd_target core_cisco_le_vec;
3172a6b7db3Sskrll 
3189573673dSchristos const bfd_target core_cisco_be_vec =
3192a6b7db3Sskrll {
3202a6b7db3Sskrll   "cisco-ios-core-big",
3212a6b7db3Sskrll   bfd_target_unknown_flavour,
3222a6b7db3Sskrll   BFD_ENDIAN_BIG,		/* target byte order */
3232a6b7db3Sskrll   BFD_ENDIAN_BIG,		/* target headers byte order */
324c1a20988Schristos   (HAS_RELOC | EXEC_P		/* object flags */
325c1a20988Schristos    | HAS_LINENO | HAS_DEBUG
326c1a20988Schristos    | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
3272a6b7db3Sskrll   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
3282a6b7db3Sskrll   0,				/* symbol prefix */
3292a6b7db3Sskrll   ' ',				/* ar_pad_char */
3302a6b7db3Sskrll   16,				/* ar_max_namelen */
331883529b6Schristos   0,				/* match priority.  */
3324f645668Schristos   TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
3332a6b7db3Sskrll   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
3342a6b7db3Sskrll   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
3352a6b7db3Sskrll   bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
3362a6b7db3Sskrll   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
3372a6b7db3Sskrll   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
3382a6b7db3Sskrll   bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
3392a6b7db3Sskrll 
3402a6b7db3Sskrll   {				/* bfd_check_format */
3412a6b7db3Sskrll     _bfd_dummy_target,			/* unknown format */
3422a6b7db3Sskrll     _bfd_dummy_target,			/* object file */
3432a6b7db3Sskrll     _bfd_dummy_target,			/* archive */
3442a6b7db3Sskrll     cisco_core_file_p			/* a core file */
3452a6b7db3Sskrll   },
3462a6b7db3Sskrll   {				/* bfd_set_format */
347c1a20988Schristos     _bfd_bool_bfd_false_error,
348c1a20988Schristos     _bfd_bool_bfd_false_error,
349c1a20988Schristos     _bfd_bool_bfd_false_error,
350c1a20988Schristos     _bfd_bool_bfd_false_error
3512a6b7db3Sskrll   },
3522a6b7db3Sskrll   {				/* bfd_write_contents */
353c1a20988Schristos     _bfd_bool_bfd_false_error,
354c1a20988Schristos     _bfd_bool_bfd_false_error,
355c1a20988Schristos     _bfd_bool_bfd_false_error,
356c1a20988Schristos     _bfd_bool_bfd_false_error
3572a6b7db3Sskrll   },
3582a6b7db3Sskrll 
3592a6b7db3Sskrll   BFD_JUMP_TABLE_GENERIC (_bfd_generic),
3602a6b7db3Sskrll   BFD_JUMP_TABLE_COPY (_bfd_generic),
3612a6b7db3Sskrll   BFD_JUMP_TABLE_CORE (cisco),
3622a6b7db3Sskrll   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
3632a6b7db3Sskrll   BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
3642a6b7db3Sskrll   BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
3652a6b7db3Sskrll   BFD_JUMP_TABLE_WRITE (_bfd_generic),
3662a6b7db3Sskrll   BFD_JUMP_TABLE_LINK (_bfd_nolink),
3672a6b7db3Sskrll   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
3682a6b7db3Sskrll 
3699573673dSchristos   &core_cisco_le_vec,
3702a6b7db3Sskrll 
371883529b6Schristos   NULL				/* backend_data */
3722a6b7db3Sskrll };
3732a6b7db3Sskrll 
3749573673dSchristos const bfd_target core_cisco_le_vec =
3752a6b7db3Sskrll {
3762a6b7db3Sskrll   "cisco-ios-core-little",
3772a6b7db3Sskrll   bfd_target_unknown_flavour,
3782a6b7db3Sskrll   BFD_ENDIAN_LITTLE,		/* target byte order */
3792a6b7db3Sskrll   BFD_ENDIAN_LITTLE,		/* target headers byte order */
380c1a20988Schristos   (HAS_RELOC | EXEC_P		/* object flags */
381c1a20988Schristos    | HAS_LINENO | HAS_DEBUG
382c1a20988Schristos    | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
3832a6b7db3Sskrll   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
3842a6b7db3Sskrll   0,				/* symbol prefix */
3852a6b7db3Sskrll   ' ',				/* ar_pad_char */
3862a6b7db3Sskrll   16,				/* ar_max_namelen */
387883529b6Schristos   0,				/* match_priority */
3884f645668Schristos   TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols.  */
3892a6b7db3Sskrll   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
3902a6b7db3Sskrll   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
3912a6b7db3Sskrll   bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
3922a6b7db3Sskrll   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
3932a6b7db3Sskrll   bfd_getl32, bfd_getl_signed_32, bfd_putl32,
3942a6b7db3Sskrll   bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
3952a6b7db3Sskrll 
3962a6b7db3Sskrll   {				/* bfd_check_format */
3972a6b7db3Sskrll     _bfd_dummy_target,			/* unknown format */
3982a6b7db3Sskrll     _bfd_dummy_target,			/* object file */
3992a6b7db3Sskrll     _bfd_dummy_target,			/* archive */
4002a6b7db3Sskrll     cisco_core_file_p			/* a core file */
4012a6b7db3Sskrll   },
4022a6b7db3Sskrll   {				/* bfd_set_format */
403c1a20988Schristos     _bfd_bool_bfd_false_error,
404c1a20988Schristos     _bfd_bool_bfd_false_error,
405c1a20988Schristos     _bfd_bool_bfd_false_error,
406c1a20988Schristos     _bfd_bool_bfd_false_error
4072a6b7db3Sskrll   },
4082a6b7db3Sskrll   {				/* bfd_write_contents */
409c1a20988Schristos     _bfd_bool_bfd_false_error,
410c1a20988Schristos     _bfd_bool_bfd_false_error,
411c1a20988Schristos     _bfd_bool_bfd_false_error,
412c1a20988Schristos     _bfd_bool_bfd_false_error
4132a6b7db3Sskrll   },
4142a6b7db3Sskrll 
4152a6b7db3Sskrll   BFD_JUMP_TABLE_GENERIC (_bfd_generic),
4162a6b7db3Sskrll   BFD_JUMP_TABLE_COPY (_bfd_generic),
4172a6b7db3Sskrll   BFD_JUMP_TABLE_CORE (cisco),
4182a6b7db3Sskrll   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
4192a6b7db3Sskrll   BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
4202a6b7db3Sskrll   BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
4212a6b7db3Sskrll   BFD_JUMP_TABLE_WRITE (_bfd_generic),
4222a6b7db3Sskrll   BFD_JUMP_TABLE_LINK (_bfd_nolink),
4232a6b7db3Sskrll   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
4242a6b7db3Sskrll 
4259573673dSchristos   &core_cisco_be_vec,
4262a6b7db3Sskrll 
427883529b6Schristos   NULL				/* backend_data */
4282a6b7db3Sskrll };
429