Add support for parallel instructions.
[deliverable/binutils-gdb.git] / bfd / srec.c
CommitLineData
4a8db330 1/* BFD back-end for s-record objects.
0103b447 2 Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
9898b929 3 Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
4a81b561 4
387cbb2b 5This file is part of BFD, the Binary File Descriptor library.
4a81b561 6
387cbb2b 7This program is free software; you can redistribute it and/or modify
4a81b561 8it under the terms of the GNU General Public License as published by
387cbb2b
JG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
4a81b561 11
387cbb2b 12This program is distributed in the hope that it will be useful,
4a81b561
DHW
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
387cbb2b 18along with this program; if not, write to the Free Software
c3246d9b 19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
4a81b561 20
9898b929
JG
21/*
22SUBSECTION
8f8fefcc 23 S-Record handling
4a81b561 24
9898b929
JG
25DESCRIPTION
26
8f8fefcc
JG
27 Ordinary S-Records cannot hold anything but addresses and
28 data, so that's all that we implement.
9783e04a 29
8f8fefcc 30 The only interesting thing is that S-Records may come out of
9898b929
JG
31 order and there is no header, so an initial scan is required
32 to discover the minimum and maximum addresses used to create
33 the vma and size of the only section we create. We
9783e04a 34 arbitrarily call this section ".text".
9898b929
JG
35
36 When bfd_get_section_contents is called the file is read
37 again, and this time the data is placed into a bfd_alloc'd
38 area.
39
40 Any number of sections may be created for output, we save them
41 up and output them when it's time to close the bfd.
42
43 An s record looks like:
44
45EXAMPLE
294eaca4 46 S<type><length><address><data><checksum>
9898b929
JG
47
48DESCRIPTION
49 Where
50 o length
51 is the number of bytes following upto the checksum. Note that
52 this is not the number of chars following, since it takes two
53 chars to represent a byte.
54 o type
55 is one of:
56 0) header record
57 1) two byte address data record
58 2) three byte address data record
59 3) four byte address data record
60 7) four byte address termination record
61 8) three byte address termination record
62 9) two byte address termination record
63
64 o address
65 is the start address of the data following, or in the case of
66 a termination record, the start address of the image
67 o data
68 is the data.
69 o checksum
70 is the sum of all the raw byte data in the record, from the length
71 upwards, modulo 256 and subtracted from 255.
8f8fefcc
JG
72
73
74SUBSECTION
75 Symbol S-Record handling
76
77DESCRIPTION
78 Some ICE equipment understands an addition to the standard
79 S-Record format; symbols and their addresses can be sent
80 before the data.
81
82 The format of this is:
83 ($$ <modulename>
84 (<space> <symbol> <address>)*)
85 $$
86
87 so a short symbol table could look like:
88
89EXAMPLE
90 $$ flash.x
91 $$ flash.c
92 _port6 $0
93 _delay $4
94 _start $14
95 _etext $8036
96 _edata $8036
97 _end $8036
9783e04a 98 $$
8f8fefcc
JG
99
100DESCRIPTION
101 We allow symbols to be anywhere in the data stream - the module names
102 are always ignored.
103
9898b929 104*/
7ed4093a 105
36773af5 106#include "bfd.h"
9898b929 107#include "sysdep.h"
4a81b561 108#include "libbfd.h"
7f4c005d 109#include "libiberty.h"
b7577823 110#include <ctype.h>
7f4c005d 111
0103b447
ILT
112static void srec_print_symbol
113 PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type));
7f4c005d
KR
114static void srec_init PARAMS ((void));
115static boolean srec_mkobject PARAMS ((bfd *));
116static int srec_get_byte PARAMS ((bfd *, boolean *));
117static void srec_bad_byte PARAMS ((bfd *, unsigned int, int, boolean));
118static boolean srec_scan PARAMS ((bfd *));
119static const bfd_target *srec_object_p PARAMS ((bfd *));
120static const bfd_target *symbolsrec_object_p PARAMS ((bfd *));
121static boolean srec_read_section PARAMS ((bfd *, asection *, bfd_byte *));
4a81b561 122
6d4f7715 123static boolean srec_write_record PARAMS ((bfd *, int, bfd_vma,
7f4c005d
KR
124 const bfd_byte *,
125 const bfd_byte *));
6d4f7715
ILT
126static boolean srec_write_header PARAMS ((bfd *));
127static boolean srec_write_symbols PARAMS ((bfd *));
0103b447
ILT
128static boolean srec_new_symbol PARAMS ((bfd *, const char *, bfd_vma));
129static boolean srec_get_section_contents
130 PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
131static boolean srec_set_arch_mach
132 PARAMS ((bfd *, enum bfd_architecture, unsigned long));
133static boolean srec_set_section_contents
134 PARAMS ((bfd *, sec_ptr, PTR, file_ptr, bfd_size_type));
135static boolean internal_srec_write_object_contents PARAMS ((bfd *, int));
136static boolean srec_write_object_contents PARAMS ((bfd *));
137static boolean symbolsrec_write_object_contents PARAMS ((bfd *));
138static int srec_sizeof_headers PARAMS ((bfd *, boolean));
139static asymbol *srec_make_empty_symbol PARAMS ((bfd *));
140static long srec_get_symtab_upper_bound PARAMS ((bfd *));
141static long srec_get_symtab PARAMS ((bfd *, asymbol **));
6d4f7715 142
4c8d6c9f 143/* Macros for converting between hex and binary. */
4a81b561 144
3039e8ee 145static CONST char digs[] = "0123456789ABCDEF";
5f9ca960 146
7f4c005d 147#define NIBBLE(x) hex_value(x)
9898b929 148#define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
5f9ca960
JG
149#define TOHEX(d, x, ch) \
150 d[1] = digs[(x) & 0xf]; \
151 d[0] = digs[((x)>>4)&0xf]; \
152 ch += ((x) & 0xff);
7f4c005d 153#define ISHEX(x) hex_p(x)
4a81b561 154
4c8d6c9f 155/* Initialize by filling in the hex conversion array. */
9898b929 156
e98e6ec1 157static void
57a1867e 158srec_init ()
9898b929 159{
9783e04a
DM
160 static boolean inited = false;
161
162 if (inited == false)
9898b929 163 {
9783e04a 164 inited = true;
7f4c005d 165 hex_init ();
9783e04a 166 }
9898b929
JG
167}
168
4a81b561 169/* The maximum number of bytes on a line is FF */
9783e04a 170#define MAXCHUNK 0xff
4a81b561 171/* The number of bytes we fit onto a line on output */
9898b929
JG
172#define CHUNK 21
173
7f4c005d
KR
174/* When writing an S-record file, the S-records can not be output as
175 they are seen. This structure is used to hold them in memory. */
9898b929
JG
176
177struct srec_data_list_struct
178{
7f4c005d
KR
179 struct srec_data_list_struct *next;
180 bfd_byte *data;
9783e04a
DM
181 bfd_vma where;
182 bfd_size_type size;
7f4c005d 183};
9783e04a 184
7f4c005d 185typedef struct srec_data_list_struct srec_data_list_type;
8f8fefcc 186
7f4c005d
KR
187/* When scanning the S-record file, a linked list of srec_symbol
188 structures is built to represent the symbol table (if there is
189 one). */
190
191struct srec_symbol
192{
193 struct srec_symbol *next;
194 const char *name;
195 bfd_vma val;
9783e04a 196};
9898b929 197
7f4c005d 198/* The S-record tdata information. */
4a81b561 199
9783e04a
DM
200typedef struct srec_data_struct
201 {
202 srec_data_list_type *head;
d4d16683 203 srec_data_list_type *tail;
9898b929 204 unsigned int type;
7f4c005d
KR
205 struct srec_symbol *symbols;
206 struct srec_symbol *symtail;
207 asymbol *csymbols;
9783e04a
DM
208 }
209tdata_type;
9898b929 210
6d4f7715
ILT
211static boolean srec_write_section PARAMS ((bfd *, tdata_type *,
212 srec_data_list_type *));
213static boolean srec_write_terminator PARAMS ((bfd *, tdata_type *));
9898b929 214
7f4c005d 215/* Set up the S-record tdata information. */
9898b929 216
7f4c005d
KR
217static boolean
218srec_mkobject (abfd)
9783e04a 219 bfd *abfd;
9783e04a 220{
7f4c005d 221 srec_init ();
8f8fefcc 222
7f4c005d 223 if (abfd->tdata.srec_data == NULL)
8f8fefcc 224 {
7f4c005d
KR
225 tdata_type *tdata = (tdata_type *) bfd_alloc (abfd, sizeof (tdata_type));
226 if (tdata == NULL)
a9713b91 227 return false;
7f4c005d
KR
228 abfd->tdata.srec_data = tdata;
229 tdata->type = 1;
230 tdata->head = NULL;
231 tdata->tail = NULL;
232 tdata->symbols = NULL;
233 tdata->symtail = NULL;
234 tdata->csymbols = NULL;
9783e04a 235 }
4a81b561 236
7f4c005d
KR
237 return true;
238}
357a1f38 239
7f4c005d
KR
240/* Read a byte from an S record file. Set *ERRORPTR if an error
241 occurred. Return EOF on error or end of file. */
4a81b561 242
7f4c005d
KR
243static int
244srec_get_byte (abfd, errorptr)
57a1867e 245 bfd *abfd;
7f4c005d 246 boolean *errorptr;
9783e04a 247{
7f4c005d
KR
248 bfd_byte c;
249
250 if (bfd_read (&c, 1, 1, abfd) != 1)
9783e04a 251 {
7f4c005d
KR
252 if (bfd_get_error () != bfd_error_file_truncated)
253 *errorptr = true;
254 return EOF;
9783e04a 255 }
7f4c005d
KR
256
257 return (int) (c & 0xff);
4a81b561
DHW
258}
259
7f4c005d
KR
260/* Report a problem in an S record file. FIXME: This probably should
261 not call fprintf, but we really do need some mechanism for printing
262 error messages. */
387cbb2b 263
7f4c005d
KR
264static void
265srec_bad_byte (abfd, lineno, c, error)
9783e04a 266 bfd *abfd;
7f4c005d
KR
267 unsigned int lineno;
268 int c;
269 boolean error;
8f8fefcc 270{
7f4c005d 271 if (c == EOF)
9783e04a 272 {
7f4c005d
KR
273 if (! error)
274 bfd_set_error (bfd_error_file_truncated);
275 }
276 else
277 {
278 char buf[10];
279
280 if (! isprint (c))
281 sprintf (buf, "\\%03o", (unsigned int) c);
282 else
283 {
284 buf[0] = c;
285 buf[1] = '\0';
286 }
a9713b91
ILT
287 (*_bfd_error_handler)
288 ("%s:%d: Unexpected character `%s' in S-record file\n",
289 bfd_get_filename (abfd), lineno, buf);
7f4c005d 290 bfd_set_error (bfd_error_bad_value);
9783e04a 291 }
8f8fefcc
JG
292}
293
7f4c005d
KR
294/* Add a new symbol found in an S-record file. */
295
8f8fefcc 296static boolean
7f4c005d 297srec_new_symbol (abfd, name, val)
57a1867e 298 bfd *abfd;
7f4c005d
KR
299 const char *name;
300 bfd_vma val;
8f8fefcc 301{
7f4c005d
KR
302 struct srec_symbol *n;
303
304 n = (struct srec_symbol *) bfd_alloc (abfd, sizeof (struct srec_symbol));
305 if (n == NULL)
a9713b91 306 return false;
9783e04a 307
7f4c005d
KR
308 n->name = name;
309 n->val = val;
310
311 if (abfd->tdata.srec_data->symbols == NULL)
312 abfd->tdata.srec_data->symbols = n;
313 else
314 abfd->tdata.srec_data->symtail->next = n;
315 abfd->tdata.srec_data->symtail = n;
316 n->next = NULL;
317
318 ++abfd->symcount;
319
320 return true;
8f8fefcc
JG
321}
322
7f4c005d
KR
323/* Read the S record file and turn it into sections. We create a new
324 section for each contiguous set of bytes. */
325
326static boolean
327srec_scan (abfd)
4c3721d5 328 bfd *abfd;
4a81b561 329{
7f4c005d
KR
330 int c;
331 unsigned int lineno = 1;
332 boolean error = false;
333 bfd_byte *buf = NULL;
334 size_t bufsize = 0;
335 asection *sec = NULL;
0103b447 336 char *symbuf = NULL;
e98e6ec1 337
6d4f7715 338 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
7f4c005d
KR
339 goto error_return;
340
341 while ((c = srec_get_byte (abfd, &error)) != EOF)
4a81b561 342 {
7f4c005d
KR
343 /* We only build sections from contiguous S-records, so if this
344 is not an S-record, then stop building a section. */
345 if (c != 'S' && c != '\r' && c != '\n')
346 sec = NULL;
347
348 switch (c)
8f8fefcc 349 {
9783e04a 350 default:
7f4c005d
KR
351 srec_bad_byte (abfd, lineno, c, error);
352 goto error_return;
353
354 case '\n':
355 ++lineno;
356 break;
357
358 case '\r':
9783e04a
DM
359 break;
360
361 case '$':
7f4c005d
KR
362 /* Starting a module name, which we ignore. */
363 while ((c = srec_get_byte (abfd, &error)) != '\n'
364 && c != EOF)
365 ;
366 if (c == EOF)
9783e04a 367 {
7f4c005d
KR
368 srec_bad_byte (abfd, lineno, c, error);
369 goto error_return;
9783e04a 370 }
7f4c005d
KR
371
372 ++lineno;
373
9783e04a
DM
374 break;
375
376 case ' ':
0103b447
ILT
377 do
378 {
379 unsigned int alc;
380 char *p, *symname;
381 bfd_vma symval;
4c3721d5 382
0103b447
ILT
383 /* Starting a symbol definition. */
384 while ((c = srec_get_byte (abfd, &error)) != EOF
385 && (c == ' ' || c == '\t'))
386 ;
9783e04a 387
0103b447
ILT
388 if (c == '\n')
389 break;
9783e04a 390
0103b447
ILT
391 if (c == EOF)
392 {
393 srec_bad_byte (abfd, lineno, c, error);
394 goto error_return;
395 }
7f4c005d 396
0103b447
ILT
397 alc = 10;
398 symbuf = (char *) bfd_malloc (alc + 1);
399 if (symbuf == NULL)
400 goto error_return;
7f4c005d 401
0103b447
ILT
402 p = symbuf;
403
404 *p++ = c;
405 while ((c = srec_get_byte (abfd, &error)) != EOF
406 && ! isspace (c))
407 {
408 if (p - symbuf >= alc)
409 {
410 char *n;
411
412 alc *= 2;
413 n = (char *) bfd_realloc (symbuf, alc + 1);
414 if (n == NULL)
415 goto error_return;
416 p = n + (p - symbuf);
417 symbuf = n;
418 }
419
420 *p++ = c;
421 }
422
423 if (c == EOF)
424 {
425 srec_bad_byte (abfd, lineno, c, error);
426 goto error_return;
427 }
428
429 *p++ = '\0';
430 symname = bfd_alloc (abfd, p - symbuf);
431 if (symname == NULL)
7f4c005d 432 goto error_return;
0103b447
ILT
433 strcpy (symname, symbuf);
434 free (symbuf);
435 symbuf = NULL;
436
437 while ((c = srec_get_byte (abfd, &error)) != EOF
438 && (c == ' ' || c == '\t'))
439 ;
440 if (c == EOF)
441 {
442 srec_bad_byte (abfd, lineno, c, error);
443 goto error_return;
444 }
445
446 /* Skip a dollar sign before the hex value. */
447 if (c == '$')
448 {
449 c = srec_get_byte (abfd, &error);
450 if (c == EOF)
451 {
452 srec_bad_byte (abfd, lineno, c, error);
453 goto error_return;
454 }
455 }
456
457 symval = 0;
458 while (ISHEX (c))
459 {
460 symval <<= 4;
461 symval += NIBBLE (c);
462 c = srec_get_byte (abfd, &error);
463 }
464
465 if (! srec_new_symbol (abfd, symname, symval))
466 goto error_return;
467 }
468 while (c == ' ' || c == '\t');
7f4c005d 469
0103b447
ILT
470 if (c != '\n')
471 {
472 srec_bad_byte (abfd, lineno, c, error);
7f4c005d 473 goto error_return;
0103b447 474 }
7f4c005d 475
0103b447 476 ++lineno;
7f4c005d 477
9783e04a 478 break;
7f4c005d 479
9783e04a 480 case 'S':
7f4c005d
KR
481 {
482 file_ptr pos;
483 char hdr[3];
484 unsigned int bytes;
485 bfd_vma address;
486 bfd_byte *data;
9783e04a 487
7f4c005d 488 /* Starting an S-record. */
9783e04a 489
7f4c005d 490 pos = bfd_tell (abfd) - 1;
9783e04a 491
7f4c005d
KR
492 if (bfd_read (hdr, 1, 3, abfd) != 3)
493 goto error_return;
9783e04a 494
7f4c005d
KR
495 if (! ISHEX (hdr[1]) || ! ISHEX (hdr[2]))
496 {
497 if (! ISHEX (hdr[1]))
498 c = hdr[1];
499 else
500 c = hdr[2];
501 srec_bad_byte (abfd, lineno, c, error);
502 goto error_return;
503 }
9783e04a 504
7f4c005d
KR
505 bytes = HEX (hdr + 1);
506 if (bytes * 2 > bufsize)
507 {
508 if (buf != NULL)
509 free (buf);
58142f10 510 buf = (bfd_byte *) bfd_malloc (bytes * 2);
7f4c005d 511 if (buf == NULL)
58142f10 512 goto error_return;
7f4c005d
KR
513 bufsize = bytes * 2;
514 }
9783e04a 515
7f4c005d
KR
516 if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2)
517 goto error_return;
9783e04a 518
7f4c005d
KR
519 /* Ignore the checksum byte. */
520 --bytes;
521
522 address = 0;
523 data = buf;
524 switch (hdr[0])
525 {
526 case '0':
527 case '5':
528 /* Prologue--ignore the file name, but stop building a
529 section at this point. */
530 sec = NULL;
531 break;
532
533 case '3':
534 address = HEX (data);
535 data += 2;
536 --bytes;
537 /* Fall through. */
538 case '2':
539 address = (address << 8) | HEX (data);
540 data += 2;
541 --bytes;
542 /* Fall through. */
543 case '1':
544 address = (address << 8) | HEX (data);
545 data += 2;
546 address = (address << 8) | HEX (data);
547 data += 2;
548 bytes -= 2;
549
550 if (sec != NULL
551 && sec->vma + sec->_raw_size == address)
552 {
553 /* This data goes at the end of the section we are
554 currently building. */
555 sec->_raw_size += bytes;
556 }
557 else
558 {
559 char secbuf[20];
560 char *secname;
561
562 sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
563 secname = (char *) bfd_alloc (abfd, strlen (secbuf) + 1);
564 strcpy (secname, secbuf);
565 sec = bfd_make_section (abfd, secname);
566 if (sec == NULL)
567 goto error_return;
568 sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
569 sec->vma = address;
55ae43ab 570 sec->lma = address;
7f4c005d
KR
571 sec->_raw_size = bytes;
572 sec->filepos = pos;
573 }
574
575 break;
576
577 case '7':
578 address = HEX (data);
579 data += 2;
580 /* Fall through. */
581 case '8':
582 address = (address << 8) | HEX (data);
583 data += 2;
584 /* Fall through. */
585 case '9':
586 address = (address << 8) | HEX (data);
587 data += 2;
588 address = (address << 8) | HEX (data);
589 data += 2;
590
591 /* This is a termination record. */
592 abfd->start_address = address;
593
594 if (buf != NULL)
595 free (buf);
596
597 return true;
598 }
599 }
600 break;
8f8fefcc 601 }
4a81b561 602 }
9898b929 603
7f4c005d
KR
604 if (error)
605 goto error_return;
4a81b561 606
7f4c005d
KR
607 if (buf != NULL)
608 free (buf);
609
610 return true;
611
612 error_return:
0103b447
ILT
613 if (symbuf != NULL)
614 free (symbuf);
7f4c005d
KR
615 if (buf != NULL)
616 free (buf);
617 return false;
8f8fefcc 618}
9898b929 619
7f4c005d
KR
620/* Check whether an existing file is an S-record file. */
621
2f3508ad 622static const bfd_target *
57a1867e
DM
623srec_object_p (abfd)
624 bfd *abfd;
4a81b561 625{
7f4c005d 626 bfd_byte b[4];
8f8fefcc 627
9783e04a 628 srec_init ();
9898b929 629
6d4f7715
ILT
630 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
631 || bfd_read (b, 1, 4, abfd) != 4)
632 return NULL;
9783e04a
DM
633
634 if (b[0] != 'S' || !ISHEX (b[1]) || !ISHEX (b[2]) || !ISHEX (b[3]))
7f4c005d
KR
635 {
636 bfd_set_error (bfd_error_wrong_format);
637 return NULL;
638 }
9783e04a 639
7f4c005d
KR
640 if (! srec_mkobject (abfd)
641 || ! srec_scan (abfd))
642 return NULL;
4a81b561 643
7f4c005d 644 return abfd->xvec;
8f8fefcc
JG
645}
646
7f4c005d 647/* Check whether an existing file is an S-record file with symbols. */
8f8fefcc 648
2f3508ad 649static const bfd_target *
57a1867e
DM
650symbolsrec_object_p (abfd)
651 bfd *abfd;
8f8fefcc 652{
7f4c005d 653 char b[2];
8f8fefcc 654
9783e04a
DM
655 srec_init ();
656
6d4f7715 657 if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
7f4c005d 658 || bfd_read (b, 1, 2, abfd) != 2)
6d4f7715 659 return NULL;
8f8fefcc
JG
660
661 if (b[0] != '$' || b[1] != '$')
7f4c005d
KR
662 {
663 bfd_set_error (bfd_error_wrong_format);
664 return NULL;
665 }
8f8fefcc 666
7f4c005d
KR
667 if (! srec_mkobject (abfd)
668 || ! srec_scan (abfd))
669 return NULL;
670
671 return abfd->xvec;
4a81b561
DHW
672}
673
7f4c005d
KR
674/* Read in the contents of a section in an S-record file. */
675
676static boolean
677srec_read_section (abfd, section, contents)
678 bfd *abfd;
679 asection *section;
680 bfd_byte *contents;
681{
682 int c;
683 bfd_size_type sofar = 0;
684 boolean error = false;
685 bfd_byte *buf = NULL;
686 size_t bufsize = 0;
687
688 if (bfd_seek (abfd, section->filepos, SEEK_SET) != 0)
689 goto error_return;
690
691 while ((c = srec_get_byte (abfd, &error)) != EOF)
692 {
693 bfd_byte hdr[3];
694 unsigned int bytes;
695 bfd_vma address;
696 bfd_byte *data;
697
698 if (c == '\r' || c == '\n')
699 continue;
700
701 /* This is called after srec_scan has already been called, so we
702 ought to know the exact format. */
703 BFD_ASSERT (c == 'S');
704
705 if (bfd_read (hdr, 1, 3, abfd) != 3)
706 goto error_return;
707
708 BFD_ASSERT (ISHEX (hdr[1]) && ISHEX (hdr[2]));
709
710 bytes = HEX (hdr + 1);
711
712 if (bytes * 2 > bufsize)
713 {
714 if (buf != NULL)
715 free (buf);
58142f10 716 buf = (bfd_byte *) bfd_malloc (bytes * 2);
7f4c005d 717 if (buf == NULL)
58142f10 718 goto error_return;
7f4c005d
KR
719 bufsize = bytes * 2;
720 }
721
722 if (bfd_read (buf, 1, bytes * 2, abfd) != bytes * 2)
723 goto error_return;
724
725 address = 0;
726 data = buf;
727 switch (hdr[0])
728 {
729 default:
730 BFD_ASSERT (sofar == section->_raw_size);
731 if (buf != NULL)
732 free (buf);
733 return true;
734
735 case '3':
736 address = HEX (data);
737 data += 2;
738 --bytes;
739 /* Fall through. */
740 case '2':
741 address = (address << 8) | HEX (data);
742 data += 2;
743 --bytes;
744 /* Fall through. */
745 case '1':
746 address = (address << 8) | HEX (data);
747 data += 2;
748 address = (address << 8) | HEX (data);
749 data += 2;
750 bytes -= 2;
751
752 if (address != section->vma + sofar)
753 {
754 /* We've come to the end of this section. */
755 BFD_ASSERT (sofar == section->_raw_size);
756 if (buf != NULL)
757 free (buf);
758 return true;
759 }
760
761 /* Don't consider checksum. */
762 --bytes;
763
764 while (bytes-- != 0)
765 {
766 contents[sofar] = HEX (data);
767 data += 2;
768 ++sofar;
769 }
770
771 break;
772 }
773 }
774
775 if (error)
776 goto error_return;
777
778 BFD_ASSERT (sofar == section->_raw_size);
779
780 if (buf != NULL)
781 free (buf);
782
783 return true;
784
785 error_return:
786 if (buf != NULL)
787 free (buf);
788 return false;
789}
790
791/* Get the contents of a section in an S-record file. */
4a81b561 792
4a81b561 793static boolean
57a1867e
DM
794srec_get_section_contents (abfd, section, location, offset, count)
795 bfd *abfd;
796 asection *section;
797 PTR location;
798 file_ptr offset;
799 bfd_size_type count;
9783e04a 800{
7f4c005d 801 if (section->used_by_bfd == NULL)
9898b929 802 {
7f4c005d
KR
803 section->used_by_bfd = bfd_alloc (abfd, section->_raw_size);
804 if (section->used_by_bfd == NULL
805 && section->_raw_size != 0)
a9713b91 806 return false;
9783e04a 807
7f4c005d
KR
808 if (! srec_read_section (abfd, section, section->used_by_bfd))
809 return false;
9898b929 810 }
9783e04a 811
b7577823
ILT
812 memcpy (location, (bfd_byte *) section->used_by_bfd + offset,
813 (size_t) count);
4a81b561 814
7f4c005d 815 return true;
4a81b561
DHW
816}
817
0103b447
ILT
818/* Set the architecture. We accept an unknown architecture here. */
819
820static boolean
821srec_set_arch_mach (abfd, arch, mach)
822 bfd *abfd;
823 enum bfd_architecture arch;
824 unsigned long mach;
825{
826 if (arch == bfd_arch_unknown)
827 {
828 abfd->arch_info = &bfd_default_arch_struct;
829 return true;
830 }
831 return bfd_default_set_arch_mach (abfd, arch, mach);
832}
833
c3246d9b 834/* we have to save up all the Srecords for a splurge before output */
4a81b561 835
9898b929 836static boolean
57a1867e
DM
837srec_set_section_contents (abfd, section, location, offset, bytes_to_do)
838 bfd *abfd;
839 sec_ptr section;
840 PTR location;
841 file_ptr offset;
842 bfd_size_type bytes_to_do;
9783e04a
DM
843{
844 tdata_type *tdata = abfd->tdata.srec_data;
d4d16683 845 register srec_data_list_type *entry;
9783e04a 846
d4d16683
ILT
847 entry = ((srec_data_list_type *)
848 bfd_alloc (abfd, sizeof (srec_data_list_type)));
849 if (entry == NULL)
a9713b91 850 return false;
8f8fefcc 851
c3246d9b
ILT
852 if (bytes_to_do
853 && (section->flags & SEC_ALLOC)
9783e04a 854 && (section->flags & SEC_LOAD))
9898b929 855 {
7f4c005d 856 bfd_byte *data = (bfd_byte *) bfd_alloc (abfd, bytes_to_do);
d4d16683 857 if (data == NULL)
a9713b91 858 return false;
b7577823 859 memcpy ((PTR) data, location, (size_t) bytes_to_do);
9898b929 860
c3246d9b 861 if ((section->lma + offset + bytes_to_do - 1) <= 0xffff)
8f8fefcc 862 {
9898b929 863
8f8fefcc 864 }
c3246d9b 865 else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff
9783e04a 866 && tdata->type < 2)
8f8fefcc
JG
867 {
868 tdata->type = 2;
869 }
9783e04a 870 else
8f8fefcc
JG
871 {
872 tdata->type = 3;
873 }
874
875 entry->data = data;
876 entry->where = section->lma + offset;
877 entry->size = bytes_to_do;
d4d16683
ILT
878
879 /* Sort the records by address. Optimize for the common case of
880 adding a record to the end of the list. */
881 if (tdata->tail != NULL
882 && entry->where >= tdata->tail->where)
883 {
884 tdata->tail->next = entry;
885 entry->next = NULL;
886 tdata->tail = entry;
887 }
888 else
889 {
890 register srec_data_list_type **look;
891
892 for (look = &tdata->head;
893 *look != NULL && (*look)->where < entry->where;
894 look = &(*look)->next)
895 ;
896 entry->next = *look;
897 *look = entry;
898 if (entry->next == NULL)
899 tdata->tail = entry;
900 }
8f8fefcc 901 }
9783e04a 902 return true;
9898b929
JG
903}
904
905/* Write a record of type, of the supplied number of bytes. The
906 supplied bytes and length don't have a checksum. That's worked out
907 here
908*/
6d4f7715 909static boolean
57a1867e
DM
910srec_write_record (abfd, type, address, data, end)
911 bfd *abfd;
6d4f7715 912 int type;
57a1867e 913 bfd_vma address;
7f4c005d
KR
914 const bfd_byte *data;
915 const bfd_byte *end;
9783e04a
DM
916{
917 char buffer[MAXCHUNK];
9783e04a 918 unsigned int check_sum = 0;
7f4c005d 919 CONST bfd_byte *src = data;
9783e04a
DM
920 char *dst = buffer;
921 char *length;
ae115e51 922 bfd_size_type wrlen;
9783e04a 923
9783e04a
DM
924 *dst++ = 'S';
925 *dst++ = '0' + type;
926
927 length = dst;
928 dst += 2; /* leave room for dst*/
929
930 switch (type)
9898b929 931 {
9783e04a
DM
932 case 3:
933 case 7:
934 TOHEX (dst, (address >> 24), check_sum);
935 dst += 2;
936 case 8:
937 case 2:
938 TOHEX (dst, (address >> 16), check_sum);
939 dst += 2;
940 case 9:
941 case 1:
942 case 0:
943 TOHEX (dst, (address >> 8), check_sum);
944 dst += 2;
945 TOHEX (dst, (address), check_sum);
946 dst += 2;
947 break;
4a81b561 948
4a81b561 949 }
9783e04a 950 for (src = data; src < end; src++)
9898b929 951 {
9783e04a
DM
952 TOHEX (dst, *src, check_sum);
953 dst += 2;
4a81b561
DHW
954 }
955
9783e04a
DM
956 /* Fill in the length */
957 TOHEX (length, (dst - length) / 2, check_sum);
958 check_sum &= 0xff;
959 check_sum = 255 - check_sum;
960 TOHEX (dst, check_sum, check_sum);
961 dst += 2;
962
963 *dst++ = '\r';
964 *dst++ = '\n';
ae115e51
ILT
965 wrlen = dst - buffer;
966 if (bfd_write ((PTR) buffer, 1, wrlen, abfd) != wrlen)
6d4f7715
ILT
967 return false;
968 return true;
9898b929 969}
4a81b561 970
4a81b561 971
4a81b561 972
6d4f7715 973static boolean
57a1867e
DM
974srec_write_header (abfd)
975 bfd *abfd;
9898b929 976{
7f4c005d
KR
977 bfd_byte buffer[MAXCHUNK];
978 bfd_byte *dst = buffer;
9783e04a 979 unsigned int i;
4a81b561 980
9783e04a
DM
981 /* I'll put an arbitary 40 char limit on header size */
982 for (i = 0; i < 40 && abfd->filename[i]; i++)
9898b929 983 {
9783e04a 984 *dst++ = abfd->filename[i];
9898b929 985 }
6d4f7715 986 return srec_write_record (abfd, 0, 0, buffer, dst);
4a81b561
DHW
987}
988
6d4f7715 989static boolean
57a1867e
DM
990srec_write_section (abfd, tdata, list)
991 bfd *abfd;
992 tdata_type *tdata;
993 srec_data_list_type *list;
9898b929 994{
9783e04a 995 unsigned int bytes_written = 0;
7f4c005d 996 bfd_byte *location = list->data;
9898b929 997
9783e04a 998 while (bytes_written < list->size)
9898b929 999 {
9783e04a
DM
1000 bfd_vma address;
1001
1002 unsigned int bytes_this_chunk = list->size - bytes_written;
9898b929 1003
9783e04a 1004 if (bytes_this_chunk > CHUNK)
9898b929 1005 {
9783e04a 1006 bytes_this_chunk = CHUNK;
9898b929
JG
1007 }
1008
9783e04a 1009 address = list->where + bytes_written;
9898b929 1010
6d4f7715
ILT
1011 if (! srec_write_record (abfd,
1012 tdata->type,
1013 address,
1014 location,
1015 location + bytes_this_chunk))
1016 return false;
9898b929 1017
9783e04a
DM
1018 bytes_written += bytes_this_chunk;
1019 location += bytes_this_chunk;
9898b929
JG
1020 }
1021
6d4f7715 1022 return true;
9898b929
JG
1023}
1024
6d4f7715 1025static boolean
57a1867e
DM
1026srec_write_terminator (abfd, tdata)
1027 bfd *abfd;
1028 tdata_type *tdata;
9783e04a 1029{
7f4c005d 1030 bfd_byte buffer[2];
9783e04a 1031
6d4f7715
ILT
1032 return srec_write_record (abfd, 10 - tdata->type,
1033 abfd->start_address, buffer, buffer);
9898b929 1034}
3039e8ee 1035
8f8fefcc 1036
9783e04a 1037
6d4f7715 1038static boolean
9783e04a 1039srec_write_symbols (abfd)
2c3b9e47 1040 bfd *abfd;
9898b929 1041{
8f8fefcc
JG
1042 char buffer[MAXCHUNK];
1043 /* Dump out the symbols of a bfd */
1044 int i;
2f3508ad 1045 int count = bfd_get_symcount (abfd);
8f8fefcc 1046
2f3508ad 1047 if (count)
9783e04a 1048 {
6d4f7715 1049 size_t len;
9783e04a
DM
1050 asymbol **table = bfd_get_outsymbols (abfd);
1051 sprintf (buffer, "$$ %s\r\n", abfd->filename);
8f8fefcc 1052
2f3508ad 1053 len = strlen (buffer);
6d4f7715
ILT
1054 if (bfd_write (buffer, len, 1, abfd) != len)
1055 return false;
8f8fefcc 1056
2f3508ad 1057 for (i = 0; i < count; i++)
9783e04a
DM
1058 {
1059 asymbol *s = table[i];
8f8fefcc 1060#if 0
9783e04a 1061 int len = strlen (s->name);
8f8fefcc 1062
9783e04a 1063 /* If this symbol has a .[ocs] in it, it's probably a file name
8f8fefcc
JG
1064 and we'll output that as the module name */
1065
9783e04a
DM
1066 if (len > 3 && s->name[len - 2] == '.')
1067 {
1068 int l;
1069 sprintf (buffer, "$$ %s\r\n", s->name);
1070 l = strlen (buffer);
6d4f7715
ILT
1071 if (bfd_write (buffer, l, 1, abfd) != l)
1072 return false;
9783e04a
DM
1073 }
1074 else
8f8fefcc 1075#endif
9783e04a
DM
1076 if (s->flags & (BSF_GLOBAL | BSF_LOCAL)
1077 && (s->flags & BSF_DEBUGGING) == 0
1078 && s->name[0] != '.'
1079 && s->name[0] != 't')
1080 {
1081 /* Just dump out non debug symbols */
ae115e51 1082 bfd_size_type l;
9783e04a
DM
1083 char buf2[40], *p;
1084
1085 sprintf_vma (buf2,
1086 s->value + s->section->output_section->lma
1087 + s->section->output_offset);
1088 p = buf2;
1089 while (p[0] == '0' && p[1] != 0)
1090 p++;
1091 sprintf (buffer, " %s $%s\r\n", s->name, p);
1092 l = strlen (buffer);
6d4f7715
ILT
1093 if (bfd_write (buffer, l, 1, abfd) != l)
1094 return false;
9783e04a
DM
1095 }
1096 }
1097 sprintf (buffer, "$$ \r\n");
2f3508ad 1098 len = strlen (buffer);
6d4f7715
ILT
1099 if (bfd_write (buffer, len, 1, abfd) != len)
1100 return false;
8f8fefcc 1101 }
6d4f7715
ILT
1102
1103 return true;
9898b929
JG
1104}
1105
9898b929 1106static boolean
9783e04a 1107internal_srec_write_object_contents (abfd, symbols)
8f8fefcc
JG
1108 bfd *abfd;
1109 int symbols;
4a81b561 1110{
9783e04a
DM
1111 tdata_type *tdata = abfd->tdata.srec_data;
1112 srec_data_list_type *list;
9898b929 1113
9783e04a 1114 if (symbols)
6d4f7715
ILT
1115 {
1116 if (! srec_write_symbols (abfd))
1117 return false;
1118 }
8f8fefcc 1119
6d4f7715
ILT
1120 if (! srec_write_header (abfd))
1121 return false;
8f8fefcc 1122
9783e04a
DM
1123 /* Now wander though all the sections provided and output them */
1124 list = tdata->head;
9898b929 1125
9783e04a 1126 while (list != (srec_data_list_type *) NULL)
9898b929 1127 {
6d4f7715
ILT
1128 if (! srec_write_section (abfd, tdata, list))
1129 return false;
9783e04a 1130 list = list->next;
9898b929 1131 }
6d4f7715 1132 return srec_write_terminator (abfd, tdata);
4a81b561
DHW
1133}
1134
8f8fefcc 1135static boolean
9783e04a 1136srec_write_object_contents (abfd)
8f8fefcc
JG
1137 bfd *abfd;
1138{
9783e04a 1139 return internal_srec_write_object_contents (abfd, 0);
8f8fefcc
JG
1140}
1141
1142static boolean
9783e04a 1143symbolsrec_write_object_contents (abfd)
8f8fefcc
JG
1144 bfd *abfd;
1145{
9783e04a 1146 return internal_srec_write_object_contents (abfd, 1);
8f8fefcc
JG
1147}
1148
9783e04a
DM
1149/*ARGSUSED*/
1150static int
57a1867e
DM
1151srec_sizeof_headers (abfd, exec)
1152 bfd *abfd;
1153 boolean exec;
39a2ce33 1154{
9783e04a 1155 return 0;
39a2ce33
SC
1156}
1157
357a1f38 1158static asymbol *
57a1867e
DM
1159srec_make_empty_symbol (abfd)
1160 bfd *abfd;
357a1f38 1161{
9783e04a
DM
1162 asymbol *new = (asymbol *) bfd_zalloc (abfd, sizeof (asymbol));
1163 if (new)
1164 new->the_bfd = abfd;
357a1f38
SC
1165 return new;
1166}
8f8fefcc 1167
7f4c005d
KR
1168/* Return the amount of memory needed to read the symbol table. */
1169
326e32d7 1170static long
9783e04a
DM
1171srec_get_symtab_upper_bound (abfd)
1172 bfd *abfd;
8f8fefcc 1173{
7f4c005d 1174 return (bfd_get_symcount (abfd) + 1) * sizeof (asymbol *);
8f8fefcc
JG
1175}
1176
7f4c005d
KR
1177/* Return the symbol table. */
1178
326e32d7 1179static long
57a1867e
DM
1180srec_get_symtab (abfd, alocation)
1181 bfd *abfd;
1182 asymbol **alocation;
8f8fefcc 1183{
7f4c005d
KR
1184 unsigned int symcount = bfd_get_symcount (abfd);
1185 asymbol *csymbols;
1186 unsigned int i;
1187
1188 csymbols = abfd->tdata.srec_data->csymbols;
1189 if (csymbols == NULL)
9783e04a 1190 {
7f4c005d
KR
1191 asymbol *c;
1192 struct srec_symbol *s;
1193
1194 csymbols = (asymbol *) bfd_alloc (abfd, symcount * sizeof (asymbol));
1195 if (csymbols == NULL && symcount != 0)
a9713b91 1196 return false;
7f4c005d
KR
1197 abfd->tdata.srec_data->csymbols = csymbols;
1198
1199 for (s = abfd->tdata.srec_data->symbols, c = csymbols;
1200 s != NULL;
1201 s = s->next, ++c)
1202 {
1203 c->the_bfd = abfd;
1204 c->name = s->name;
1205 c->value = s->val;
1206 c->flags = BSF_GLOBAL;
1207 c->section = bfd_abs_section_ptr;
1208 c->udata.p = NULL;
1209 }
9783e04a 1210 }
7f4c005d
KR
1211
1212 for (i = 0; i < symcount; i++)
1213 *alocation++ = csymbols++;
1214 *alocation = NULL;
1215
1216 return symcount;
8f8fefcc
JG
1217}
1218
9783e04a
DM
1219/*ARGSUSED*/
1220void
57a1867e
DM
1221srec_get_symbol_info (ignore_abfd, symbol, ret)
1222 bfd *ignore_abfd;
1223 asymbol *symbol;
1224 symbol_info *ret;
2c3b9e47
KR
1225{
1226 bfd_symbol_info (symbol, ret);
1227}
1228
9783e04a 1229/*ARGSUSED*/
0103b447 1230static void
57a1867e
DM
1231srec_print_symbol (ignore_abfd, afile, symbol, how)
1232 bfd *ignore_abfd;
1233 PTR afile;
1234 asymbol *symbol;
1235 bfd_print_symbol_type how;
9783e04a
DM
1236{
1237 FILE *file = (FILE *) afile;
1238 switch (how)
1239 {
1240 case bfd_print_symbol_name:
1241 fprintf (file, "%s", symbol->name);
1242 break;
1243 default:
1244 bfd_print_symbol_vandf ((PTR) file, symbol);
1245 fprintf (file, " %-5s %s",
1246 symbol->section->name,
1247 symbol->name);
8f8fefcc 1248
9783e04a 1249 }
8f8fefcc
JG
1250}
1251
6812b607
ILT
1252#define srec_close_and_cleanup _bfd_generic_close_and_cleanup
1253#define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
1254#define srec_new_section_hook _bfd_generic_new_section_hook
9872a49c 1255
0103b447 1256#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
6812b607
ILT
1257#define srec_get_lineno _bfd_nosymbols_get_lineno
1258#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
1259#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
c3246d9b
ILT
1260#define srec_read_minisymbols _bfd_generic_read_minisymbols
1261#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
d0ec7a8e 1262
7f4c005d
KR
1263#define srec_get_reloc_upper_bound \
1264 ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
1265#define srec_canonicalize_reloc \
1266 ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
1267#define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
1268
a9713b91
ILT
1269#define srec_get_section_contents_in_window \
1270 _bfd_generic_get_section_contents_in_window
1271
6812b607
ILT
1272#define srec_bfd_get_relocated_section_contents \
1273 bfd_generic_get_relocated_section_contents
294eaca4 1274#define srec_bfd_relax_section bfd_generic_relax_section
4c3721d5
ILT
1275#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
1276#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
1277#define srec_bfd_final_link _bfd_generic_final_link
c3246d9b 1278#define srec_bfd_link_split_section _bfd_generic_link_split_section
3039e8ee 1279
2f3508ad 1280const bfd_target srec_vec =
4a81b561 1281{
9783e04a
DM
1282 "srec", /* name */
1283 bfd_target_srec_flavour,
0103b447
ILT
1284 BFD_ENDIAN_UNKNOWN, /* target byte order */
1285 BFD_ENDIAN_UNKNOWN, /* target headers byte order */
9783e04a
DM
1286 (HAS_RELOC | EXEC_P | /* object flags */
1287 HAS_LINENO | HAS_DEBUG |
1288 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
1289 (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
1290 | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
1291 0, /* leading underscore */
1292 ' ', /* ar_pad_char */
1293 16, /* ar_max_namelen */
9783e04a
DM
1294 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
1295 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
1296 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
1297 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
1298 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
1299 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
9898b929
JG
1300
1301 {
9783e04a
DM
1302 _bfd_dummy_target,
1303 srec_object_p, /* bfd_check_format */
2f3508ad
ILT
1304 _bfd_dummy_target,
1305 _bfd_dummy_target,
9898b929
JG
1306 },
1307 {
9783e04a
DM
1308 bfd_false,
1309 srec_mkobject,
1310 _bfd_generic_mkarchive,
1311 bfd_false,
9898b929
JG
1312 },
1313 { /* bfd_write_contents */
9783e04a
DM
1314 bfd_false,
1315 srec_write_object_contents,
1316 _bfd_write_archive_contents,
1317 bfd_false,
9898b929 1318 },
6812b607
ILT
1319
1320 BFD_JUMP_TABLE_GENERIC (srec),
1321 BFD_JUMP_TABLE_COPY (_bfd_generic),
1322 BFD_JUMP_TABLE_CORE (_bfd_nocore),
1323 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
1324 BFD_JUMP_TABLE_SYMBOLS (srec),
7f4c005d 1325 BFD_JUMP_TABLE_RELOCS (srec),
6812b607
ILT
1326 BFD_JUMP_TABLE_WRITE (srec),
1327 BFD_JUMP_TABLE_LINK (srec),
dfc1c006 1328 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
6812b607
ILT
1329
1330 (PTR) 0
9783e04a 1331};
9898b929 1332
8f8fefcc
JG
1333
1334
2f3508ad 1335const bfd_target symbolsrec_vec =
8f8fefcc 1336{
9783e04a
DM
1337 "symbolsrec", /* name */
1338 bfd_target_srec_flavour,
0103b447
ILT
1339 BFD_ENDIAN_UNKNOWN, /* target byte order */
1340 BFD_ENDIAN_UNKNOWN, /* target headers byte order */
9783e04a
DM
1341 (HAS_RELOC | EXEC_P | /* object flags */
1342 HAS_LINENO | HAS_DEBUG |
1343 HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
1344 (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
1345 | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
1346 0, /* leading underscore */
1347 ' ', /* ar_pad_char */
1348 16, /* ar_max_namelen */
9783e04a
DM
1349 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
1350 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
1351 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
1352 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
1353 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
1354 bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
8f8fefcc
JG
1355
1356 {
9783e04a
DM
1357 _bfd_dummy_target,
1358 symbolsrec_object_p, /* bfd_check_format */
2f3508ad
ILT
1359 _bfd_dummy_target,
1360 _bfd_dummy_target,
8f8fefcc
JG
1361 },
1362 {
9783e04a
DM
1363 bfd_false,
1364 srec_mkobject,
1365 _bfd_generic_mkarchive,
1366 bfd_false,
8f8fefcc
JG
1367 },
1368 { /* bfd_write_contents */
9783e04a
DM
1369 bfd_false,
1370 symbolsrec_write_object_contents,
1371 _bfd_write_archive_contents,
1372 bfd_false,
8f8fefcc 1373 },
6812b607
ILT
1374
1375 BFD_JUMP_TABLE_GENERIC (srec),
1376 BFD_JUMP_TABLE_COPY (_bfd_generic),
1377 BFD_JUMP_TABLE_CORE (_bfd_nocore),
1378 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
1379 BFD_JUMP_TABLE_SYMBOLS (srec),
7f4c005d 1380 BFD_JUMP_TABLE_RELOCS (srec),
6812b607
ILT
1381 BFD_JUMP_TABLE_WRITE (srec),
1382 BFD_JUMP_TABLE_LINK (srec),
dfc1c006 1383 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
6812b607 1384
9783e04a
DM
1385 (PTR) 0
1386};
This page took 0.356306 seconds and 4 git commands to generate.