1 /* BFD back-end for s-record objects.
2 Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 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"
112 static void srec_print_symbol
113 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
114 static void srec_init
PARAMS ((void));
115 static boolean srec_mkobject
PARAMS ((bfd
*));
116 static int srec_get_byte
PARAMS ((bfd
*, boolean
*));
117 static void srec_bad_byte
PARAMS ((bfd
*, unsigned int, int, boolean
));
118 static boolean srec_scan
PARAMS ((bfd
*));
119 static const bfd_target
*srec_object_p
PARAMS ((bfd
*));
120 static const bfd_target
*symbolsrec_object_p
PARAMS ((bfd
*));
121 static boolean srec_read_section
PARAMS ((bfd
*, asection
*, bfd_byte
*));
123 static boolean srec_write_record
PARAMS ((bfd
*, int, bfd_vma
,
126 static boolean srec_write_header
PARAMS ((bfd
*));
127 static boolean srec_write_symbols
PARAMS ((bfd
*));
128 static boolean srec_new_symbol
PARAMS ((bfd
*, const char *, bfd_vma
));
129 static boolean srec_get_section_contents
130 PARAMS ((bfd
*, asection
*, PTR
, file_ptr
, bfd_size_type
));
131 static boolean srec_set_arch_mach
132 PARAMS ((bfd
*, enum bfd_architecture
, unsigned long));
133 static boolean srec_set_section_contents
134 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
135 static boolean internal_srec_write_object_contents
PARAMS ((bfd
*, int));
136 static boolean srec_write_object_contents
PARAMS ((bfd
*));
137 static boolean symbolsrec_write_object_contents
PARAMS ((bfd
*));
138 static int srec_sizeof_headers
PARAMS ((bfd
*, boolean
));
139 static asymbol
*srec_make_empty_symbol
PARAMS ((bfd
*));
140 static long srec_get_symtab_upper_bound
PARAMS ((bfd
*));
141 static long srec_get_symtab
PARAMS ((bfd
*, asymbol
**));
143 /* Macros for converting between hex and binary. */
145 static CONST
char digs
[] = "0123456789ABCDEF";
147 #define NIBBLE(x) hex_value(x)
148 #define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
149 #define TOHEX(d, x, ch) \
150 d[1] = digs[(x) & 0xf]; \
151 d[0] = digs[((x)>>4)&0xf]; \
153 #define ISHEX(x) hex_p(x)
155 /* Initialize by filling in the hex conversion array. */
160 static boolean inited
= false;
169 /* The maximum number of bytes on a line is FF */
170 #define MAXCHUNK 0xff
171 /* The number of bytes we fit onto a line on output */
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. */
177 struct srec_data_list_struct
179 struct srec_data_list_struct
*next
;
185 typedef struct srec_data_list_struct srec_data_list_type
;
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
193 struct srec_symbol
*next
;
198 /* The S-record tdata information. */
200 typedef struct srec_data_struct
202 srec_data_list_type
*head
;
203 srec_data_list_type
*tail
;
205 struct srec_symbol
*symbols
;
206 struct srec_symbol
*symtail
;
211 static boolean srec_write_section
PARAMS ((bfd
*, tdata_type
*,
212 srec_data_list_type
*));
213 static boolean srec_write_terminator
PARAMS ((bfd
*, tdata_type
*));
215 /* Set up the S-record tdata information. */
223 if (abfd
->tdata
.srec_data
== NULL
)
225 tdata_type
*tdata
= (tdata_type
*) bfd_alloc (abfd
, sizeof (tdata_type
));
228 abfd
->tdata
.srec_data
= tdata
;
232 tdata
->symbols
= NULL
;
233 tdata
->symtail
= NULL
;
234 tdata
->csymbols
= NULL
;
240 /* Read a byte from an S record file. Set *ERRORPTR if an error
241 occurred. Return EOF on error or end of file. */
244 srec_get_byte (abfd
, errorptr
)
250 if (bfd_read (&c
, 1, 1, abfd
) != 1)
252 if (bfd_get_error () != bfd_error_file_truncated
)
257 return (int) (c
& 0xff);
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
265 srec_bad_byte (abfd
, lineno
, c
, error
)
274 bfd_set_error (bfd_error_file_truncated
);
281 sprintf (buf
, "\\%03o", (unsigned int) c
);
287 (*_bfd_error_handler
)
288 ("%s:%d: Unexpected character `%s' in S-record file\n",
289 bfd_get_filename (abfd
), lineno
, buf
);
290 bfd_set_error (bfd_error_bad_value
);
294 /* Add a new symbol found in an S-record file. */
297 srec_new_symbol (abfd
, name
, val
)
302 struct srec_symbol
*n
;
304 n
= (struct srec_symbol
*) bfd_alloc (abfd
, sizeof (struct srec_symbol
));
311 if (abfd
->tdata
.srec_data
->symbols
== NULL
)
312 abfd
->tdata
.srec_data
->symbols
= n
;
314 abfd
->tdata
.srec_data
->symtail
->next
= n
;
315 abfd
->tdata
.srec_data
->symtail
= n
;
323 /* Read the S record file and turn it into sections. We create a new
324 section for each contiguous set of bytes. */
331 unsigned int lineno
= 1;
332 boolean error
= false;
333 bfd_byte
*buf
= NULL
;
335 asection
*sec
= NULL
;
338 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
341 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
)
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')
351 srec_bad_byte (abfd
, lineno
, c
, error
);
362 /* Starting a module name, which we ignore. */
363 while ((c
= srec_get_byte (abfd
, &error
)) != '\n'
368 srec_bad_byte (abfd
, lineno
, c
, error
);
383 /* Starting a symbol definition. */
384 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
385 && (c
== ' ' || c
== '\t'))
393 srec_bad_byte (abfd
, lineno
, c
, error
);
398 symbuf
= (char *) bfd_malloc (alc
+ 1);
405 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
408 if (p
- symbuf
>= alc
)
413 n
= (char *) bfd_realloc (symbuf
, alc
+ 1);
416 p
= n
+ (p
- symbuf
);
425 srec_bad_byte (abfd
, lineno
, c
, error
);
430 symname
= bfd_alloc (abfd
, p
- symbuf
);
433 strcpy (symname
, symbuf
);
437 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
438 && (c
== ' ' || c
== '\t'))
442 srec_bad_byte (abfd
, lineno
, c
, error
);
446 /* Skip a dollar sign before the hex value. */
449 c
= srec_get_byte (abfd
, &error
);
452 srec_bad_byte (abfd
, lineno
, c
, error
);
461 symval
+= NIBBLE (c
);
462 c
= srec_get_byte (abfd
, &error
);
465 if (! srec_new_symbol (abfd
, symname
, symval
))
468 while (c
== ' ' || c
== '\t');
472 srec_bad_byte (abfd
, lineno
, c
, error
);
488 /* Starting an S-record. */
490 pos
= bfd_tell (abfd
) - 1;
492 if (bfd_read (hdr
, 1, 3, abfd
) != 3)
495 if (! ISHEX (hdr
[1]) || ! ISHEX (hdr
[2]))
497 if (! ISHEX (hdr
[1]))
501 srec_bad_byte (abfd
, lineno
, c
, error
);
505 bytes
= HEX (hdr
+ 1);
506 if (bytes
* 2 > bufsize
)
510 buf
= (bfd_byte
*) bfd_malloc (bytes
* 2);
516 if (bfd_read (buf
, 1, bytes
* 2, abfd
) != bytes
* 2)
519 /* Ignore the checksum byte. */
528 /* Prologue--ignore the file name, but stop building a
529 section at this point. */
534 address
= HEX (data
);
539 address
= (address
<< 8) | HEX (data
);
544 address
= (address
<< 8) | HEX (data
);
546 address
= (address
<< 8) | HEX (data
);
551 && sec
->vma
+ sec
->_raw_size
== address
)
553 /* This data goes at the end of the section we are
554 currently building. */
555 sec
->_raw_size
+= bytes
;
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
);
568 sec
->flags
= SEC_HAS_CONTENTS
| SEC_LOAD
| SEC_ALLOC
;
571 sec
->_raw_size
= bytes
;
578 address
= HEX (data
);
582 address
= (address
<< 8) | HEX (data
);
586 address
= (address
<< 8) | HEX (data
);
588 address
= (address
<< 8) | HEX (data
);
591 /* This is a termination record. */
592 abfd
->start_address
= address
;
620 /* Check whether an existing file is an S-record file. */
622 static const bfd_target
*
630 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0
631 || bfd_read (b
, 1, 4, abfd
) != 4)
634 if (b
[0] != 'S' || !ISHEX (b
[1]) || !ISHEX (b
[2]) || !ISHEX (b
[3]))
636 bfd_set_error (bfd_error_wrong_format
);
640 if (! srec_mkobject (abfd
)
641 || ! srec_scan (abfd
))
647 /* Check whether an existing file is an S-record file with symbols. */
649 static const bfd_target
*
650 symbolsrec_object_p (abfd
)
657 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0
658 || bfd_read (b
, 1, 2, abfd
) != 2)
661 if (b
[0] != '$' || b
[1] != '$')
663 bfd_set_error (bfd_error_wrong_format
);
667 if (! srec_mkobject (abfd
)
668 || ! srec_scan (abfd
))
674 /* Read in the contents of a section in an S-record file. */
677 srec_read_section (abfd
, section
, contents
)
683 bfd_size_type sofar
= 0;
684 boolean error
= false;
685 bfd_byte
*buf
= NULL
;
688 if (bfd_seek (abfd
, section
->filepos
, SEEK_SET
) != 0)
691 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
)
698 if (c
== '\r' || c
== '\n')
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');
705 if (bfd_read (hdr
, 1, 3, abfd
) != 3)
708 BFD_ASSERT (ISHEX (hdr
[1]) && ISHEX (hdr
[2]));
710 bytes
= HEX (hdr
+ 1);
712 if (bytes
* 2 > bufsize
)
716 buf
= (bfd_byte
*) bfd_malloc (bytes
* 2);
722 if (bfd_read (buf
, 1, bytes
* 2, abfd
) != bytes
* 2)
730 BFD_ASSERT (sofar
== section
->_raw_size
);
736 address
= HEX (data
);
741 address
= (address
<< 8) | HEX (data
);
746 address
= (address
<< 8) | HEX (data
);
748 address
= (address
<< 8) | HEX (data
);
752 if (address
!= section
->vma
+ sofar
)
754 /* We've come to the end of this section. */
755 BFD_ASSERT (sofar
== section
->_raw_size
);
761 /* Don't consider checksum. */
766 contents
[sofar
] = HEX (data
);
778 BFD_ASSERT (sofar
== section
->_raw_size
);
791 /* Get the contents of a section in an S-record file. */
794 srec_get_section_contents (abfd
, section
, location
, offset
, count
)
801 if (section
->used_by_bfd
== NULL
)
803 section
->used_by_bfd
= bfd_alloc (abfd
, section
->_raw_size
);
804 if (section
->used_by_bfd
== NULL
805 && section
->_raw_size
!= 0)
808 if (! srec_read_section (abfd
, section
, section
->used_by_bfd
))
812 memcpy (location
, (bfd_byte
*) section
->used_by_bfd
+ offset
,
818 /* Set the architecture. We accept an unknown architecture here. */
821 srec_set_arch_mach (abfd
, arch
, mach
)
823 enum bfd_architecture arch
;
826 if (arch
== bfd_arch_unknown
)
828 abfd
->arch_info
= &bfd_default_arch_struct
;
831 return bfd_default_set_arch_mach (abfd
, arch
, mach
);
834 /* we have to save up all the Srecords for a splurge before output */
837 srec_set_section_contents (abfd
, section
, location
, offset
, bytes_to_do
)
842 bfd_size_type bytes_to_do
;
844 tdata_type
*tdata
= abfd
->tdata
.srec_data
;
845 register srec_data_list_type
*entry
;
847 entry
= ((srec_data_list_type
*)
848 bfd_alloc (abfd
, sizeof (srec_data_list_type
)));
853 && (section
->flags
& SEC_ALLOC
)
854 && (section
->flags
& SEC_LOAD
))
856 bfd_byte
*data
= (bfd_byte
*) bfd_alloc (abfd
, bytes_to_do
);
859 memcpy ((PTR
) data
, location
, (size_t) bytes_to_do
);
861 if ((section
->lma
+ offset
+ bytes_to_do
- 1) <= 0xffff)
865 else if ((section
->lma
+ offset
+ bytes_to_do
- 1) <= 0xffffff
876 entry
->where
= section
->lma
+ offset
;
877 entry
->size
= bytes_to_do
;
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
)
884 tdata
->tail
->next
= entry
;
890 register srec_data_list_type
**look
;
892 for (look
= &tdata
->head
;
893 *look
!= NULL
&& (*look
)->where
< entry
->where
;
894 look
= &(*look
)->next
)
898 if (entry
->next
== NULL
)
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
910 srec_write_record (abfd
, type
, address
, data
, end
)
914 const bfd_byte
*data
;
917 char buffer
[MAXCHUNK
];
918 unsigned int check_sum
= 0;
919 CONST bfd_byte
*src
= data
;
928 dst
+= 2; /* leave room for dst*/
934 TOHEX (dst
, (address
>> 24), check_sum
);
938 TOHEX (dst
, (address
>> 16), check_sum
);
943 TOHEX (dst
, (address
>> 8), check_sum
);
945 TOHEX (dst
, (address
), check_sum
);
950 for (src
= data
; src
< end
; src
++)
952 TOHEX (dst
, *src
, check_sum
);
956 /* Fill in the length */
957 TOHEX (length
, (dst
- length
) / 2, check_sum
);
959 check_sum
= 255 - check_sum
;
960 TOHEX (dst
, check_sum
, check_sum
);
965 wrlen
= dst
- buffer
;
966 if (bfd_write ((PTR
) buffer
, 1, wrlen
, abfd
) != wrlen
)
974 srec_write_header (abfd
)
977 bfd_byte buffer
[MAXCHUNK
];
978 bfd_byte
*dst
= buffer
;
981 /* I'll put an arbitary 40 char limit on header size */
982 for (i
= 0; i
< 40 && abfd
->filename
[i
]; i
++)
984 *dst
++ = abfd
->filename
[i
];
986 return srec_write_record (abfd
, 0, 0, buffer
, dst
);
990 srec_write_section (abfd
, tdata
, list
)
993 srec_data_list_type
*list
;
995 unsigned int bytes_written
= 0;
996 bfd_byte
*location
= list
->data
;
998 while (bytes_written
< list
->size
)
1002 unsigned int bytes_this_chunk
= list
->size
- bytes_written
;
1004 if (bytes_this_chunk
> CHUNK
)
1006 bytes_this_chunk
= CHUNK
;
1009 address
= list
->where
+ bytes_written
;
1011 if (! srec_write_record (abfd
,
1015 location
+ bytes_this_chunk
))
1018 bytes_written
+= bytes_this_chunk
;
1019 location
+= bytes_this_chunk
;
1026 srec_write_terminator (abfd
, tdata
)
1032 return srec_write_record (abfd
, 10 - tdata
->type
,
1033 abfd
->start_address
, buffer
, buffer
);
1039 srec_write_symbols (abfd
)
1042 char buffer
[MAXCHUNK
];
1043 /* Dump out the symbols of a bfd */
1045 int count
= bfd_get_symcount (abfd
);
1050 asymbol
**table
= bfd_get_outsymbols (abfd
);
1051 sprintf (buffer
, "$$ %s\r\n", abfd
->filename
);
1053 len
= strlen (buffer
);
1054 if (bfd_write (buffer
, len
, 1, abfd
) != len
)
1057 for (i
= 0; i
< count
; i
++)
1059 asymbol
*s
= table
[i
];
1061 int len
= strlen (s
->name
);
1063 /* If this symbol has a .[ocs] in it, it's probably a file name
1064 and we'll output that as the module name */
1066 if (len
> 3 && s
->name
[len
- 2] == '.')
1069 sprintf (buffer
, "$$ %s\r\n", s
->name
);
1070 l
= strlen (buffer
);
1071 if (bfd_write (buffer
, l
, 1, abfd
) != l
)
1076 if (s
->flags
& (BSF_GLOBAL
| BSF_LOCAL
)
1077 && (s
->flags
& BSF_DEBUGGING
) == 0
1078 && s
->name
[0] != '.'
1079 && s
->name
[0] != 't')
1081 /* Just dump out non debug symbols */
1086 s
->value
+ s
->section
->output_section
->lma
1087 + s
->section
->output_offset
);
1089 while (p
[0] == '0' && p
[1] != 0)
1091 sprintf (buffer
, " %s $%s\r\n", s
->name
, p
);
1092 l
= strlen (buffer
);
1093 if (bfd_write (buffer
, l
, 1, abfd
) != l
)
1097 sprintf (buffer
, "$$ \r\n");
1098 len
= strlen (buffer
);
1099 if (bfd_write (buffer
, len
, 1, abfd
) != len
)
1107 internal_srec_write_object_contents (abfd
, symbols
)
1111 tdata_type
*tdata
= abfd
->tdata
.srec_data
;
1112 srec_data_list_type
*list
;
1116 if (! srec_write_symbols (abfd
))
1120 if (! srec_write_header (abfd
))
1123 /* Now wander though all the sections provided and output them */
1126 while (list
!= (srec_data_list_type
*) NULL
)
1128 if (! srec_write_section (abfd
, tdata
, list
))
1132 return srec_write_terminator (abfd
, tdata
);
1136 srec_write_object_contents (abfd
)
1139 return internal_srec_write_object_contents (abfd
, 0);
1143 symbolsrec_write_object_contents (abfd
)
1146 return internal_srec_write_object_contents (abfd
, 1);
1151 srec_sizeof_headers (abfd
, exec
)
1159 srec_make_empty_symbol (abfd
)
1162 asymbol
*new = (asymbol
*) bfd_zalloc (abfd
, sizeof (asymbol
));
1164 new->the_bfd
= abfd
;
1168 /* Return the amount of memory needed to read the symbol table. */
1171 srec_get_symtab_upper_bound (abfd
)
1174 return (bfd_get_symcount (abfd
) + 1) * sizeof (asymbol
*);
1177 /* Return the symbol table. */
1180 srec_get_symtab (abfd
, alocation
)
1182 asymbol
**alocation
;
1184 unsigned int symcount
= bfd_get_symcount (abfd
);
1188 csymbols
= abfd
->tdata
.srec_data
->csymbols
;
1189 if (csymbols
== NULL
)
1192 struct srec_symbol
*s
;
1194 csymbols
= (asymbol
*) bfd_alloc (abfd
, symcount
* sizeof (asymbol
));
1195 if (csymbols
== NULL
&& symcount
!= 0)
1197 abfd
->tdata
.srec_data
->csymbols
= csymbols
;
1199 for (s
= abfd
->tdata
.srec_data
->symbols
, c
= csymbols
;
1206 c
->flags
= BSF_GLOBAL
;
1207 c
->section
= bfd_abs_section_ptr
;
1212 for (i
= 0; i
< symcount
; i
++)
1213 *alocation
++ = csymbols
++;
1221 srec_get_symbol_info (ignore_abfd
, symbol
, ret
)
1226 bfd_symbol_info (symbol
, ret
);
1231 srec_print_symbol (ignore_abfd
, afile
, symbol
, how
)
1235 bfd_print_symbol_type how
;
1237 FILE *file
= (FILE *) afile
;
1240 case bfd_print_symbol_name
:
1241 fprintf (file
, "%s", symbol
->name
);
1244 bfd_print_symbol_vandf ((PTR
) file
, symbol
);
1245 fprintf (file
, " %-5s %s",
1246 symbol
->section
->name
,
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
1256 #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
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
1260 #define srec_read_minisymbols _bfd_generic_read_minisymbols
1261 #define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
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
1269 #define srec_get_section_contents_in_window \
1270 _bfd_generic_get_section_contents_in_window
1272 #define srec_bfd_get_relocated_section_contents \
1273 bfd_generic_get_relocated_section_contents
1274 #define srec_bfd_relax_section bfd_generic_relax_section
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
1278 #define srec_bfd_link_split_section _bfd_generic_link_split_section
1280 const bfd_target srec_vec
=
1283 bfd_target_srec_flavour
,
1284 BFD_ENDIAN_UNKNOWN
, /* target byte order */
1285 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
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 */
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 */
1303 srec_object_p
, /* bfd_check_format */
1310 _bfd_generic_mkarchive
,
1313 { /* bfd_write_contents */
1315 srec_write_object_contents
,
1316 _bfd_write_archive_contents
,
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
),
1325 BFD_JUMP_TABLE_RELOCS (srec
),
1326 BFD_JUMP_TABLE_WRITE (srec
),
1327 BFD_JUMP_TABLE_LINK (srec
),
1328 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),
1335 const bfd_target symbolsrec_vec
=
1337 "symbolsrec", /* name */
1338 bfd_target_srec_flavour
,
1339 BFD_ENDIAN_UNKNOWN
, /* target byte order */
1340 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
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 */
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 */
1358 symbolsrec_object_p
, /* bfd_check_format */
1365 _bfd_generic_mkarchive
,
1368 { /* bfd_write_contents */
1370 symbolsrec_write_object_contents
,
1371 _bfd_write_archive_contents
,
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
),
1380 BFD_JUMP_TABLE_RELOCS (srec
),
1381 BFD_JUMP_TABLE_WRITE (srec
),
1382 BFD_JUMP_TABLE_LINK (srec
),
1383 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),