OSDN Git Service

Update copyright notices
[pf3gnuchains/pf3gnuchains3x.git] / bfd / versados.c
1 /* BFD back-end for VERSAdos-E objects.
2    Copyright 1995, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
3    Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
4
5    Versados is a Motorola trademark.
6
7    This file is part of BFD, the Binary File Descriptor library.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
22
23 /*
24    SUBSECTION
25    VERSAdos-E relocateable object file format
26
27    DESCRIPTION
28
29    This module supports reading of VERSAdos relocateable
30    object files.
31
32    A VERSAdos file looks like contains
33
34    o Indentification Record
35    o External Symbol Definition Record
36    o Object Text Recrod
37    o End Record
38
39  */
40
41 #include "bfd.h"
42 #include "sysdep.h"
43 #include "libbfd.h"
44 #include "libiberty.h"
45
46 static boolean versados_mkobject PARAMS ((bfd *));
47 static boolean versados_scan PARAMS ((bfd *));
48 static const bfd_target *versados_object_p PARAMS ((bfd *));
49
50 #define VHEADER '1'
51 #define VESTDEF '2'
52 #define VOTR '3'
53 #define VEND '4'
54
55 #define ES_BASE 17              /* first symbol has esdid 17 */
56
57 /* Per file target dependent information */
58
59 /* one for each section */
60 struct esdid
61   {
62     asection *section;          /* ptr to bfd version */
63     unsigned char *contents;    /* used to build image */
64     int pc;
65     int relocs;                 /* reloc count, valid end of pass 1 */
66     int donerel;                /* have relocs been translated */
67   };
68
69 typedef struct versados_data_struct
70   {
71     int es_done;                /* count of symbol index, starts at ES_BASE */
72     asymbol *symbols;           /* pointer to local symbols */
73     char *strings;              /* strings of all the above */
74     int stringlen;              /* len of string table (valid end of pass1) */
75     int nsecsyms;               /* number of sections */
76
77     int ndefs;                  /* number of exported symbols (they dont get esdids) */
78     int nrefs;                  /* number of imported symbols  (valid end of pass1) */
79
80     int ref_idx;                /* current processed value of the above */
81     int def_idx;
82
83     int pass_2_done;
84
85     struct esdid e[16];         /* per section info */
86     int alert;                  /* to see if we're trampling */
87     asymbol *rest[256 - 16];    /* per symbol info */
88
89   }
90 tdata_type;
91
92 #define VDATA(abfd)       (abfd->tdata.versados_data)
93 #define EDATA(abfd, n)    (abfd->tdata.versados_data->e[n])
94 #define RDATA(abfd, n)    (abfd->tdata.versados_data->rest[n])
95
96 struct ext_otr
97   {
98     unsigned char size;
99     char type;
100     unsigned char map[4];
101     unsigned char esdid;
102     unsigned char data[200];
103   };
104
105 struct ext_vheader
106   {
107     unsigned char size;
108     char type;                  /* record type */
109     char name[10];              /* module name */
110     char rev;                   /* module rev number */
111     char lang;
112     char vol[4];
113     char user[2];
114     char cat[8];
115     char fname[8];
116     char ext[2];
117     char time[3];
118     char date[3];
119     char rest[211];
120   };
121
122 struct ext_esd
123   {
124     unsigned char size;
125     char type;
126     unsigned char esd_entries[1];
127   };
128 #define ESD_ABS         0
129 #define ESD_COMMON      1
130 #define ESD_STD_REL_SEC 2
131 #define ESD_SHRT_REL_SEC 3
132 #define ESD_XDEF_IN_SEC 4
133 #define ESD_XREF_SYM    7
134 #define ESD_XREF_SEC    6
135 #define ESD_XDEF_IN_ABS 5
136 union ext_any
137   {
138     unsigned char size;
139     struct ext_vheader header;
140     struct ext_esd esd;
141     struct ext_otr otr;
142   };
143
144 /* Initialize by filling in the hex conversion array.  */
145
146 /* Set up the tdata information.  */
147
148 static boolean
149 versados_mkobject (abfd)
150      bfd *abfd;
151 {
152   if (abfd->tdata.versados_data == NULL)
153     {
154       tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
155       if (tdata == NULL)
156         return false;
157       abfd->tdata.versados_data = tdata;
158       tdata->symbols = NULL;
159       VDATA (abfd)->alert = 0x12345678;
160     }
161
162   bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0);
163   return true;
164 }
165
166 /* Report a problem in an S record file.  FIXME: This probably should
167    not call fprintf, but we really do need some mechanism for printing
168    error messages.  */
169
170 static asymbol *
171 versados_new_symbol (abfd, snum, name, val, sec)
172      bfd *abfd;
173      int snum;
174      const char *name;
175      bfd_vma val;
176      asection *sec;
177 {
178   asymbol *n = VDATA (abfd)->symbols + snum;
179   n->name = name;
180   n->value = val;
181   n->section = sec;
182   n->the_bfd = abfd;
183   n->flags = 0;
184   return n;
185 }
186
187 static int
188 get_record (abfd, ptr)
189      bfd *abfd;
190      union ext_any *ptr;
191 {
192   bfd_read (&ptr->size, 1, 1, abfd);
193   if (bfd_read ((char *) ptr + 1, 1, ptr->size, abfd) != ptr->size)
194     return 0;
195   return 1;
196 }
197
198 int
199 get_4 (pp)
200      unsigned char **pp;
201 {
202   unsigned char *p = *pp;
203   *pp += 4;
204   return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0);
205 }
206
207 void
208 get_10 (pp, name)
209      unsigned char **pp;
210      char *name;
211 {
212   char *p = (char *) *pp;
213   int len = 10;
214   *pp += len;
215   while (*p != ' '
216          && len)
217     {
218       *name++ = *p++;
219       len--;
220     }
221   *name = 0;
222 }
223
224 static char *
225 new_symbol_string (abfd, name)
226      bfd *abfd;
227      char *name;
228 {
229   char *n = VDATA (abfd)->strings;
230   strcpy (VDATA (abfd)->strings, name);
231   VDATA (abfd)->strings += strlen (VDATA (abfd)->strings) + 1;
232   return n;
233 }
234
235 static void
236 process_esd (abfd, esd, pass)
237      bfd *abfd;
238      struct ext_esd *esd;
239      int pass;
240 {
241   /* Read through the ext def for the est entries */
242   int togo = esd->size - 2;
243   bfd_vma size;
244   bfd_vma start;
245   asection *sec;
246   char name[11];
247   unsigned char *ptr = esd->esd_entries;
248   unsigned char *end = ptr + togo;
249   while (ptr < end)
250     {
251       int scn = *ptr & 0xf;
252       int typ = (*ptr >> 4) & 0xf;
253
254       /* Declare this section */
255       sprintf (name, "%d", scn);
256       sec = bfd_make_section_old_way (abfd, strdup (name));
257       sec->target_index = scn;
258       EDATA (abfd, scn).section = sec;
259       ptr++;
260       switch (typ)
261         {
262         default:
263           abort ();
264         case ESD_XREF_SEC:
265         case ESD_XREF_SYM:
266           {
267             int snum = VDATA (abfd)->ref_idx++;
268             get_10 (&ptr, name);
269             if (pass == 1)
270               {
271                 VDATA (abfd)->stringlen += strlen (name) + 1;
272               }
273             else
274               {
275                 int esidx;
276                 asymbol *s;
277                 char *n = new_symbol_string (abfd, name);
278                 s = versados_new_symbol (abfd, snum, n, 0,
279                                          &bfd_und_section, scn);
280                 esidx = VDATA (abfd)->es_done++;
281                 RDATA (abfd, esidx - ES_BASE) = s;
282               }
283           }
284           break;
285
286         case ESD_ABS:
287           size = get_4 (&ptr);
288           start = get_4 (&ptr);
289           break;
290         case ESD_STD_REL_SEC:
291         case ESD_SHRT_REL_SEC:
292           {
293             sec->_raw_size = get_4 (&ptr);
294             sec->flags |= SEC_ALLOC;
295           }
296           break;
297         case ESD_XDEF_IN_ABS:
298           sec = (asection *) & bfd_abs_section;
299         case ESD_XDEF_IN_SEC:
300           {
301             int snum = VDATA (abfd)->def_idx++;
302             long val;
303             get_10 (&ptr, name);
304             val = get_4 (&ptr);
305             if (pass == 1)
306               {
307                 /* Just remember the symbol */
308                 VDATA (abfd)->stringlen += strlen (name) + 1;
309               }
310             else
311               {
312                 asymbol *s;
313                 char *n = new_symbol_string (abfd, name);
314                 s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n, val, sec, scn);
315                 s->flags |= BSF_GLOBAL;
316               }
317           }
318           break;
319         }
320     }
321 }
322
323 #define R_RELWORD 1
324 #define R_RELLONG 2
325 #define R_RELWORD_NEG 3
326 #define R_RELLONG_NEG 4
327
328 reloc_howto_type versados_howto_table[] =
329 {
330   HOWTO (R_RELWORD, 0, 1, 16, false,
331          0, complain_overflow_dont, 0,
332          "+v16", true, 0x0000ffff, 0x0000ffff, false),
333   HOWTO (R_RELLONG, 0, 2, 32, false,
334          0, complain_overflow_dont, 0,
335          "+v32", true, 0xffffffff, 0xffffffff, false),
336
337   HOWTO (R_RELWORD_NEG, 0, -1, 16, false,
338          0, complain_overflow_dont, 0,
339          "-v16", true, 0x0000ffff, 0x0000ffff, false),
340   HOWTO (R_RELLONG_NEG, 0, -2, 32, false,
341          0, complain_overflow_dont, 0,
342          "-v32", true, 0xffffffff, 0xffffffff, false),
343 };
344
345 static int
346 get_offset (len, ptr)
347      int len;
348      unsigned char *ptr;
349 {
350   int val = 0;
351   if (len)
352     {
353       int i;
354       val = *ptr++;
355       if (val & 0x80)
356         val |= ~0xff;
357       for (i = 1; i < len; i++)
358         val = (val << 8) | *ptr++;
359     }
360
361   return val;
362 }
363
364 static void
365 process_otr (abfd, otr, pass)
366      bfd *abfd;
367      struct ext_otr *otr;
368      int pass;
369 {
370   unsigned long shift;
371   unsigned char *srcp = otr->data;
372   unsigned char *endp = (unsigned char *) otr + otr->size;
373   unsigned int bits = (otr->map[0] << 24)
374   | (otr->map[1] << 16)
375   | (otr->map[2] << 8)
376   | (otr->map[3] << 0);
377
378   struct esdid *esdid = &EDATA (abfd, otr->esdid - 1);
379   unsigned char *contents = esdid->contents;
380   int need_contents = 0;
381   unsigned int dst_idx = esdid->pc;
382
383   for (shift = (1 << 31); shift && srcp < endp; shift >>= 1)
384     {
385       if (bits & shift)
386         {
387           int flag = *srcp++;
388           int esdids = (flag >> 5) & 0x7;
389           int sizeinwords = ((flag >> 3) & 1) ? 2 : 1;
390           int offsetlen = flag & 0x7;
391           int j;
392
393           if (esdids == 0)
394             {
395               /* A zero esdid means the new pc is the offset given */
396               dst_idx += get_offset (offsetlen, srcp);
397               srcp += offsetlen;
398             }
399           else
400             {
401               int val = get_offset (offsetlen, srcp + esdids);
402               if (pass == 1)
403                 need_contents = 1;
404               else
405                 for (j = 0; j < sizeinwords * 2; j++)
406                   {
407                     contents[dst_idx + (sizeinwords * 2) - j - 1] = val;
408                     val >>= 8;
409                   }
410
411               for (j = 0; j < esdids; j++)
412                 {
413                   int esdid = *srcp++;
414
415                   if (esdid)
416                     {
417                       int rn = EDATA (abfd, otr->esdid - 1).relocs++;
418                       if (pass == 1)
419                         {
420                           /* this is the first pass over the data,
421                              just remember that we need a reloc */
422                         }
423                       else
424                         {
425                           arelent *n =
426                           EDATA (abfd, otr->esdid - 1).section->relocation + rn;
427                           n->address = dst_idx;
428
429                           n->sym_ptr_ptr = (asymbol **) esdid;
430                           n->addend = 0;
431                           n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1);
432                         }
433                     }
434                 }
435               srcp += offsetlen;
436               dst_idx += sizeinwords * 2;
437             }
438         }
439       else
440         {
441           need_contents = 1;
442           if (dst_idx < esdid->section->_raw_size)
443             if (pass == 2)
444               {
445                 /* absolute code, comes in 16 bit lumps */
446                 contents[dst_idx] = srcp[0];
447                 contents[dst_idx + 1] = srcp[1];
448               }
449           dst_idx += 2;
450           srcp += 2;
451         }
452     }
453   EDATA (abfd, otr->esdid - 1).pc = dst_idx;
454
455   if (!contents && need_contents)
456     esdid->contents = (unsigned char *) bfd_alloc (abfd, esdid->section->_raw_size);
457
458 }
459
460 static boolean
461 versados_scan (abfd)
462      bfd *abfd;
463 {
464   int loop = 1;
465   int i;
466   int j;
467   int nsecs = 0;
468
469   VDATA (abfd)->stringlen = 0;
470   VDATA (abfd)->nrefs = 0;
471   VDATA (abfd)->ndefs = 0;
472   VDATA (abfd)->ref_idx = 0;
473   VDATA (abfd)->def_idx = 0;
474   VDATA (abfd)->pass_2_done = 0;
475
476   while (loop)
477     {
478       union ext_any any;
479       if (!get_record (abfd, &any))
480         return true;
481       switch (any.header.type)
482         {
483         case VHEADER:
484           break;
485         case VEND:
486           loop = 0;
487           break;
488         case VESTDEF:
489           process_esd (abfd, &any.esd, 1);
490           break;
491         case VOTR:
492           process_otr (abfd, &any.otr, 1);
493           break;
494         }
495     }
496
497   /* Now allocate space for the relocs and sections */
498
499   VDATA (abfd)->nrefs = VDATA (abfd)->ref_idx;
500   VDATA (abfd)->ndefs = VDATA (abfd)->def_idx;
501   VDATA (abfd)->ref_idx = 0;
502   VDATA (abfd)->def_idx = 0;
503
504   abfd->symcount = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs;
505
506   for (i = 0; i < 16; i++)
507     {
508       struct esdid *esdid = &EDATA (abfd, i);
509       if (esdid->section)
510         {
511           esdid->section->relocation
512             = (arelent *) bfd_alloc (abfd, sizeof (arelent) * esdid->relocs);
513
514           esdid->pc = 0;
515
516           if (esdid->contents)
517             esdid->section->flags |= SEC_HAS_CONTENTS | SEC_LOAD;
518
519           esdid->section->reloc_count = esdid->relocs;
520           if (esdid->relocs)
521             esdid->section->flags |= SEC_RELOC;
522
523           esdid->relocs = 0;
524
525           /* Add an entry into the symbol table for it */
526           nsecs++;
527           VDATA (abfd)->stringlen += strlen (esdid->section->name) + 1;
528         }
529     }
530
531   abfd->symcount += nsecs;
532
533   VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd,
534                                        sizeof (asymbol) * (abfd->symcount));
535
536   VDATA (abfd)->strings = bfd_alloc (abfd, VDATA (abfd)->stringlen);
537
538   if ((VDATA (abfd)->symbols == NULL && abfd->symcount > 0)
539       || (VDATA (abfd)->strings == NULL && VDATA (abfd)->stringlen > 0))
540     return false;
541
542   /* Actually fill in the section symbols,
543      we stick them at the end of the table */
544
545   for (j = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs, i = 0; i < 16; i++)
546     {
547       struct esdid *esdid = &EDATA (abfd, i);
548       asection *sec = esdid->section;
549       if (sec)
550         {
551           asymbol *s = VDATA (abfd)->symbols + j;
552           s->name = new_symbol_string (abfd, sec->name);
553           s->section = sec;
554           s->flags = BSF_LOCAL;
555           s->value = 0;
556           s->the_bfd = abfd;
557           j++;
558         }
559     }
560   if (abfd->symcount)
561     abfd->flags |= HAS_SYMS;
562
563   /* Set this to nsecs - since we've already planted the section
564      symbols */
565   VDATA (abfd)->nsecsyms = nsecs;
566
567   VDATA (abfd)->ref_idx = 0;
568
569   return 1;
570 }
571
572 /* Check whether an existing file is a versados  file.  */
573
574 static const bfd_target *
575 versados_object_p (abfd)
576      bfd *abfd;
577 {
578   struct ext_vheader ext;
579   unsigned char len;
580
581   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
582     return NULL;
583
584   if (bfd_read (&len, 1, 1, abfd) != 1)
585     {
586       if (bfd_get_error () != bfd_error_system_call)
587         bfd_set_error (bfd_error_wrong_format);
588       return NULL;
589     }
590
591   if (bfd_read (&ext.type, 1, len, abfd) != len)
592     {
593       if (bfd_get_error () != bfd_error_system_call)
594         bfd_set_error (bfd_error_wrong_format);
595       return NULL;
596     }
597
598   /* We guess that the language field will never be larger than 10.
599      In sample files, it is always either 0 or 1.  Checking for this
600      prevents confusion with Intel Hex files.  */
601   if (ext.type != VHEADER
602       || ext.lang > 10)
603     {
604       bfd_set_error (bfd_error_wrong_format);
605       return NULL;
606     }
607
608   /* OK, looks like a record, build the tdata and read in.  */
609
610   if (!versados_mkobject (abfd)
611       || !versados_scan (abfd))
612     return NULL;
613
614   return abfd->xvec;
615 }
616
617 static boolean
618 versados_pass_2 (abfd)
619      bfd *abfd;
620 {
621   union ext_any any;
622
623   if (VDATA (abfd)->pass_2_done)
624     return 1;
625
626   if (bfd_seek (abfd, 0, SEEK_SET) != 0)
627     return 0;
628
629   VDATA (abfd)->es_done = ES_BASE;
630
631   /* read records till we get to where we want to be */
632
633   while (1)
634     {
635       get_record (abfd, &any);
636       switch (any.header.type)
637         {
638         case VEND:
639           VDATA (abfd)->pass_2_done = 1;
640           return 1;
641         case VESTDEF:
642           process_esd (abfd, &any.esd, 2);
643           break;
644         case VOTR:
645           process_otr (abfd, &any.otr, 2);
646           break;
647         }
648     }
649 }
650
651 static boolean
652 versados_get_section_contents (abfd, section, location, offset, count)
653      bfd *abfd;
654      asection *section;
655      PTR location;
656      file_ptr offset;
657      bfd_size_type count;
658 {
659   if (!versados_pass_2 (abfd))
660     return false;
661
662   memcpy (location,
663           EDATA (abfd, section->target_index).contents + offset,
664           (size_t) count);
665
666   return true;
667 }
668
669 #define versados_get_section_contents_in_window \
670   _bfd_generic_get_section_contents_in_window
671
672 static boolean
673 versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
674      bfd *abfd ATTRIBUTE_UNUSED;
675      sec_ptr section ATTRIBUTE_UNUSED;
676      PTR location ATTRIBUTE_UNUSED;
677      file_ptr offset ATTRIBUTE_UNUSED;
678      bfd_size_type bytes_to_do ATTRIBUTE_UNUSED;
679 {
680   return false;
681 }
682
683 static int
684 versados_sizeof_headers (abfd, exec)
685      bfd *abfd ATTRIBUTE_UNUSED;
686      boolean exec ATTRIBUTE_UNUSED;
687 {
688   return 0;
689 }
690
691 static asymbol *
692 versados_make_empty_symbol (abfd)
693      bfd *abfd;
694 {
695   asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
696   if (new)
697     new->the_bfd = abfd;
698   return new;
699 }
700
701 /* Return the amount of memory needed to read the symbol table.  */
702
703 static long
704 versados_get_symtab_upper_bound (abfd)
705      bfd *abfd;
706 {
707   return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
708 }
709
710 /* Return the symbol table.  */
711
712 static long
713 versados_get_symtab (abfd, alocation)
714      bfd *abfd;
715      asymbol **alocation;
716 {
717   unsigned int symcount = bfd_get_symcount (abfd);
718   unsigned int i;
719   asymbol *s;
720
721   versados_pass_2 (abfd);
722
723   for (i = 0, s = VDATA (abfd)->symbols;
724        i < symcount;
725        s++, i++)
726     {
727       *alocation++ = s;
728     }
729
730   *alocation = NULL;
731
732   return symcount;
733 }
734
735 void
736 versados_get_symbol_info (ignore_abfd, symbol, ret)
737      bfd *ignore_abfd ATTRIBUTE_UNUSED;
738      asymbol *symbol;
739      symbol_info *ret;
740 {
741   bfd_symbol_info (symbol, ret);
742 }
743
744 void
745 versados_print_symbol (ignore_abfd, afile, symbol, how)
746      bfd *ignore_abfd ATTRIBUTE_UNUSED;
747      PTR afile;
748      asymbol *symbol;
749      bfd_print_symbol_type how;
750 {
751   FILE *file = (FILE *) afile;
752   switch (how)
753     {
754     case bfd_print_symbol_name:
755       fprintf (file, "%s", symbol->name);
756       break;
757     default:
758       bfd_print_symbol_vandf ((PTR) file, symbol);
759       fprintf (file, " %-5s %s",
760                symbol->section->name,
761                symbol->name);
762
763     }
764 }
765
766 long
767 versados_get_reloc_upper_bound (abfd, asect)
768      bfd *abfd ATTRIBUTE_UNUSED;
769      sec_ptr asect;
770 {
771   return (asect->reloc_count + 1) * sizeof (arelent *);
772 }
773
774 long
775 versados_canonicalize_reloc (abfd, section, relptr, symbols)
776      bfd *abfd;
777      sec_ptr section;
778      arelent **relptr;
779      asymbol **symbols;
780 {
781   unsigned int count;
782   arelent *src;
783
784   versados_pass_2 (abfd);
785   src = section->relocation;
786   if (!EDATA (abfd, section->target_index).donerel)
787     {
788       EDATA (abfd, section->target_index).donerel = 1;
789       /* translate from indexes to symptr ptrs */
790       for (count = 0; count < section->reloc_count; count++)
791         {
792           int esdid = (int) src[count].sym_ptr_ptr;
793
794           if (esdid == 0)
795             {
796               src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
797             }
798           else if (esdid < ES_BASE)     /* Section relative thing */
799             {
800               struct esdid *e = &EDATA (abfd, esdid - 1);
801               if (!section)
802                 {
803                  /** relocation relative to section which was
804                    never declared ! */
805                 }
806               src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr;
807             }
808           else
809             {
810               src[count].sym_ptr_ptr = symbols + esdid - ES_BASE;
811             }
812
813         }
814     }
815
816   for (count = 0; count < section->reloc_count; count++)
817     {
818       *relptr++ = src++;
819     }
820   *relptr = 0;
821   return section->reloc_count;
822 }
823
824 #define versados_close_and_cleanup _bfd_generic_close_and_cleanup
825 #define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
826 #define versados_new_section_hook _bfd_generic_new_section_hook
827
828 #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name
829 #define versados_get_lineno _bfd_nosymbols_get_lineno
830 #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line
831 #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
832 #define versados_read_minisymbols _bfd_generic_read_minisymbols
833 #define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
834
835 #define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
836
837 #define versados_set_arch_mach bfd_default_set_arch_mach
838
839 #define versados_bfd_get_relocated_section_contents \
840   bfd_generic_get_relocated_section_contents
841 #define versados_bfd_relax_section bfd_generic_relax_section
842 #define versados_bfd_gc_sections bfd_generic_gc_sections
843 #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
844 #define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
845 #define versados_bfd_final_link _bfd_generic_final_link
846 #define versados_bfd_link_split_section _bfd_generic_link_split_section
847
848 const bfd_target versados_vec =
849 {
850   "versados",                   /* name */
851   bfd_target_versados_flavour,
852   BFD_ENDIAN_BIG,               /* target byte order */
853   BFD_ENDIAN_BIG,               /* target headers byte order */
854   (HAS_RELOC | EXEC_P |         /* object flags */
855    HAS_LINENO | HAS_DEBUG |
856    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
857   (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
858    | SEC_ALLOC | SEC_LOAD | SEC_RELOC),         /* section flags */
859   0,                            /* leading underscore */
860   ' ',                          /* ar_pad_char */
861   16,                           /* ar_max_namelen */
862   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
863   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
864   bfd_getb16, bfd_getb_signed_16, bfd_putb16,   /* data */
865   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
866   bfd_getb32, bfd_getb_signed_32, bfd_putb32,
867   bfd_getb16, bfd_getb_signed_16, bfd_putb16,   /* hdrs */
868
869   {
870     _bfd_dummy_target,
871     versados_object_p,          /* bfd_check_format */
872     _bfd_dummy_target,
873     _bfd_dummy_target,
874   },
875   {
876     bfd_false,
877     versados_mkobject,
878     _bfd_generic_mkarchive,
879     bfd_false,
880   },
881   {                             /* bfd_write_contents */
882     bfd_false,
883     bfd_false,
884     _bfd_write_archive_contents,
885     bfd_false,
886   },
887
888   BFD_JUMP_TABLE_GENERIC (versados),
889   BFD_JUMP_TABLE_COPY (_bfd_generic),
890   BFD_JUMP_TABLE_CORE (_bfd_nocore),
891   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
892   BFD_JUMP_TABLE_SYMBOLS (versados),
893   BFD_JUMP_TABLE_RELOCS (versados),
894   BFD_JUMP_TABLE_WRITE (versados),
895   BFD_JUMP_TABLE_LINK (versados),
896   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
897
898   NULL,
899
900   (PTR) 0
901 };