00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #include "bfd.h"
00047 #include "sysdep.h"
00048 #include "libbfd.h"
00049 #include "libiberty.h"
00050
00051 static bfd_boolean versados_mkobject PARAMS ((bfd *));
00052 static bfd_boolean versados_scan PARAMS ((bfd *));
00053 static const bfd_target *versados_object_p PARAMS ((bfd *));
00054 static asymbol *versados_new_symbol
00055 PARAMS ((bfd *, int, const char *, bfd_vma, asection *));
00056 static char *new_symbol_string PARAMS ((bfd *, const char *));
00057 static const bfd_target *versados_object_p PARAMS ((bfd *));
00058 static bfd_boolean versados_pass_2 PARAMS ((bfd *));
00059 static bfd_boolean versados_get_section_contents
00060 PARAMS ((bfd *, asection *, void *, file_ptr, bfd_size_type));
00061 static bfd_boolean versados_set_section_contents
00062 PARAMS ((bfd *, sec_ptr, const void *, file_ptr, bfd_size_type));
00063 static int versados_sizeof_headers PARAMS ((bfd *, bfd_boolean));
00064 static long int versados_get_symtab_upper_bound PARAMS ((bfd *));
00065 static long int versados_canonicalize_symtab PARAMS ((bfd *, asymbol **));
00066 static void versados_get_symbol_info
00067 PARAMS ((bfd *, asymbol *, symbol_info *));
00068 static void versados_print_symbol
00069 PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
00070 static long versados_get_reloc_upper_bound
00071 PARAMS ((bfd *, sec_ptr));
00072 static long versados_canonicalize_reloc
00073 PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
00074
00075 #define VHEADER '1'
00076 #define VESTDEF '2'
00077 #define VOTR '3'
00078 #define VEND '4'
00079
00080 #define ES_BASE 17
00081
00082
00083
00084
00085 struct esdid
00086 {
00087 asection *section;
00088 unsigned char *contents;
00089 int pc;
00090 int relocs;
00091 int donerel;
00092 };
00093
00094 typedef struct versados_data_struct
00095 {
00096 int es_done;
00097 asymbol *symbols;
00098 char *strings;
00099 int stringlen;
00100 int nsecsyms;
00101
00102 int ndefs;
00103 int nrefs;
00104
00105 int ref_idx;
00106 int def_idx;
00107
00108 int pass_2_done;
00109
00110 struct esdid e[16];
00111 int alert;
00112 asymbol *rest[256 - 16];
00113
00114 }
00115 tdata_type;
00116
00117 #define VDATA(abfd) (abfd->tdata.versados_data)
00118 #define EDATA(abfd, n) (abfd->tdata.versados_data->e[n])
00119 #define RDATA(abfd, n) (abfd->tdata.versados_data->rest[n])
00120
00121 struct ext_otr
00122 {
00123 unsigned char size;
00124 char type;
00125 unsigned char map[4];
00126 unsigned char esdid;
00127 unsigned char data[200];
00128 };
00129
00130 struct ext_vheader
00131 {
00132 unsigned char size;
00133 char type;
00134 char name[10];
00135 char rev;
00136 char lang;
00137 char vol[4];
00138 char user[2];
00139 char cat[8];
00140 char fname[8];
00141 char ext[2];
00142 char time[3];
00143 char date[3];
00144 char rest[211];
00145 };
00146
00147 struct ext_esd
00148 {
00149 unsigned char size;
00150 char type;
00151 unsigned char esd_entries[1];
00152 };
00153 #define ESD_ABS 0
00154 #define ESD_COMMON 1
00155 #define ESD_STD_REL_SEC 2
00156 #define ESD_SHRT_REL_SEC 3
00157 #define ESD_XDEF_IN_SEC 4
00158 #define ESD_XREF_SYM 7
00159 #define ESD_XREF_SEC 6
00160 #define ESD_XDEF_IN_ABS 5
00161 union ext_any
00162 {
00163 unsigned char size;
00164 struct ext_vheader header;
00165 struct ext_esd esd;
00166 struct ext_otr otr;
00167 };
00168
00169 static int get_record PARAMS ((bfd *, union ext_any *));
00170 static int get_4 PARAMS ((unsigned char **));
00171 static void get_10 PARAMS ((unsigned char **, char *));
00172 static void process_esd PARAMS ((bfd *, struct ext_esd *, int));
00173 static int get_offset PARAMS ((int, unsigned char *));
00174 static void process_otr PARAMS ((bfd *, struct ext_otr *, int));
00175
00176
00177
00178
00179
00180 static bfd_boolean
00181 versados_mkobject (abfd)
00182 bfd *abfd;
00183 {
00184 if (abfd->tdata.versados_data == NULL)
00185 {
00186 bfd_size_type amt = sizeof (tdata_type);
00187 tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, amt);
00188 if (tdata == NULL)
00189 return FALSE;
00190 abfd->tdata.versados_data = tdata;
00191 tdata->symbols = NULL;
00192 VDATA (abfd)->alert = 0x12345678;
00193 }
00194
00195 bfd_default_set_arch_mach (abfd, bfd_arch_m68k, 0);
00196 return TRUE;
00197 }
00198
00199
00200
00201
00202
00203 static asymbol *
00204 versados_new_symbol (abfd, snum, name, val, sec)
00205 bfd *abfd;
00206 int snum;
00207 const char *name;
00208 bfd_vma val;
00209 asection *sec;
00210 {
00211 asymbol *n = VDATA (abfd)->symbols + snum;
00212 n->name = name;
00213 n->value = val;
00214 n->section = sec;
00215 n->the_bfd = abfd;
00216 n->flags = 0;
00217 return n;
00218 }
00219
00220 static int
00221 get_record (abfd, ptr)
00222 bfd *abfd;
00223 union ext_any *ptr;
00224 {
00225 if (bfd_bread (&ptr->size, (bfd_size_type) 1, abfd) != 1
00226 || (bfd_bread ((char *) ptr + 1, (bfd_size_type) ptr->size, abfd)
00227 != ptr->size))
00228 return 0;
00229 return 1;
00230 }
00231
00232 static int
00233 get_4 (pp)
00234 unsigned char **pp;
00235 {
00236 unsigned char *p = *pp;
00237 *pp += 4;
00238 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | (p[3] << 0);
00239 }
00240
00241 static void
00242 get_10 (pp, name)
00243 unsigned char **pp;
00244 char *name;
00245 {
00246 char *p = (char *) *pp;
00247 int len = 10;
00248 *pp += len;
00249 while (*p != ' '
00250 && len)
00251 {
00252 *name++ = *p++;
00253 len--;
00254 }
00255 *name = 0;
00256 }
00257
00258 static char *
00259 new_symbol_string (abfd, name)
00260 bfd *abfd;
00261 const char *name;
00262 {
00263 char *n = VDATA (abfd)->strings;
00264 strcpy (VDATA (abfd)->strings, name);
00265 VDATA (abfd)->strings += strlen (VDATA (abfd)->strings) + 1;
00266 return n;
00267 }
00268
00269 static void
00270 process_esd (abfd, esd, pass)
00271 bfd *abfd;
00272 struct ext_esd *esd;
00273 int pass;
00274 {
00275
00276 int togo = esd->size - 2;
00277 bfd_vma size;
00278 bfd_vma start;
00279 asection *sec;
00280 char name[11];
00281 unsigned char *ptr = esd->esd_entries;
00282 unsigned char *end = ptr + togo;
00283 while (ptr < end)
00284 {
00285 int scn = *ptr & 0xf;
00286 int typ = (*ptr >> 4) & 0xf;
00287
00288
00289 sprintf (name, "%d", scn);
00290 sec = bfd_make_section_old_way (abfd, strdup (name));
00291 sec->target_index = scn;
00292 EDATA (abfd, scn).section = sec;
00293 ptr++;
00294 switch (typ)
00295 {
00296 default:
00297 abort ();
00298 case ESD_XREF_SEC:
00299 case ESD_XREF_SYM:
00300 {
00301 int snum = VDATA (abfd)->ref_idx++;
00302 get_10 (&ptr, name);
00303 if (pass == 1)
00304 {
00305 VDATA (abfd)->stringlen += strlen (name) + 1;
00306 }
00307 else
00308 {
00309 int esidx;
00310 asymbol *s;
00311 char *n = new_symbol_string (abfd, name);
00312 s = versados_new_symbol (abfd, snum, n, (bfd_vma) 0,
00313 bfd_und_section_ptr);
00314 esidx = VDATA (abfd)->es_done++;
00315 RDATA (abfd, esidx - ES_BASE) = s;
00316 }
00317 }
00318 break;
00319
00320 case ESD_ABS:
00321 size = get_4 (&ptr);
00322 start = get_4 (&ptr);
00323 break;
00324 case ESD_STD_REL_SEC:
00325 case ESD_SHRT_REL_SEC:
00326 {
00327 sec->size = get_4 (&ptr);
00328 sec->flags |= SEC_ALLOC;
00329 }
00330 break;
00331 case ESD_XDEF_IN_ABS:
00332 sec = (asection *) & bfd_abs_section;
00333 case ESD_XDEF_IN_SEC:
00334 {
00335 int snum = VDATA (abfd)->def_idx++;
00336 bfd_vma val;
00337 get_10 (&ptr, name);
00338 val = get_4 (&ptr);
00339 if (pass == 1)
00340 {
00341
00342 VDATA (abfd)->stringlen += strlen (name) + 1;
00343 }
00344 else
00345 {
00346 asymbol *s;
00347 char *n = new_symbol_string (abfd, name);
00348 s = versados_new_symbol (abfd, snum + VDATA (abfd)->nrefs, n,
00349 val, sec);
00350 s->flags |= BSF_GLOBAL;
00351 }
00352 }
00353 break;
00354 }
00355 }
00356 }
00357
00358 #define R_RELWORD 1
00359 #define R_RELLONG 2
00360 #define R_RELWORD_NEG 3
00361 #define R_RELLONG_NEG 4
00362
00363 reloc_howto_type versados_howto_table[] =
00364 {
00365 HOWTO (R_RELWORD, 0, 1, 16, FALSE,
00366 0, complain_overflow_dont, 0,
00367 "+v16", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
00368 HOWTO (R_RELLONG, 0, 2, 32, FALSE,
00369 0, complain_overflow_dont, 0,
00370 "+v32", TRUE, 0xffffffff, 0xffffffff, FALSE),
00371
00372 HOWTO (R_RELWORD_NEG, 0, -1, 16, FALSE,
00373 0, complain_overflow_dont, 0,
00374 "-v16", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
00375 HOWTO (R_RELLONG_NEG, 0, -2, 32, FALSE,
00376 0, complain_overflow_dont, 0,
00377 "-v32", TRUE, 0xffffffff, 0xffffffff, FALSE),
00378 };
00379
00380 static int
00381 get_offset (len, ptr)
00382 int len;
00383 unsigned char *ptr;
00384 {
00385 int val = 0;
00386 if (len)
00387 {
00388 int i;
00389 val = *ptr++;
00390 if (val & 0x80)
00391 val |= ~0xff;
00392 for (i = 1; i < len; i++)
00393 val = (val << 8) | *ptr++;
00394 }
00395
00396 return val;
00397 }
00398
00399 static void
00400 process_otr (abfd, otr, pass)
00401 bfd *abfd;
00402 struct ext_otr *otr;
00403 int pass;
00404 {
00405 unsigned long shift;
00406 unsigned char *srcp = otr->data;
00407 unsigned char *endp = (unsigned char *) otr + otr->size;
00408 unsigned int bits = (otr->map[0] << 24)
00409 | (otr->map[1] << 16)
00410 | (otr->map[2] << 8)
00411 | (otr->map[3] << 0);
00412
00413 struct esdid *esdid = &EDATA (abfd, otr->esdid - 1);
00414 unsigned char *contents = esdid->contents;
00415 int need_contents = 0;
00416 unsigned int dst_idx = esdid->pc;
00417
00418 for (shift = ((unsigned long) 1 << 31); shift && srcp < endp; shift >>= 1)
00419 {
00420 if (bits & shift)
00421 {
00422 int flag = *srcp++;
00423 int esdids = (flag >> 5) & 0x7;
00424 int sizeinwords = ((flag >> 3) & 1) ? 2 : 1;
00425 int offsetlen = flag & 0x7;
00426 int j;
00427
00428 if (esdids == 0)
00429 {
00430
00431 dst_idx += get_offset (offsetlen, srcp);
00432 srcp += offsetlen;
00433 }
00434 else
00435 {
00436 int val = get_offset (offsetlen, srcp + esdids);
00437 if (pass == 1)
00438 need_contents = 1;
00439 else
00440 for (j = 0; j < sizeinwords * 2; j++)
00441 {
00442 contents[dst_idx + (sizeinwords * 2) - j - 1] = val;
00443 val >>= 8;
00444 }
00445
00446 for (j = 0; j < esdids; j++)
00447 {
00448 int esdid = *srcp++;
00449
00450 if (esdid)
00451 {
00452 int rn = EDATA (abfd, otr->esdid - 1).relocs++;
00453 if (pass == 1)
00454 {
00455
00456
00457 }
00458 else
00459 {
00460 arelent *n =
00461 EDATA (abfd, otr->esdid - 1).section->relocation + rn;
00462 n->address = dst_idx;
00463
00464 n->sym_ptr_ptr = (asymbol **) (size_t) esdid;
00465 n->addend = 0;
00466 n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1);
00467 }
00468 }
00469 }
00470 srcp += offsetlen;
00471 dst_idx += sizeinwords * 2;
00472 }
00473 }
00474 else
00475 {
00476 need_contents = 1;
00477 if (dst_idx < esdid->section->size)
00478 if (pass == 2)
00479 {
00480
00481 contents[dst_idx] = srcp[0];
00482 contents[dst_idx + 1] = srcp[1];
00483 }
00484 dst_idx += 2;
00485 srcp += 2;
00486 }
00487 }
00488 EDATA (abfd, otr->esdid - 1).pc = dst_idx;
00489
00490 if (!contents && need_contents)
00491 {
00492 bfd_size_type size = esdid->section->size;
00493 esdid->contents = (unsigned char *) bfd_alloc (abfd, size);
00494 }
00495 }
00496
00497 static bfd_boolean
00498 versados_scan (abfd)
00499 bfd *abfd;
00500 {
00501 int loop = 1;
00502 int i;
00503 int j;
00504 int nsecs = 0;
00505 bfd_size_type amt;
00506
00507 VDATA (abfd)->stringlen = 0;
00508 VDATA (abfd)->nrefs = 0;
00509 VDATA (abfd)->ndefs = 0;
00510 VDATA (abfd)->ref_idx = 0;
00511 VDATA (abfd)->def_idx = 0;
00512 VDATA (abfd)->pass_2_done = 0;
00513
00514 while (loop)
00515 {
00516 union ext_any any;
00517 if (!get_record (abfd, &any))
00518 return TRUE;
00519 switch (any.header.type)
00520 {
00521 case VHEADER:
00522 break;
00523 case VEND:
00524 loop = 0;
00525 break;
00526 case VESTDEF:
00527 process_esd (abfd, &any.esd, 1);
00528 break;
00529 case VOTR:
00530 process_otr (abfd, &any.otr, 1);
00531 break;
00532 }
00533 }
00534
00535
00536
00537 VDATA (abfd)->nrefs = VDATA (abfd)->ref_idx;
00538 VDATA (abfd)->ndefs = VDATA (abfd)->def_idx;
00539 VDATA (abfd)->ref_idx = 0;
00540 VDATA (abfd)->def_idx = 0;
00541
00542 abfd->symcount = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs;
00543
00544 for (i = 0; i < 16; i++)
00545 {
00546 struct esdid *esdid = &EDATA (abfd, i);
00547 if (esdid->section)
00548 {
00549 amt = (bfd_size_type) esdid->relocs * sizeof (arelent);
00550 esdid->section->relocation = (arelent *) bfd_alloc (abfd, amt);
00551
00552 esdid->pc = 0;
00553
00554 if (esdid->contents)
00555 esdid->section->flags |= SEC_HAS_CONTENTS | SEC_LOAD;
00556
00557 esdid->section->reloc_count = esdid->relocs;
00558 if (esdid->relocs)
00559 esdid->section->flags |= SEC_RELOC;
00560
00561 esdid->relocs = 0;
00562
00563
00564 nsecs++;
00565 VDATA (abfd)->stringlen += strlen (esdid->section->name) + 1;
00566 }
00567 }
00568
00569 abfd->symcount += nsecs;
00570
00571 amt = abfd->symcount;
00572 amt *= sizeof (asymbol);
00573 VDATA (abfd)->symbols = (asymbol *) bfd_alloc (abfd, amt);
00574
00575 amt = VDATA (abfd)->stringlen;
00576 VDATA (abfd)->strings = bfd_alloc (abfd, amt);
00577
00578 if ((VDATA (abfd)->symbols == NULL && abfd->symcount > 0)
00579 || (VDATA (abfd)->strings == NULL && VDATA (abfd)->stringlen > 0))
00580 return FALSE;
00581
00582
00583
00584
00585 for (j = VDATA (abfd)->nrefs + VDATA (abfd)->ndefs, i = 0; i < 16; i++)
00586 {
00587 struct esdid *esdid = &EDATA (abfd, i);
00588 asection *sec = esdid->section;
00589 if (sec)
00590 {
00591 asymbol *s = VDATA (abfd)->symbols + j;
00592 s->name = new_symbol_string (abfd, sec->name);
00593 s->section = sec;
00594 s->flags = BSF_LOCAL;
00595 s->value = 0;
00596 s->the_bfd = abfd;
00597 j++;
00598 }
00599 }
00600 if (abfd->symcount)
00601 abfd->flags |= HAS_SYMS;
00602
00603
00604
00605 VDATA (abfd)->nsecsyms = nsecs;
00606
00607 VDATA (abfd)->ref_idx = 0;
00608
00609 return 1;
00610 }
00611
00612
00613
00614 static const bfd_target *
00615 versados_object_p (abfd)
00616 bfd *abfd;
00617 {
00618 struct ext_vheader ext;
00619 unsigned char len;
00620 tdata_type *tdata_save;
00621
00622 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
00623 return NULL;
00624
00625 if (bfd_bread (&len, (bfd_size_type) 1, abfd) != 1)
00626 {
00627 if (bfd_get_error () != bfd_error_system_call)
00628 bfd_set_error (bfd_error_wrong_format);
00629 return NULL;
00630 }
00631
00632 if (bfd_bread (&ext.type, (bfd_size_type) len, abfd) != len)
00633 {
00634 if (bfd_get_error () != bfd_error_system_call)
00635 bfd_set_error (bfd_error_wrong_format);
00636 return NULL;
00637 }
00638
00639
00640
00641
00642 if (ext.type != VHEADER
00643 || ext.lang > 10)
00644 {
00645 bfd_set_error (bfd_error_wrong_format);
00646 return NULL;
00647 }
00648
00649
00650
00651 tdata_save = abfd->tdata.versados_data;
00652 if (!versados_mkobject (abfd) || !versados_scan (abfd))
00653 {
00654 abfd->tdata.versados_data = tdata_save;
00655 return NULL;
00656 }
00657
00658 return abfd->xvec;
00659 }
00660
00661 static bfd_boolean
00662 versados_pass_2 (abfd)
00663 bfd *abfd;
00664 {
00665 union ext_any any;
00666
00667 if (VDATA (abfd)->pass_2_done)
00668 return 1;
00669
00670 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
00671 return 0;
00672
00673 VDATA (abfd)->es_done = ES_BASE;
00674
00675
00676
00677 while (1)
00678 {
00679 get_record (abfd, &any);
00680 switch (any.header.type)
00681 {
00682 case VEND:
00683 VDATA (abfd)->pass_2_done = 1;
00684 return 1;
00685 case VESTDEF:
00686 process_esd (abfd, &any.esd, 2);
00687 break;
00688 case VOTR:
00689 process_otr (abfd, &any.otr, 2);
00690 break;
00691 }
00692 }
00693 }
00694
00695 static bfd_boolean
00696 versados_get_section_contents (abfd, section, location, offset, count)
00697 bfd *abfd;
00698 asection *section;
00699 PTR location;
00700 file_ptr offset;
00701 bfd_size_type count;
00702 {
00703 if (!versados_pass_2 (abfd))
00704 return FALSE;
00705
00706 memcpy (location,
00707 EDATA (abfd, section->target_index).contents + offset,
00708 (size_t) count);
00709
00710 return TRUE;
00711 }
00712
00713 #define versados_get_section_contents_in_window \
00714 _bfd_generic_get_section_contents_in_window
00715
00716 static bfd_boolean
00717 versados_set_section_contents (abfd, section, location, offset, bytes_to_do)
00718 bfd *abfd ATTRIBUTE_UNUSED;
00719 sec_ptr section ATTRIBUTE_UNUSED;
00720 const PTR location ATTRIBUTE_UNUSED;
00721 file_ptr offset ATTRIBUTE_UNUSED;
00722 bfd_size_type bytes_to_do ATTRIBUTE_UNUSED;
00723 {
00724 return FALSE;
00725 }
00726
00727 static int
00728 versados_sizeof_headers (abfd, exec)
00729 bfd *abfd ATTRIBUTE_UNUSED;
00730 bfd_boolean exec ATTRIBUTE_UNUSED;
00731 {
00732 return 0;
00733 }
00734
00735
00736
00737 static long
00738 versados_get_symtab_upper_bound (abfd)
00739 bfd *abfd;
00740 {
00741 return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
00742 }
00743
00744
00745
00746 static long
00747 versados_canonicalize_symtab (abfd, alocation)
00748 bfd *abfd;
00749 asymbol **alocation;
00750 {
00751 unsigned int symcount = bfd_get_symcount (abfd);
00752 unsigned int i;
00753 asymbol *s;
00754
00755 versados_pass_2 (abfd);
00756
00757 for (i = 0, s = VDATA (abfd)->symbols;
00758 i < symcount;
00759 s++, i++)
00760 {
00761 *alocation++ = s;
00762 }
00763
00764 *alocation = NULL;
00765
00766 return symcount;
00767 }
00768
00769 static void
00770 versados_get_symbol_info (ignore_abfd, symbol, ret)
00771 bfd *ignore_abfd ATTRIBUTE_UNUSED;
00772 asymbol *symbol;
00773 symbol_info *ret;
00774 {
00775 bfd_symbol_info (symbol, ret);
00776 }
00777
00778 static void
00779 versados_print_symbol (abfd, afile, symbol, how)
00780 bfd *abfd;
00781 PTR afile;
00782 asymbol *symbol;
00783 bfd_print_symbol_type how;
00784 {
00785 FILE *file = (FILE *) afile;
00786 switch (how)
00787 {
00788 case bfd_print_symbol_name:
00789 fprintf (file, "%s", symbol->name);
00790 break;
00791 default:
00792 bfd_print_symbol_vandf (abfd, (PTR) file, symbol);
00793 fprintf (file, " %-5s %s",
00794 symbol->section->name,
00795 symbol->name);
00796
00797 }
00798 }
00799
00800 static long
00801 versados_get_reloc_upper_bound (abfd, asect)
00802 bfd *abfd ATTRIBUTE_UNUSED;
00803 sec_ptr asect;
00804 {
00805 return (asect->reloc_count + 1) * sizeof (arelent *);
00806 }
00807
00808 static long
00809 versados_canonicalize_reloc (abfd, section, relptr, symbols)
00810 bfd *abfd;
00811 sec_ptr section;
00812 arelent **relptr;
00813 asymbol **symbols;
00814 {
00815 unsigned int count;
00816 arelent *src;
00817
00818 versados_pass_2 (abfd);
00819 src = section->relocation;
00820 if (!EDATA (abfd, section->target_index).donerel)
00821 {
00822 EDATA (abfd, section->target_index).donerel = 1;
00823
00824 for (count = 0; count < section->reloc_count; count++)
00825 {
00826 int esdid = (int) (size_t) src[count].sym_ptr_ptr;
00827
00828 if (esdid == 0)
00829 {
00830 src[count].sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
00831 }
00832 else if (esdid < ES_BASE)
00833 {
00834 struct esdid *e = &EDATA (abfd, esdid - 1);
00835 if (!section)
00836 {
00839 }
00840 src[count].sym_ptr_ptr = e->section->symbol_ptr_ptr;
00841 }
00842 else
00843 {
00844 src[count].sym_ptr_ptr = symbols + esdid - ES_BASE;
00845 }
00846
00847 }
00848 }
00849
00850 for (count = 0; count < section->reloc_count; count++)
00851 {
00852 *relptr++ = src++;
00853 }
00854 *relptr = 0;
00855 return section->reloc_count;
00856 }
00857
00858 #define versados_close_and_cleanup _bfd_generic_close_and_cleanup
00859 #define versados_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
00860 #define versados_new_section_hook _bfd_generic_new_section_hook
00861
00862 #define versados_bfd_is_target_special_symbol \
00863 ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
00864 #define versados_bfd_is_local_label_name bfd_generic_is_local_label_name
00865 #define versados_get_lineno _bfd_nosymbols_get_lineno
00866 #define versados_find_nearest_line _bfd_nosymbols_find_nearest_line
00867 #define versados_make_empty_symbol _bfd_generic_make_empty_symbol
00868 #define versados_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
00869 #define versados_read_minisymbols _bfd_generic_read_minisymbols
00870 #define versados_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
00871
00872 #define versados_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
00873
00874 #define versados_set_arch_mach bfd_default_set_arch_mach
00875
00876 #define versados_bfd_get_relocated_section_contents \
00877 bfd_generic_get_relocated_section_contents
00878 #define versados_bfd_relax_section bfd_generic_relax_section
00879 #define versados_bfd_gc_sections bfd_generic_gc_sections
00880 #define versados_bfd_merge_sections bfd_generic_merge_sections
00881 #define versados_bfd_is_group_section bfd_generic_is_group_section
00882 #define versados_bfd_discard_group bfd_generic_discard_group
00883 #define versados_section_already_linked \
00884 _bfd_generic_section_already_linked
00885 #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
00886 #define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
00887 #define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
00888 #define versados_bfd_link_just_syms _bfd_generic_link_just_syms
00889 #define versados_bfd_final_link _bfd_generic_final_link
00890 #define versados_bfd_link_split_section _bfd_generic_link_split_section
00891
00892 const bfd_target versados_vec =
00893 {
00894 "versados",
00895 bfd_target_versados_flavour,
00896 BFD_ENDIAN_BIG,
00897 BFD_ENDIAN_BIG,
00898 (HAS_RELOC | EXEC_P |
00899 HAS_LINENO | HAS_DEBUG |
00900 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
00901 (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
00902 | SEC_ALLOC | SEC_LOAD | SEC_RELOC),
00903 0,
00904 ' ',
00905 16,
00906 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
00907 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
00908 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
00909 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
00910 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
00911 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
00912
00913 {
00914 _bfd_dummy_target,
00915 versados_object_p,
00916 _bfd_dummy_target,
00917 _bfd_dummy_target,
00918 },
00919 {
00920 bfd_false,
00921 versados_mkobject,
00922 _bfd_generic_mkarchive,
00923 bfd_false,
00924 },
00925 {
00926 bfd_false,
00927 bfd_false,
00928 _bfd_write_archive_contents,
00929 bfd_false,
00930 },
00931
00932 BFD_JUMP_TABLE_GENERIC (versados),
00933 BFD_JUMP_TABLE_COPY (_bfd_generic),
00934 BFD_JUMP_TABLE_CORE (_bfd_nocore),
00935 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
00936 BFD_JUMP_TABLE_SYMBOLS (versados),
00937 BFD_JUMP_TABLE_RELOCS (versados),
00938 BFD_JUMP_TABLE_WRITE (versados),
00939 BFD_JUMP_TABLE_LINK (versados),
00940 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
00941
00942 NULL,
00943
00944 (PTR) 0
00945 };