xref: /openbsd-src/gnu/usr.bin/binutils-2.17/bfd/hpux-core.c (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod /* BFD back-end for HP/UX core files.
2*3d8817e4Smiod    Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004
3*3d8817e4Smiod    Free Software Foundation, Inc.
4*3d8817e4Smiod    Written by Stu Grossman, Cygnus Support.
5*3d8817e4Smiod    Converted to back-end form by Ian Lance Taylor, Cygnus SUpport
6*3d8817e4Smiod 
7*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library.
8*3d8817e4Smiod 
9*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
10*3d8817e4Smiod it under the terms of the GNU General Public License as published by
11*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or
12*3d8817e4Smiod (at your option) any later version.
13*3d8817e4Smiod 
14*3d8817e4Smiod This program is distributed in the hope that it will be useful,
15*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
16*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*3d8817e4Smiod GNU General Public License for more details.
18*3d8817e4Smiod 
19*3d8817e4Smiod You should have received a copy of the GNU General Public License
20*3d8817e4Smiod along with this program; if not, write to the Free Software
21*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
22*3d8817e4Smiod 
23*3d8817e4Smiod /* This file can only be compiled on systems which use HP/UX style
24*3d8817e4Smiod    core files.  */
25*3d8817e4Smiod 
26*3d8817e4Smiod #include "bfd.h"
27*3d8817e4Smiod #include "sysdep.h"
28*3d8817e4Smiod #include "libbfd.h"
29*3d8817e4Smiod 
30*3d8817e4Smiod #if defined (HOST_HPPAHPUX) || defined (HOST_HP300HPUX) || defined (HOST_HPPAMPEIX)
31*3d8817e4Smiod 
32*3d8817e4Smiod /* FIXME: sys/core.h doesn't exist for HPUX version 7.  HPUX version
33*3d8817e4Smiod    5, 6, and 7 core files seem to be standard trad-core.c type core
34*3d8817e4Smiod    files; can we just use trad-core.c in addition to this file?  */
35*3d8817e4Smiod 
36*3d8817e4Smiod #include <sys/core.h>
37*3d8817e4Smiod #include <sys/utsname.h>
38*3d8817e4Smiod 
39*3d8817e4Smiod #endif /* HOST_HPPAHPUX */
40*3d8817e4Smiod 
41*3d8817e4Smiod #ifdef HOST_HPPABSD
42*3d8817e4Smiod 
43*3d8817e4Smiod /* Not a very swift place to put it, but that's where the BSD port
44*3d8817e4Smiod    puts them.  */
45*3d8817e4Smiod #include "/hpux/usr/include/sys/core.h"
46*3d8817e4Smiod 
47*3d8817e4Smiod #endif /* HOST_HPPABSD */
48*3d8817e4Smiod 
49*3d8817e4Smiod #include <sys/param.h>
50*3d8817e4Smiod #ifdef HAVE_DIRENT_H
51*3d8817e4Smiod # include <dirent.h>
52*3d8817e4Smiod #else
53*3d8817e4Smiod # ifdef HAVE_SYS_NDIR_H
54*3d8817e4Smiod #  include <sys/ndir.h>
55*3d8817e4Smiod # endif
56*3d8817e4Smiod # ifdef HAVE_SYS_DIR_H
57*3d8817e4Smiod #  include <sys/dir.h>
58*3d8817e4Smiod # endif
59*3d8817e4Smiod # ifdef HAVE_NDIR_H
60*3d8817e4Smiod #  include <ndir.h>
61*3d8817e4Smiod # endif
62*3d8817e4Smiod #endif
63*3d8817e4Smiod #include <signal.h>
64*3d8817e4Smiod #ifdef HPUX_CORE
65*3d8817e4Smiod #include <machine/reg.h>
66*3d8817e4Smiod #endif
67*3d8817e4Smiod #include <sys/user.h>		/* After a.out.h  */
68*3d8817e4Smiod #include <sys/file.h>
69*3d8817e4Smiod 
70*3d8817e4Smiod /* Kludge: There's no explicit mechanism provided by sys/core.h to
71*3d8817e4Smiod    conditionally know whether a proc_info has thread id fields.
72*3d8817e4Smiod    However, CORE_ANON_SHMEM shows up first at 10.30, which is
73*3d8817e4Smiod    happily also when meaningful thread id's show up in proc_info. */
74*3d8817e4Smiod #if defined(CORE_ANON_SHMEM)
75*3d8817e4Smiod #define PROC_INFO_HAS_THREAD_ID (1)
76*3d8817e4Smiod #endif
77*3d8817e4Smiod 
78*3d8817e4Smiod /* This type appears at HP-UX 10.30.  Defining it if not defined
79*3d8817e4Smiod    by sys/core.h allows us to build for older HP-UX's, and (since
80*3d8817e4Smiod    it won't be encountered in core-dumps from older HP-UX's) is
81*3d8817e4Smiod    harmless. */
82*3d8817e4Smiod #if !defined(CORE_ANON_SHMEM)
83*3d8817e4Smiod #define CORE_ANON_SHMEM 0x00000200         /* anonymous shared memory */
84*3d8817e4Smiod #endif
85*3d8817e4Smiod 
86*3d8817e4Smiod /* These are stored in the bfd's tdata */
87*3d8817e4Smiod 
88*3d8817e4Smiod /* .lwpid and .user_tid are only valid if PROC_INFO_HAS_THREAD_ID, else they
89*3d8817e4Smiod    are set to 0.  Also, until HP-UX implements MxN threads, .user_tid and
90*3d8817e4Smiod    .lwpid are synonymous. */
91*3d8817e4Smiod struct hpux_core_struct
92*3d8817e4Smiod {
93*3d8817e4Smiod   int sig;
94*3d8817e4Smiod   int lwpid;               /* Kernel thread ID. */
95*3d8817e4Smiod   unsigned long user_tid;  /* User thread ID. */
96*3d8817e4Smiod   char cmd[MAXCOMLEN + 1];
97*3d8817e4Smiod };
98*3d8817e4Smiod 
99*3d8817e4Smiod #define core_hdr(bfd) ((bfd)->tdata.hpux_core_data)
100*3d8817e4Smiod #define core_signal(bfd) (core_hdr(bfd)->sig)
101*3d8817e4Smiod #define core_command(bfd) (core_hdr(bfd)->cmd)
102*3d8817e4Smiod #define core_kernel_thread_id(bfd) (core_hdr(bfd)->lwpid)
103*3d8817e4Smiod #define core_user_thread_id(bfd) (core_hdr(bfd)->user_tid)
104*3d8817e4Smiod #define hpux_core_core_file_matches_executable_p generic_core_file_matches_executable_p
105*3d8817e4Smiod 
106*3d8817e4Smiod static asection *make_bfd_asection (bfd *, const char *, flagword,
107*3d8817e4Smiod                                     bfd_size_type, bfd_vma, unsigned int);
108*3d8817e4Smiod static const bfd_target *hpux_core_core_file_p (bfd *);
109*3d8817e4Smiod static char *hpux_core_core_file_failing_command (bfd *);
110*3d8817e4Smiod static int hpux_core_core_file_failing_signal (bfd *);
111*3d8817e4Smiod static void swap_abort (void);
112*3d8817e4Smiod 
113*3d8817e4Smiod static asection *
make_bfd_asection(bfd * abfd,const char * name,flagword flags,bfd_size_type size,bfd_vma vma,unsigned int alignment_power)114*3d8817e4Smiod make_bfd_asection (bfd *abfd, const char *name, flagword flags,
115*3d8817e4Smiod                    bfd_size_type size, bfd_vma vma,
116*3d8817e4Smiod                    unsigned int alignment_power)
117*3d8817e4Smiod {
118*3d8817e4Smiod   asection *asect;
119*3d8817e4Smiod   char *newname;
120*3d8817e4Smiod 
121*3d8817e4Smiod   newname = bfd_alloc (abfd, (bfd_size_type) strlen (name) + 1);
122*3d8817e4Smiod   if (!newname)
123*3d8817e4Smiod     return NULL;
124*3d8817e4Smiod 
125*3d8817e4Smiod   strcpy (newname, name);
126*3d8817e4Smiod 
127*3d8817e4Smiod   asect = bfd_make_section_anyway (abfd, newname);
128*3d8817e4Smiod   if (!asect)
129*3d8817e4Smiod     return NULL;
130*3d8817e4Smiod 
131*3d8817e4Smiod   asect->flags = flags;
132*3d8817e4Smiod   asect->size = size;
133*3d8817e4Smiod   asect->vma = vma;
134*3d8817e4Smiod   asect->filepos = bfd_tell (abfd);
135*3d8817e4Smiod   asect->alignment_power = alignment_power;
136*3d8817e4Smiod 
137*3d8817e4Smiod   return asect;
138*3d8817e4Smiod }
139*3d8817e4Smiod 
140*3d8817e4Smiod /* Return true if the given core file section corresponds to a thread,
141*3d8817e4Smiod    based on its name.  */
142*3d8817e4Smiod 
143*3d8817e4Smiod static int
thread_section_p(bfd * abfd ATTRIBUTE_UNUSED,asection * sect,void * obj ATTRIBUTE_UNUSED)144*3d8817e4Smiod thread_section_p (bfd *abfd ATTRIBUTE_UNUSED,
145*3d8817e4Smiod                   asection *sect,
146*3d8817e4Smiod                   void *obj ATTRIBUTE_UNUSED)
147*3d8817e4Smiod {
148*3d8817e4Smiod   return (strncmp (sect->name, ".reg/", 5) == 0);
149*3d8817e4Smiod }
150*3d8817e4Smiod 
151*3d8817e4Smiod /* this function builds a bfd target if the file is a corefile.
152*3d8817e4Smiod    It returns null or 0 if it finds out thaat it is not a core file.
153*3d8817e4Smiod    The way it checks this is by looking for allowed 'type' field values.
154*3d8817e4Smiod    These are declared in sys/core.h
155*3d8817e4Smiod    There are some values which are 'reserved for future use'. In particular
156*3d8817e4Smiod    CORE_NONE is actually defined as 0. This may be a catch-all for cases
157*3d8817e4Smiod    in which the core file is generated by some non-hpux application.
158*3d8817e4Smiod    (I am just guessing here!)
159*3d8817e4Smiod */
160*3d8817e4Smiod static const bfd_target *
hpux_core_core_file_p(bfd * abfd)161*3d8817e4Smiod hpux_core_core_file_p (bfd *abfd)
162*3d8817e4Smiod {
163*3d8817e4Smiod   int  good_sections = 0;
164*3d8817e4Smiod   int  unknown_sections = 0;
165*3d8817e4Smiod 
166*3d8817e4Smiod   core_hdr (abfd) = (struct hpux_core_struct *)
167*3d8817e4Smiod     bfd_zalloc (abfd, (bfd_size_type) sizeof (struct hpux_core_struct));
168*3d8817e4Smiod   if (!core_hdr (abfd))
169*3d8817e4Smiod     return NULL;
170*3d8817e4Smiod 
171*3d8817e4Smiod   while (1)
172*3d8817e4Smiod     {
173*3d8817e4Smiod       int val;
174*3d8817e4Smiod       struct corehead core_header;
175*3d8817e4Smiod 
176*3d8817e4Smiod       val = bfd_bread ((void *) &core_header,
177*3d8817e4Smiod 		      (bfd_size_type) sizeof core_header, abfd);
178*3d8817e4Smiod       if (val <= 0)
179*3d8817e4Smiod 	break;
180*3d8817e4Smiod       switch (core_header.type)
181*3d8817e4Smiod 	{
182*3d8817e4Smiod 	case CORE_KERNEL:
183*3d8817e4Smiod 	case CORE_FORMAT:
184*3d8817e4Smiod 	  /* Just skip this.  */
185*3d8817e4Smiod 	  bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR);
186*3d8817e4Smiod           good_sections++;
187*3d8817e4Smiod 	  break;
188*3d8817e4Smiod 	case CORE_EXEC:
189*3d8817e4Smiod 	  {
190*3d8817e4Smiod 	    struct proc_exec proc_exec;
191*3d8817e4Smiod 	    if (bfd_bread ((void *) &proc_exec, (bfd_size_type) core_header.len,
192*3d8817e4Smiod 			  abfd) != core_header.len)
193*3d8817e4Smiod 	      break;
194*3d8817e4Smiod 	    strncpy (core_command (abfd), proc_exec.cmd, MAXCOMLEN + 1);
195*3d8817e4Smiod             good_sections++;
196*3d8817e4Smiod 	  }
197*3d8817e4Smiod 	  break;
198*3d8817e4Smiod 	case CORE_PROC:
199*3d8817e4Smiod 	  {
200*3d8817e4Smiod 	    struct proc_info proc_info;
201*3d8817e4Smiod 	    char  secname[100];  /* Of arbitrary size, but plenty large. */
202*3d8817e4Smiod 
203*3d8817e4Smiod             /* We need to read this section, 'cause we need to determine
204*3d8817e4Smiod                whether the core-dumped app was threaded before we create
205*3d8817e4Smiod                any .reg sections. */
206*3d8817e4Smiod 	    if (bfd_bread (&proc_info, (bfd_size_type) core_header.len, abfd)
207*3d8817e4Smiod 		!= core_header.len)
208*3d8817e4Smiod 	      break;
209*3d8817e4Smiod 
210*3d8817e4Smiod               /* However, we also want to create those sections with the
211*3d8817e4Smiod                  file positioned at the start of the record, it seems. */
212*3d8817e4Smiod             if (bfd_seek (abfd, -((file_ptr) core_header.len), SEEK_CUR) != 0)
213*3d8817e4Smiod               break;
214*3d8817e4Smiod 
215*3d8817e4Smiod #if defined(PROC_INFO_HAS_THREAD_ID)
216*3d8817e4Smiod             core_kernel_thread_id (abfd) = proc_info.lwpid;
217*3d8817e4Smiod             core_user_thread_id (abfd) = proc_info.user_tid;
218*3d8817e4Smiod #else
219*3d8817e4Smiod             core_kernel_thread_id (abfd) = 0;
220*3d8817e4Smiod             core_user_thread_id (abfd) = 0;
221*3d8817e4Smiod #endif
222*3d8817e4Smiod             /* If the program was unthreaded, then we'll just create a
223*3d8817e4Smiod                .reg section.
224*3d8817e4Smiod 
225*3d8817e4Smiod                If the program was threaded, then we'll create .reg/XXXXX
226*3d8817e4Smiod                section for each thread, where XXXXX is a printable
227*3d8817e4Smiod                representation of the kernel thread id.  We'll also
228*3d8817e4Smiod                create a .reg section for the thread that was running
229*3d8817e4Smiod                and signalled at the time of the core-dump (i.e., this
230*3d8817e4Smiod                is effectively an alias, needed to keep GDB happy.)
231*3d8817e4Smiod 
232*3d8817e4Smiod                Note that we use `.reg/XXXXX' as opposed to '.regXXXXX'
233*3d8817e4Smiod                because GDB expects that .reg2 will be the floating-
234*3d8817e4Smiod                point registers. */
235*3d8817e4Smiod             if (core_kernel_thread_id (abfd) == 0)
236*3d8817e4Smiod               {
237*3d8817e4Smiod                 if (!make_bfd_asection (abfd, ".reg",
238*3d8817e4Smiod 					SEC_HAS_CONTENTS,
239*3d8817e4Smiod 					core_header.len,
240*3d8817e4Smiod 					(bfd_vma) offsetof (struct proc_info,
241*3d8817e4Smiod 							    hw_regs),
242*3d8817e4Smiod 					2))
243*3d8817e4Smiod 		  goto fail;
244*3d8817e4Smiod               }
245*3d8817e4Smiod             else
246*3d8817e4Smiod               {
247*3d8817e4Smiod                 /* There are threads.  Is this the one that caused the
248*3d8817e4Smiod                    core-dump?  We'll claim it was the running thread. */
249*3d8817e4Smiod                 if (proc_info.sig != -1)
250*3d8817e4Smiod                   {
251*3d8817e4Smiod 		    if (!make_bfd_asection (abfd, ".reg",
252*3d8817e4Smiod 					    SEC_HAS_CONTENTS,
253*3d8817e4Smiod 					    core_header.len,
254*3d8817e4Smiod 					    (bfd_vma)offsetof (struct proc_info,
255*3d8817e4Smiod 							       hw_regs),
256*3d8817e4Smiod 					    2))
257*3d8817e4Smiod 		      goto fail;
258*3d8817e4Smiod                   }
259*3d8817e4Smiod                 /* We always make one of these sections, for every thread. */
260*3d8817e4Smiod                 sprintf (secname, ".reg/%d", core_kernel_thread_id (abfd));
261*3d8817e4Smiod                 if (!make_bfd_asection (abfd, secname,
262*3d8817e4Smiod 					SEC_HAS_CONTENTS,
263*3d8817e4Smiod 					core_header.len,
264*3d8817e4Smiod 					(bfd_vma) offsetof (struct proc_info,
265*3d8817e4Smiod 							    hw_regs),
266*3d8817e4Smiod 					2))
267*3d8817e4Smiod 		  goto fail;
268*3d8817e4Smiod               }
269*3d8817e4Smiod 	    core_signal (abfd) = proc_info.sig;
270*3d8817e4Smiod             if (bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR) != 0)
271*3d8817e4Smiod               break;
272*3d8817e4Smiod             good_sections++;
273*3d8817e4Smiod 	  }
274*3d8817e4Smiod 	  break;
275*3d8817e4Smiod 
276*3d8817e4Smiod 	case CORE_DATA:
277*3d8817e4Smiod 	case CORE_STACK:
278*3d8817e4Smiod 	case CORE_TEXT:
279*3d8817e4Smiod 	case CORE_MMF:
280*3d8817e4Smiod 	case CORE_SHM:
281*3d8817e4Smiod 	case CORE_ANON_SHMEM:
282*3d8817e4Smiod 	  if (!make_bfd_asection (abfd, ".data",
283*3d8817e4Smiod 				  SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS,
284*3d8817e4Smiod 				  core_header.len,
285*3d8817e4Smiod 				  (bfd_vma) core_header.addr, 2))
286*3d8817e4Smiod 	    goto fail;
287*3d8817e4Smiod 
288*3d8817e4Smiod 	  bfd_seek (abfd, (file_ptr) core_header.len, SEEK_CUR);
289*3d8817e4Smiod           good_sections++;
290*3d8817e4Smiod 	  break;
291*3d8817e4Smiod 
292*3d8817e4Smiod 	case CORE_NONE:
293*3d8817e4Smiod           /* Let's not punt if we encounter a section of unknown
294*3d8817e4Smiod              type.  Rather, let's make a note of it.  If we later
295*3d8817e4Smiod              see that there were also "good" sections, then we'll
296*3d8817e4Smiod              declare that this a core file, but we'll also warn that
297*3d8817e4Smiod              it may be incompatible with this gdb.
298*3d8817e4Smiod              */
299*3d8817e4Smiod 	  unknown_sections++;
300*3d8817e4Smiod           break;
301*3d8817e4Smiod 
302*3d8817e4Smiod          default:
303*3d8817e4Smiod 	   goto fail; /*unrecognized core file type */
304*3d8817e4Smiod 	}
305*3d8817e4Smiod     }
306*3d8817e4Smiod 
307*3d8817e4Smiod   /* OK, we believe you.  You're a core file (sure, sure).  */
308*3d8817e4Smiod 
309*3d8817e4Smiod   /* On HP/UX, we sometimes encounter core files where none of the threads
310*3d8817e4Smiod      was found to be the running thread (ie the signal was set to -1 for
311*3d8817e4Smiod      all threads).  This happens when the program was aborted externally
312*3d8817e4Smiod      via a TT_CORE ttrace system call.  In that case, we just pick one
313*3d8817e4Smiod      thread at random to be the active thread.  */
314*3d8817e4Smiod   if (core_kernel_thread_id (abfd) != 0
315*3d8817e4Smiod       && bfd_get_section_by_name (abfd, ".reg") == NULL)
316*3d8817e4Smiod     {
317*3d8817e4Smiod       asection *asect = bfd_sections_find_if (abfd, thread_section_p, NULL);
318*3d8817e4Smiod       asection *reg_sect;
319*3d8817e4Smiod 
320*3d8817e4Smiod       if (asect != NULL)
321*3d8817e4Smiod         {
322*3d8817e4Smiod           reg_sect = make_bfd_asection (abfd, ".reg", asect->flags,
323*3d8817e4Smiod                                         asect->size, asect->vma,
324*3d8817e4Smiod                                         asect->alignment_power);
325*3d8817e4Smiod           if (reg_sect == NULL)
326*3d8817e4Smiod             goto fail;
327*3d8817e4Smiod 
328*3d8817e4Smiod           reg_sect->filepos = asect->filepos;
329*3d8817e4Smiod         }
330*3d8817e4Smiod     }
331*3d8817e4Smiod 
332*3d8817e4Smiod   /* Were there sections of unknown type?  If so, yet there were
333*3d8817e4Smiod      at least some complete sections of known type, then, issue
334*3d8817e4Smiod      a warning.  Possibly the core file was generated on a version
335*3d8817e4Smiod      of HP-UX that is incompatible with that for which this gdb was
336*3d8817e4Smiod      built.
337*3d8817e4Smiod      */
338*3d8817e4Smiod   if ((unknown_sections > 0) && (good_sections > 0))
339*3d8817e4Smiod     (*_bfd_error_handler)
340*3d8817e4Smiod       ("%s appears to be a core file,\nbut contains unknown sections.  It may have been created on an incompatible\nversion of HP-UX.  As a result, some information may be unavailable.\n",
341*3d8817e4Smiod        abfd->filename);
342*3d8817e4Smiod 
343*3d8817e4Smiod   return abfd->xvec;
344*3d8817e4Smiod 
345*3d8817e4Smiod  fail:
346*3d8817e4Smiod   bfd_release (abfd, core_hdr (abfd));
347*3d8817e4Smiod   core_hdr (abfd) = NULL;
348*3d8817e4Smiod   bfd_section_list_clear (abfd);
349*3d8817e4Smiod   return NULL;
350*3d8817e4Smiod }
351*3d8817e4Smiod 
352*3d8817e4Smiod static char *
hpux_core_core_file_failing_command(bfd * abfd)353*3d8817e4Smiod hpux_core_core_file_failing_command (bfd *abfd)
354*3d8817e4Smiod {
355*3d8817e4Smiod   return core_command (abfd);
356*3d8817e4Smiod }
357*3d8817e4Smiod 
358*3d8817e4Smiod static int
hpux_core_core_file_failing_signal(bfd * abfd)359*3d8817e4Smiod hpux_core_core_file_failing_signal (bfd *abfd)
360*3d8817e4Smiod {
361*3d8817e4Smiod   return core_signal (abfd);
362*3d8817e4Smiod }
363*3d8817e4Smiod 
364*3d8817e4Smiod 
365*3d8817e4Smiod /* If somebody calls any byte-swapping routines, shoot them.  */
366*3d8817e4Smiod static void
swap_abort(void)367*3d8817e4Smiod swap_abort (void)
368*3d8817e4Smiod {
369*3d8817e4Smiod   abort(); /* This way doesn't require any declaration for ANSI to fuck up */
370*3d8817e4Smiod }
371*3d8817e4Smiod 
372*3d8817e4Smiod #define	NO_GET ((bfd_vma (*) (const void *)) swap_abort)
373*3d8817e4Smiod #define	NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
374*3d8817e4Smiod #define	NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
375*3d8817e4Smiod #define	NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
376*3d8817e4Smiod #define	NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
377*3d8817e4Smiod #define	NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
378*3d8817e4Smiod 
379*3d8817e4Smiod const bfd_target hpux_core_vec =
380*3d8817e4Smiod   {
381*3d8817e4Smiod     "hpux-core",
382*3d8817e4Smiod     bfd_target_unknown_flavour,
383*3d8817e4Smiod     BFD_ENDIAN_BIG,		/* target byte order */
384*3d8817e4Smiod     BFD_ENDIAN_BIG,		/* target headers byte order */
385*3d8817e4Smiod     (HAS_RELOC | EXEC_P |	/* object flags */
386*3d8817e4Smiod      HAS_LINENO | HAS_DEBUG |
387*3d8817e4Smiod      HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
388*3d8817e4Smiod     (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
389*3d8817e4Smiod     0,			                                   /* symbol prefix */
390*3d8817e4Smiod     ' ',						   /* ar_pad_char */
391*3d8817e4Smiod     16,							   /* ar_max_namelen */
392*3d8817e4Smiod     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit data */
393*3d8817e4Smiod     NO_GET, NO_GETS, NO_PUT,		/* 32 bit data */
394*3d8817e4Smiod     NO_GET, NO_GETS, NO_PUT,		/* 16 bit data */
395*3d8817e4Smiod     NO_GET64, NO_GETS64, NO_PUT64,	/* 64 bit hdrs */
396*3d8817e4Smiod     NO_GET, NO_GETS, NO_PUT,		/* 32 bit hdrs */
397*3d8817e4Smiod     NO_GET, NO_GETS, NO_PUT,		/* 16 bit hdrs */
398*3d8817e4Smiod 
399*3d8817e4Smiod     {				/* bfd_check_format */
400*3d8817e4Smiod       _bfd_dummy_target,		/* unknown format */
401*3d8817e4Smiod       _bfd_dummy_target,		/* object file */
402*3d8817e4Smiod       _bfd_dummy_target,		/* archive */
403*3d8817e4Smiod       hpux_core_core_file_p		/* a core file */
404*3d8817e4Smiod     },
405*3d8817e4Smiod     {				/* bfd_set_format */
406*3d8817e4Smiod       bfd_false, bfd_false,
407*3d8817e4Smiod       bfd_false, bfd_false
408*3d8817e4Smiod     },
409*3d8817e4Smiod     {				/* bfd_write_contents */
410*3d8817e4Smiod       bfd_false, bfd_false,
411*3d8817e4Smiod       bfd_false, bfd_false
412*3d8817e4Smiod     },
413*3d8817e4Smiod 
414*3d8817e4Smiod     BFD_JUMP_TABLE_GENERIC (_bfd_generic),
415*3d8817e4Smiod     BFD_JUMP_TABLE_COPY (_bfd_generic),
416*3d8817e4Smiod     BFD_JUMP_TABLE_CORE (hpux_core),
417*3d8817e4Smiod     BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
418*3d8817e4Smiod     BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols),
419*3d8817e4Smiod     BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
420*3d8817e4Smiod     BFD_JUMP_TABLE_WRITE (_bfd_generic),
421*3d8817e4Smiod     BFD_JUMP_TABLE_LINK (_bfd_nolink),
422*3d8817e4Smiod     BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
423*3d8817e4Smiod 
424*3d8817e4Smiod     NULL,
425*3d8817e4Smiod 
426*3d8817e4Smiod     (PTR) 0			/* backend_data */
427*3d8817e4Smiod   };
428