1 /* BFD back-end for s-record objects.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3 Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
27 Ordinary S-Records cannot hold anything but addresses and
28 data, so that's all that we implement.
30 The only interesting thing is that S-Records may come out of
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
34 arbitrarily call this section ".text".
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
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.
43 An s record looks like:
46 S<type><length><address><data><checksum>
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.
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
65 is the start address of the data following, or in the case of
66 a termination record, the start address of the image
70 is the sum of all the raw byte data in the record, from the length
71 upwards, modulo 256 and subtracted from 255.
75 Symbol S-Record handling
78 Some ICE equipment understands an addition to the standard
79 S-Record format; symbols and their addresses can be sent
82 The format of this is:
84 (<space> <symbol> <address>)*)
87 so a short symbol table could look like:
101 We allow symbols to be anywhere in the data stream - the module names
109 #include "libiberty.h"
111 static void srec_init
PARAMS ((void));
112 static boolean srec_mkobject
PARAMS ((bfd
*));
113 static int srec_get_byte
PARAMS ((bfd
*, boolean
*));
114 static void srec_bad_byte
PARAMS ((bfd
*, unsigned int, int, boolean
));
115 static boolean srec_scan
PARAMS ((bfd
*));
116 static const bfd_target
*srec_object_p
PARAMS ((bfd
*));
117 static const bfd_target
*symbolsrec_object_p
PARAMS ((bfd
*));
118 static boolean srec_read_section
PARAMS ((bfd
*, asection
*, bfd_byte
*));
120 static boolean srec_write_record
PARAMS ((bfd
*, int, bfd_vma
,
123 static boolean srec_write_header
PARAMS ((bfd
*));
124 static boolean srec_write_symbols
PARAMS ((bfd
*));
126 /* Macros for converting between hex and binary. */
128 static CONST
char digs
[] = "0123456789ABCDEF";
130 #define NIBBLE(x) hex_value(x)
131 #define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
132 #define TOHEX(d, x, ch) \
133 d[1] = digs[(x) & 0xf]; \
134 d[0] = digs[((x)>>4)&0xf]; \
136 #define ISHEX(x) hex_p(x)
138 /* Initialize by filling in the hex conversion array. */
143 static boolean inited
= false;
152 /* The maximum number of bytes on a line is FF */
153 #define MAXCHUNK 0xff
154 /* The number of bytes we fit onto a line on output */
157 /* When writing an S-record file, the S-records can not be output as
158 they are seen. This structure is used to hold them in memory. */
160 struct srec_data_list_struct
162 struct srec_data_list_struct
*next
;
168 typedef struct srec_data_list_struct srec_data_list_type
;
170 /* When scanning the S-record file, a linked list of srec_symbol
171 structures is built to represent the symbol table (if there is
176 struct srec_symbol
*next
;
181 /* The S-record tdata information. */
183 typedef struct srec_data_struct
185 srec_data_list_type
*head
;
186 srec_data_list_type
*tail
;
188 struct srec_symbol
*symbols
;
189 struct srec_symbol
*symtail
;
194 static boolean srec_write_section
PARAMS ((bfd
*, tdata_type
*,
195 srec_data_list_type
*));
196 static boolean srec_write_terminator
PARAMS ((bfd
*, tdata_type
*));
198 /* Set up the S-record tdata information. */
206 if (abfd
->tdata
.srec_data
== NULL
)
208 tdata_type
*tdata
= (tdata_type
*) bfd_alloc (abfd
, sizeof (tdata_type
));
211 bfd_set_error (bfd_error_no_memory
);
214 abfd
->tdata
.srec_data
= tdata
;
218 tdata
->symbols
= NULL
;
219 tdata
->symtail
= NULL
;
220 tdata
->csymbols
= NULL
;
226 /* Read a byte from an S record file. Set *ERRORPTR if an error
227 occurred. Return EOF on error or end of file. */
230 srec_get_byte (abfd
, errorptr
)
236 if (bfd_read (&c
, 1, 1, abfd
) != 1)
238 if (bfd_get_error () != bfd_error_file_truncated
)
243 return (int) (c
& 0xff);
246 /* Report a problem in an S record file. FIXME: This probably should
247 not call fprintf, but we really do need some mechanism for printing
251 srec_bad_byte (abfd
, lineno
, c
, error
)
260 bfd_set_error (bfd_error_file_truncated
);
267 sprintf (buf
, "\\%03o", (unsigned int) c
);
273 fprintf (stderr
, "%s:%d: Unexpected character `%s' in S-record file\n",
274 bfd_get_filename (abfd
), lineno
, buf
);
275 bfd_set_error (bfd_error_bad_value
);
279 /* Add a new symbol found in an S-record file. */
282 srec_new_symbol (abfd
, name
, val
)
287 struct srec_symbol
*n
;
289 n
= (struct srec_symbol
*) bfd_alloc (abfd
, sizeof (struct srec_symbol
));
292 bfd_set_error (bfd_error_no_memory
);
299 if (abfd
->tdata
.srec_data
->symbols
== NULL
)
300 abfd
->tdata
.srec_data
->symbols
= n
;
302 abfd
->tdata
.srec_data
->symtail
->next
= n
;
303 abfd
->tdata
.srec_data
->symtail
= n
;
311 /* Read the S record file and turn it into sections. We create a new
312 section for each contiguous set of bytes. */
319 unsigned int lineno
= 1;
320 boolean error
= false;
321 bfd_byte
*buf
= NULL
;
323 asection
*sec
= NULL
;
325 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
328 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
)
330 /* We only build sections from contiguous S-records, so if this
331 is not an S-record, then stop building a section. */
332 if (c
!= 'S' && c
!= '\r' && c
!= '\n')
338 srec_bad_byte (abfd
, lineno
, c
, error
);
349 /* Starting a module name, which we ignore. */
350 while ((c
= srec_get_byte (abfd
, &error
)) != '\n'
355 srec_bad_byte (abfd
, lineno
, c
, error
);
368 /* Starting a symbol definition. */
369 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
370 && (c
== ' ' || c
== '\t'))
374 srec_bad_byte (abfd
, lineno
, c
, error
);
378 obstack_1grow (&abfd
->memory
, c
);
379 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
381 obstack_1grow (&abfd
->memory
, c
);
384 srec_bad_byte (abfd
, lineno
, c
, error
);
388 symname
= obstack_finish (&abfd
->memory
);
391 bfd_set_error (bfd_error_no_memory
);
395 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
396 && (c
== ' ' || c
== '\t'))
400 srec_bad_byte (abfd
, lineno
, c
, error
);
404 /* Skip a dollar sign before the hex value. */
407 c
= srec_get_byte (abfd
, &error
);
410 srec_bad_byte (abfd
, lineno
, c
, error
);
419 symval
+= NIBBLE (c
);
420 c
= srec_get_byte (abfd
, &error
);
423 if (c
== EOF
|| ! isspace (c
))
425 srec_bad_byte (abfd
, lineno
, c
, error
);
429 if (! srec_new_symbol (abfd
, symname
, symval
))
446 /* Starting an S-record. */
448 pos
= bfd_tell (abfd
) - 1;
450 if (bfd_read (hdr
, 1, 3, abfd
) != 3)
453 if (! ISHEX (hdr
[1]) || ! ISHEX (hdr
[2]))
455 if (! ISHEX (hdr
[1]))
459 srec_bad_byte (abfd
, lineno
, c
, error
);
463 bytes
= HEX (hdr
+ 1);
464 if (bytes
* 2 > bufsize
)
468 buf
= (bfd_byte
*) malloc (bytes
* 2);
471 bfd_set_error (bfd_error_no_memory
);
477 if (bfd_read (buf
, 1, bytes
* 2, abfd
) != bytes
* 2)
480 /* Ignore the checksum byte. */
489 /* Prologue--ignore the file name, but stop building a
490 section at this point. */
495 address
= HEX (data
);
500 address
= (address
<< 8) | HEX (data
);
505 address
= (address
<< 8) | HEX (data
);
507 address
= (address
<< 8) | HEX (data
);
512 && sec
->vma
+ sec
->_raw_size
== address
)
514 /* This data goes at the end of the section we are
515 currently building. */
516 sec
->_raw_size
+= bytes
;
523 sprintf (secbuf
, ".sec%d", bfd_count_sections (abfd
) + 1);
524 secname
= (char *) bfd_alloc (abfd
, strlen (secbuf
) + 1);
525 strcpy (secname
, secbuf
);
526 sec
= bfd_make_section (abfd
, secname
);
529 sec
->flags
= SEC_HAS_CONTENTS
| SEC_LOAD
| SEC_ALLOC
;
531 sec
->_raw_size
= bytes
;
538 address
= HEX (data
);
542 address
= (address
<< 8) | HEX (data
);
546 address
= (address
<< 8) | HEX (data
);
548 address
= (address
<< 8) | HEX (data
);
551 /* This is a termination record. */
552 abfd
->start_address
= address
;
578 /* Check whether an existing file is an S-record file. */
580 static const bfd_target
*
588 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0
589 || bfd_read (b
, 1, 4, abfd
) != 4)
592 if (b
[0] != 'S' || !ISHEX (b
[1]) || !ISHEX (b
[2]) || !ISHEX (b
[3]))
594 bfd_set_error (bfd_error_wrong_format
);
598 if (! srec_mkobject (abfd
)
599 || ! srec_scan (abfd
))
605 /* Check whether an existing file is an S-record file with symbols. */
607 static const bfd_target
*
608 symbolsrec_object_p (abfd
)
615 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0
616 || bfd_read (b
, 1, 2, abfd
) != 2)
619 if (b
[0] != '$' || b
[1] != '$')
621 bfd_set_error (bfd_error_wrong_format
);
625 if (! srec_mkobject (abfd
)
626 || ! srec_scan (abfd
))
632 /* Read in the contents of a section in an S-record file. */
635 srec_read_section (abfd
, section
, contents
)
641 bfd_size_type sofar
= 0;
642 boolean error
= false;
643 bfd_byte
*buf
= NULL
;
646 if (bfd_seek (abfd
, section
->filepos
, SEEK_SET
) != 0)
649 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
)
656 if (c
== '\r' || c
== '\n')
659 /* This is called after srec_scan has already been called, so we
660 ought to know the exact format. */
661 BFD_ASSERT (c
== 'S');
663 if (bfd_read (hdr
, 1, 3, abfd
) != 3)
666 BFD_ASSERT (ISHEX (hdr
[1]) && ISHEX (hdr
[2]));
668 bytes
= HEX (hdr
+ 1);
670 if (bytes
* 2 > bufsize
)
674 buf
= (bfd_byte
*) malloc (bytes
* 2);
677 bfd_set_error (bfd_error_no_memory
);
683 if (bfd_read (buf
, 1, bytes
* 2, abfd
) != bytes
* 2)
691 BFD_ASSERT (sofar
== section
->_raw_size
);
697 address
= HEX (data
);
702 address
= (address
<< 8) | HEX (data
);
707 address
= (address
<< 8) | HEX (data
);
709 address
= (address
<< 8) | HEX (data
);
713 if (address
!= section
->vma
+ sofar
)
715 /* We've come to the end of this section. */
716 BFD_ASSERT (sofar
== section
->_raw_size
);
722 /* Don't consider checksum. */
727 contents
[sofar
] = HEX (data
);
739 BFD_ASSERT (sofar
== section
->_raw_size
);
752 /* Get the contents of a section in an S-record file. */
755 srec_get_section_contents (abfd
, section
, location
, offset
, count
)
762 if (section
->used_by_bfd
== NULL
)
764 section
->used_by_bfd
= bfd_alloc (abfd
, section
->_raw_size
);
765 if (section
->used_by_bfd
== NULL
766 && section
->_raw_size
!= 0)
768 bfd_set_error (bfd_error_no_memory
);
772 if (! srec_read_section (abfd
, section
, section
->used_by_bfd
))
776 memcpy (location
, (bfd_byte
*) section
->used_by_bfd
+ offset
, count
);
781 /* we have to save up all the Srecords for a splurge before output */
784 srec_set_section_contents (abfd
, section
, location
, offset
, bytes_to_do
)
789 bfd_size_type bytes_to_do
;
791 tdata_type
*tdata
= abfd
->tdata
.srec_data
;
792 register srec_data_list_type
*entry
;
794 entry
= ((srec_data_list_type
*)
795 bfd_alloc (abfd
, sizeof (srec_data_list_type
)));
798 bfd_set_error (bfd_error_no_memory
);
803 && (section
->flags
& SEC_ALLOC
)
804 && (section
->flags
& SEC_LOAD
))
806 bfd_byte
*data
= (bfd_byte
*) bfd_alloc (abfd
, bytes_to_do
);
809 bfd_set_error (bfd_error_no_memory
);
812 memcpy ((PTR
) data
, location
, bytes_to_do
);
814 if ((section
->lma
+ offset
+ bytes_to_do
- 1) <= 0xffff)
818 else if ((section
->lma
+ offset
+ bytes_to_do
- 1) <= 0xffffff
829 entry
->where
= section
->lma
+ offset
;
830 entry
->size
= bytes_to_do
;
832 /* Sort the records by address. Optimize for the common case of
833 adding a record to the end of the list. */
834 if (tdata
->tail
!= NULL
835 && entry
->where
>= tdata
->tail
->where
)
837 tdata
->tail
->next
= entry
;
843 register srec_data_list_type
**look
;
845 for (look
= &tdata
->head
;
846 *look
!= NULL
&& (*look
)->where
< entry
->where
;
847 look
= &(*look
)->next
)
851 if (entry
->next
== NULL
)
858 /* Write a record of type, of the supplied number of bytes. The
859 supplied bytes and length don't have a checksum. That's worked out
863 srec_write_record (abfd
, type
, address
, data
, end
)
867 const bfd_byte
*data
;
870 char buffer
[MAXCHUNK
];
871 unsigned int check_sum
= 0;
872 CONST bfd_byte
*src
= data
;
880 dst
+= 2; /* leave room for dst*/
886 TOHEX (dst
, (address
>> 24), check_sum
);
890 TOHEX (dst
, (address
>> 16), check_sum
);
895 TOHEX (dst
, (address
>> 8), check_sum
);
897 TOHEX (dst
, (address
), check_sum
);
902 for (src
= data
; src
< end
; src
++)
904 TOHEX (dst
, *src
, check_sum
);
908 /* Fill in the length */
909 TOHEX (length
, (dst
- length
) / 2, check_sum
);
911 check_sum
= 255 - check_sum
;
912 TOHEX (dst
, check_sum
, check_sum
);
917 if (bfd_write ((PTR
) buffer
, 1, dst
- buffer
, abfd
) != dst
- buffer
)
925 srec_write_header (abfd
)
928 bfd_byte buffer
[MAXCHUNK
];
929 bfd_byte
*dst
= buffer
;
932 /* I'll put an arbitary 40 char limit on header size */
933 for (i
= 0; i
< 40 && abfd
->filename
[i
]; i
++)
935 *dst
++ = abfd
->filename
[i
];
937 return srec_write_record (abfd
, 0, 0, buffer
, dst
);
941 srec_write_section (abfd
, tdata
, list
)
944 srec_data_list_type
*list
;
946 unsigned int bytes_written
= 0;
947 bfd_byte
*location
= list
->data
;
949 while (bytes_written
< list
->size
)
953 unsigned int bytes_this_chunk
= list
->size
- bytes_written
;
955 if (bytes_this_chunk
> CHUNK
)
957 bytes_this_chunk
= CHUNK
;
960 address
= list
->where
+ bytes_written
;
962 if (! srec_write_record (abfd
,
966 location
+ bytes_this_chunk
))
969 bytes_written
+= bytes_this_chunk
;
970 location
+= bytes_this_chunk
;
977 srec_write_terminator (abfd
, tdata
)
983 return srec_write_record (abfd
, 10 - tdata
->type
,
984 abfd
->start_address
, buffer
, buffer
);
990 srec_write_symbols (abfd
)
993 char buffer
[MAXCHUNK
];
994 /* Dump out the symbols of a bfd */
996 int count
= bfd_get_symcount (abfd
);
1001 asymbol
**table
= bfd_get_outsymbols (abfd
);
1002 sprintf (buffer
, "$$ %s\r\n", abfd
->filename
);
1004 len
= strlen (buffer
);
1005 if (bfd_write (buffer
, len
, 1, abfd
) != len
)
1008 for (i
= 0; i
< count
; i
++)
1010 asymbol
*s
= table
[i
];
1012 int len
= strlen (s
->name
);
1014 /* If this symbol has a .[ocs] in it, it's probably a file name
1015 and we'll output that as the module name */
1017 if (len
> 3 && s
->name
[len
- 2] == '.')
1020 sprintf (buffer
, "$$ %s\r\n", s
->name
);
1021 l
= strlen (buffer
);
1022 if (bfd_write (buffer
, l
, 1, abfd
) != l
)
1027 if (s
->flags
& (BSF_GLOBAL
| BSF_LOCAL
)
1028 && (s
->flags
& BSF_DEBUGGING
) == 0
1029 && s
->name
[0] != '.'
1030 && s
->name
[0] != 't')
1032 /* Just dump out non debug symbols */
1038 s
->value
+ s
->section
->output_section
->lma
1039 + s
->section
->output_offset
);
1041 while (p
[0] == '0' && p
[1] != 0)
1043 sprintf (buffer
, " %s $%s\r\n", s
->name
, p
);
1044 l
= strlen (buffer
);
1045 if (bfd_write (buffer
, l
, 1, abfd
) != l
)
1049 sprintf (buffer
, "$$ \r\n");
1050 len
= strlen (buffer
);
1051 if (bfd_write (buffer
, len
, 1, abfd
) != len
)
1059 internal_srec_write_object_contents (abfd
, symbols
)
1063 tdata_type
*tdata
= abfd
->tdata
.srec_data
;
1064 srec_data_list_type
*list
;
1068 if (! srec_write_symbols (abfd
))
1072 if (! srec_write_header (abfd
))
1075 /* Now wander though all the sections provided and output them */
1078 while (list
!= (srec_data_list_type
*) NULL
)
1080 if (! srec_write_section (abfd
, tdata
, list
))
1084 return srec_write_terminator (abfd
, tdata
);
1088 srec_write_object_contents (abfd
)
1091 return internal_srec_write_object_contents (abfd
, 0);
1095 symbolsrec_write_object_contents (abfd
)
1098 return internal_srec_write_object_contents (abfd
, 1);
1103 srec_sizeof_headers (abfd
, exec
)
1111 srec_make_empty_symbol (abfd
)
1114 asymbol
*new = (asymbol
*) bfd_zalloc (abfd
, sizeof (asymbol
));
1116 new->the_bfd
= abfd
;
1120 /* Return the amount of memory needed to read the symbol table. */
1123 srec_get_symtab_upper_bound (abfd
)
1126 return (bfd_get_symcount (abfd
) + 1) * sizeof (asymbol
*);
1129 /* Return the symbol table. */
1132 srec_get_symtab (abfd
, alocation
)
1134 asymbol
**alocation
;
1136 unsigned int symcount
= bfd_get_symcount (abfd
);
1140 csymbols
= abfd
->tdata
.srec_data
->csymbols
;
1141 if (csymbols
== NULL
)
1144 struct srec_symbol
*s
;
1146 csymbols
= (asymbol
*) bfd_alloc (abfd
, symcount
* sizeof (asymbol
));
1147 if (csymbols
== NULL
&& symcount
!= 0)
1149 bfd_set_error (bfd_error_no_memory
);
1152 abfd
->tdata
.srec_data
->csymbols
= csymbols
;
1154 for (s
= abfd
->tdata
.srec_data
->symbols
, c
= csymbols
;
1161 c
->flags
= BSF_GLOBAL
;
1162 c
->section
= bfd_abs_section_ptr
;
1167 for (i
= 0; i
< symcount
; i
++)
1168 *alocation
++ = csymbols
++;
1176 srec_get_symbol_info (ignore_abfd
, symbol
, ret
)
1181 bfd_symbol_info (symbol
, ret
);
1186 srec_print_symbol (ignore_abfd
, afile
, symbol
, how
)
1190 bfd_print_symbol_type how
;
1192 FILE *file
= (FILE *) afile
;
1195 case bfd_print_symbol_name
:
1196 fprintf (file
, "%s", symbol
->name
);
1199 bfd_print_symbol_vandf ((PTR
) file
, symbol
);
1200 fprintf (file
, " %-5s %s",
1201 symbol
->section
->name
,
1207 #define srec_close_and_cleanup _bfd_generic_close_and_cleanup
1208 #define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
1209 #define srec_new_section_hook _bfd_generic_new_section_hook
1211 #define srec_bfd_is_local_label bfd_generic_is_local_label
1212 #define srec_get_lineno _bfd_nosymbols_get_lineno
1213 #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
1214 #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
1215 #define srec_read_minisymbols _bfd_generic_read_minisymbols
1216 #define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
1218 #define srec_get_reloc_upper_bound \
1219 ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
1220 #define srec_canonicalize_reloc \
1221 ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
1222 #define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
1224 #define srec_set_arch_mach bfd_default_set_arch_mach
1226 #define srec_bfd_get_relocated_section_contents \
1227 bfd_generic_get_relocated_section_contents
1228 #define srec_bfd_relax_section bfd_generic_relax_section
1229 #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
1230 #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
1231 #define srec_bfd_final_link _bfd_generic_final_link
1232 #define srec_bfd_link_split_section _bfd_generic_link_split_section
1234 const bfd_target srec_vec
=
1237 bfd_target_srec_flavour
,
1238 true, /* target byte order */
1239 true, /* target headers byte order */
1240 (HAS_RELOC
| EXEC_P
| /* object flags */
1241 HAS_LINENO
| HAS_DEBUG
|
1242 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
1243 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
1244 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
1245 0, /* leading underscore */
1246 ' ', /* ar_pad_char */
1247 16, /* ar_max_namelen */
1248 1, /* minimum alignment */
1249 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1250 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1251 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
1252 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1253 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1254 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
1258 srec_object_p
, /* bfd_check_format */
1265 _bfd_generic_mkarchive
,
1268 { /* bfd_write_contents */
1270 srec_write_object_contents
,
1271 _bfd_write_archive_contents
,
1275 BFD_JUMP_TABLE_GENERIC (srec
),
1276 BFD_JUMP_TABLE_COPY (_bfd_generic
),
1277 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
1278 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
1279 BFD_JUMP_TABLE_SYMBOLS (srec
),
1280 BFD_JUMP_TABLE_RELOCS (srec
),
1281 BFD_JUMP_TABLE_WRITE (srec
),
1282 BFD_JUMP_TABLE_LINK (srec
),
1283 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),
1290 const bfd_target symbolsrec_vec
=
1292 "symbolsrec", /* name */
1293 bfd_target_srec_flavour
,
1294 true, /* target byte order */
1295 true, /* target headers byte order */
1296 (HAS_RELOC
| EXEC_P
| /* object flags */
1297 HAS_LINENO
| HAS_DEBUG
|
1298 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
1299 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
1300 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
1301 0, /* leading underscore */
1302 ' ', /* ar_pad_char */
1303 16, /* ar_max_namelen */
1304 1, /* minimum alignment */
1305 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1306 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1307 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
1308 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1309 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1310 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
1314 symbolsrec_object_p
, /* bfd_check_format */
1321 _bfd_generic_mkarchive
,
1324 { /* bfd_write_contents */
1326 symbolsrec_write_object_contents
,
1327 _bfd_write_archive_contents
,
1331 BFD_JUMP_TABLE_GENERIC (srec
),
1332 BFD_JUMP_TABLE_COPY (_bfd_generic
),
1333 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
1334 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
1335 BFD_JUMP_TABLE_SYMBOLS (srec
),
1336 BFD_JUMP_TABLE_RELOCS (srec
),
1337 BFD_JUMP_TABLE_WRITE (srec
),
1338 BFD_JUMP_TABLE_LINK (srec
),
1339 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),