1 /* BFD back-end for s-record objects.
2 Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
3 Free Software Foundation, Inc.
4 Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
6 This file is part of BFD, the Binary File Descriptor library.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
28 Ordinary S-Records cannot hold anything but addresses and
29 data, so that's all that we implement.
31 The only interesting thing is that S-Records may come out of
32 order and there is no header, so an initial scan is required
33 to discover the minimum and maximum addresses used to create
34 the vma and size of the only section we create. We
35 arbitrarily call this section ".text".
37 When bfd_get_section_contents is called the file is read
38 again, and this time the data is placed into a bfd_alloc'd
41 Any number of sections may be created for output, we save them
42 up and output them when it's time to close the bfd.
44 An s record looks like:
47 S<type><length><address><data><checksum>
52 is the number of bytes following upto the checksum. Note that
53 this is not the number of chars following, since it takes two
54 chars to represent a byte.
58 1) two byte address data record
59 2) three byte address data record
60 3) four byte address data record
61 7) four byte address termination record
62 8) three byte address termination record
63 9) two byte address termination record
66 is the start address of the data following, or in the case of
67 a termination record, the start address of the image
71 is the sum of all the raw byte data in the record, from the length
72 upwards, modulo 256 and subtracted from 255.
76 Symbol S-Record handling
79 Some ICE equipment understands an addition to the standard
80 S-Record format; symbols and their addresses can be sent
83 The format of this is:
85 (<space> <symbol> <address>)*)
88 so a short symbol table could look like:
102 We allow symbols to be anywhere in the data stream - the module names
110 #include "libiberty.h"
113 static void srec_get_symbol_info
PARAMS ((bfd
*, asymbol
*, symbol_info
*));
114 static void srec_print_symbol
115 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
116 static void srec_init
PARAMS ((void));
117 static boolean srec_mkobject
PARAMS ((bfd
*));
118 static int srec_get_byte
PARAMS ((bfd
*, boolean
*));
119 static void srec_bad_byte
PARAMS ((bfd
*, unsigned int, int, boolean
));
120 static boolean srec_scan
PARAMS ((bfd
*));
121 static const bfd_target
*srec_object_p
PARAMS ((bfd
*));
122 static const bfd_target
*symbolsrec_object_p
PARAMS ((bfd
*));
123 static boolean srec_read_section
PARAMS ((bfd
*, asection
*, bfd_byte
*));
125 static boolean srec_write_record
PARAMS ((bfd
*, int, bfd_vma
,
128 static boolean srec_write_header
PARAMS ((bfd
*));
129 static boolean srec_write_symbols
PARAMS ((bfd
*));
130 static boolean srec_new_symbol
PARAMS ((bfd
*, const char *, bfd_vma
));
131 static boolean srec_get_section_contents
132 PARAMS ((bfd
*, asection
*, PTR
, file_ptr
, bfd_size_type
));
133 static boolean srec_set_arch_mach
134 PARAMS ((bfd
*, enum bfd_architecture
, unsigned long));
135 static boolean srec_set_section_contents
136 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
137 static boolean internal_srec_write_object_contents
PARAMS ((bfd
*, int));
138 static boolean srec_write_object_contents
PARAMS ((bfd
*));
139 static boolean symbolsrec_write_object_contents
PARAMS ((bfd
*));
140 static int srec_sizeof_headers
PARAMS ((bfd
*, boolean
));
141 static asymbol
*srec_make_empty_symbol
PARAMS ((bfd
*));
142 static long srec_get_symtab_upper_bound
PARAMS ((bfd
*));
143 static long srec_get_symtab
PARAMS ((bfd
*, asymbol
**));
145 /* Macros for converting between hex and binary. */
147 static CONST
char digs
[] = "0123456789ABCDEF";
149 #define NIBBLE(x) hex_value(x)
150 #define HEX(buffer) ((NIBBLE((buffer)[0])<<4) + NIBBLE((buffer)[1]))
151 #define TOHEX(d, x, ch) \
152 d[1] = digs[(x) & 0xf]; \
153 d[0] = digs[((x)>>4)&0xf]; \
155 #define ISHEX(x) hex_p(x)
157 /* Initialize by filling in the hex conversion array. */
162 static boolean inited
= false;
171 /* The maximum number of bytes on a line is FF */
172 #define MAXCHUNK 0xff
173 /* The number of bytes we fit onto a line on output */
176 /* When writing an S-record file, the S-records can not be output as
177 they are seen. This structure is used to hold them in memory. */
179 struct srec_data_list_struct
181 struct srec_data_list_struct
*next
;
187 typedef struct srec_data_list_struct srec_data_list_type
;
189 /* When scanning the S-record file, a linked list of srec_symbol
190 structures is built to represent the symbol table (if there is
195 struct srec_symbol
*next
;
200 /* The S-record tdata information. */
202 typedef struct srec_data_struct
204 srec_data_list_type
*head
;
205 srec_data_list_type
*tail
;
207 struct srec_symbol
*symbols
;
208 struct srec_symbol
*symtail
;
213 static boolean srec_write_section
PARAMS ((bfd
*, tdata_type
*,
214 srec_data_list_type
*));
215 static boolean srec_write_terminator
PARAMS ((bfd
*, tdata_type
*));
217 /* Set up the S-record tdata information. */
225 if (abfd
->tdata
.srec_data
== NULL
)
227 tdata_type
*tdata
= (tdata_type
*) bfd_alloc (abfd
, sizeof (tdata_type
));
230 abfd
->tdata
.srec_data
= tdata
;
234 tdata
->symbols
= NULL
;
235 tdata
->symtail
= NULL
;
236 tdata
->csymbols
= NULL
;
242 /* Read a byte from an S record file. Set *ERRORPTR if an error
243 occurred. Return EOF on error or end of file. */
246 srec_get_byte (abfd
, errorptr
)
252 if (bfd_read (&c
, 1, 1, abfd
) != 1)
254 if (bfd_get_error () != bfd_error_file_truncated
)
259 return (int) (c
& 0xff);
262 /* Report a problem in an S record file. FIXME: This probably should
263 not call fprintf, but we really do need some mechanism for printing
267 srec_bad_byte (abfd
, lineno
, c
, error
)
276 bfd_set_error (bfd_error_file_truncated
);
283 sprintf (buf
, "\\%03o", (unsigned int) c
);
289 (*_bfd_error_handler
)
290 (_("%s:%d: Unexpected character `%s' in S-record file\n"),
291 bfd_get_filename (abfd
), lineno
, buf
);
292 bfd_set_error (bfd_error_bad_value
);
296 /* Add a new symbol found in an S-record file. */
299 srec_new_symbol (abfd
, name
, val
)
304 struct srec_symbol
*n
;
306 n
= (struct srec_symbol
*) bfd_alloc (abfd
, sizeof (struct srec_symbol
));
313 if (abfd
->tdata
.srec_data
->symbols
== NULL
)
314 abfd
->tdata
.srec_data
->symbols
= n
;
316 abfd
->tdata
.srec_data
->symtail
->next
= n
;
317 abfd
->tdata
.srec_data
->symtail
= n
;
325 /* Read the S record file and turn it into sections. We create a new
326 section for each contiguous set of bytes. */
333 unsigned int lineno
= 1;
334 boolean error
= false;
335 bfd_byte
*buf
= NULL
;
337 asection
*sec
= NULL
;
340 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
343 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
)
345 /* We only build sections from contiguous S-records, so if this
346 is not an S-record, then stop building a section. */
347 if (c
!= 'S' && c
!= '\r' && c
!= '\n')
353 srec_bad_byte (abfd
, lineno
, c
, error
);
364 /* Starting a module name, which we ignore. */
365 while ((c
= srec_get_byte (abfd
, &error
)) != '\n'
370 srec_bad_byte (abfd
, lineno
, c
, error
);
385 /* Starting a symbol definition. */
386 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
387 && (c
== ' ' || c
== '\t'))
395 srec_bad_byte (abfd
, lineno
, c
, error
);
400 symbuf
= (char *) bfd_malloc (alc
+ 1);
407 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
410 if ((unsigned int) (p
- symbuf
) >= alc
)
415 n
= (char *) bfd_realloc (symbuf
, alc
+ 1);
418 p
= n
+ (p
- symbuf
);
427 srec_bad_byte (abfd
, lineno
, c
, error
);
432 symname
= bfd_alloc (abfd
, p
- symbuf
);
435 strcpy (symname
, symbuf
);
439 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
440 && (c
== ' ' || c
== '\t'))
444 srec_bad_byte (abfd
, lineno
, c
, error
);
448 /* Skip a dollar sign before the hex value. */
451 c
= srec_get_byte (abfd
, &error
);
454 srec_bad_byte (abfd
, lineno
, c
, error
);
463 symval
+= NIBBLE (c
);
464 c
= srec_get_byte (abfd
, &error
);
467 if (! srec_new_symbol (abfd
, symname
, symval
))
470 while (c
== ' ' || c
== '\t');
474 srec_bad_byte (abfd
, lineno
, c
, error
);
490 /* Starting an S-record. */
492 pos
= bfd_tell (abfd
) - 1;
494 if (bfd_read (hdr
, 1, 3, abfd
) != 3)
497 if (! ISHEX (hdr
[1]) || ! ISHEX (hdr
[2]))
499 if (! ISHEX (hdr
[1]))
503 srec_bad_byte (abfd
, lineno
, c
, error
);
507 bytes
= HEX (hdr
+ 1);
508 if (bytes
* 2 > bufsize
)
512 buf
= (bfd_byte
*) bfd_malloc (bytes
* 2);
518 if (bfd_read (buf
, 1, bytes
* 2, abfd
) != bytes
* 2)
521 /* Ignore the checksum byte. */
530 /* Prologue--ignore the file name, but stop building a
531 section at this point. */
536 address
= HEX (data
);
541 address
= (address
<< 8) | HEX (data
);
546 address
= (address
<< 8) | HEX (data
);
548 address
= (address
<< 8) | HEX (data
);
553 && sec
->vma
+ sec
->_raw_size
== address
)
555 /* This data goes at the end of the section we are
556 currently building. */
557 sec
->_raw_size
+= bytes
;
564 sprintf (secbuf
, ".sec%d", bfd_count_sections (abfd
) + 1);
565 secname
= (char *) bfd_alloc (abfd
, strlen (secbuf
) + 1);
566 strcpy (secname
, secbuf
);
567 sec
= bfd_make_section (abfd
, secname
);
570 sec
->flags
= SEC_HAS_CONTENTS
| SEC_LOAD
| SEC_ALLOC
;
573 sec
->_raw_size
= bytes
;
580 address
= HEX (data
);
584 address
= (address
<< 8) | HEX (data
);
588 address
= (address
<< 8) | HEX (data
);
590 address
= (address
<< 8) | HEX (data
);
593 /* This is a termination record. */
594 abfd
->start_address
= address
;
622 /* Check whether an existing file is an S-record file. */
624 static const bfd_target
*
632 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0
633 || bfd_read (b
, 1, 4, abfd
) != 4)
636 if (b
[0] != 'S' || !ISHEX (b
[1]) || !ISHEX (b
[2]) || !ISHEX (b
[3]))
638 bfd_set_error (bfd_error_wrong_format
);
642 if (! srec_mkobject (abfd
)
643 || ! srec_scan (abfd
))
649 /* Check whether an existing file is an S-record file with symbols. */
651 static const bfd_target
*
652 symbolsrec_object_p (abfd
)
659 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0
660 || bfd_read (b
, 1, 2, abfd
) != 2)
663 if (b
[0] != '$' || b
[1] != '$')
665 bfd_set_error (bfd_error_wrong_format
);
669 if (! srec_mkobject (abfd
)
670 || ! srec_scan (abfd
))
676 /* Read in the contents of a section in an S-record file. */
679 srec_read_section (abfd
, section
, contents
)
685 bfd_size_type sofar
= 0;
686 boolean error
= false;
687 bfd_byte
*buf
= NULL
;
690 if (bfd_seek (abfd
, section
->filepos
, SEEK_SET
) != 0)
693 while ((c
= srec_get_byte (abfd
, &error
)) != EOF
)
700 if (c
== '\r' || c
== '\n')
703 /* This is called after srec_scan has already been called, so we
704 ought to know the exact format. */
705 BFD_ASSERT (c
== 'S');
707 if (bfd_read (hdr
, 1, 3, abfd
) != 3)
710 BFD_ASSERT (ISHEX (hdr
[1]) && ISHEX (hdr
[2]));
712 bytes
= HEX (hdr
+ 1);
714 if (bytes
* 2 > bufsize
)
718 buf
= (bfd_byte
*) bfd_malloc (bytes
* 2);
724 if (bfd_read (buf
, 1, bytes
* 2, abfd
) != bytes
* 2)
732 BFD_ASSERT (sofar
== section
->_raw_size
);
738 address
= HEX (data
);
743 address
= (address
<< 8) | HEX (data
);
748 address
= (address
<< 8) | HEX (data
);
750 address
= (address
<< 8) | HEX (data
);
754 if (address
!= section
->vma
+ sofar
)
756 /* We've come to the end of this section. */
757 BFD_ASSERT (sofar
== section
->_raw_size
);
763 /* Don't consider checksum. */
768 contents
[sofar
] = HEX (data
);
780 BFD_ASSERT (sofar
== section
->_raw_size
);
793 /* Get the contents of a section in an S-record file. */
796 srec_get_section_contents (abfd
, section
, location
, offset
, count
)
803 if (section
->used_by_bfd
== NULL
)
805 section
->used_by_bfd
= bfd_alloc (abfd
, section
->_raw_size
);
806 if (section
->used_by_bfd
== NULL
807 && section
->_raw_size
!= 0)
810 if (! srec_read_section (abfd
, section
, section
->used_by_bfd
))
814 memcpy (location
, (bfd_byte
*) section
->used_by_bfd
+ offset
,
820 /* Set the architecture. We accept an unknown architecture here. */
823 srec_set_arch_mach (abfd
, arch
, mach
)
825 enum bfd_architecture arch
;
828 if (arch
== bfd_arch_unknown
)
830 abfd
->arch_info
= &bfd_default_arch_struct
;
833 return bfd_default_set_arch_mach (abfd
, arch
, mach
);
836 /* we have to save up all the Srecords for a splurge before output */
839 srec_set_section_contents (abfd
, section
, location
, offset
, bytes_to_do
)
844 bfd_size_type bytes_to_do
;
846 tdata_type
*tdata
= abfd
->tdata
.srec_data
;
847 register srec_data_list_type
*entry
;
849 entry
= ((srec_data_list_type
*)
850 bfd_alloc (abfd
, sizeof (srec_data_list_type
)));
855 && (section
->flags
& SEC_ALLOC
)
856 && (section
->flags
& SEC_LOAD
))
858 bfd_byte
*data
= (bfd_byte
*) bfd_alloc (abfd
, bytes_to_do
);
861 memcpy ((PTR
) data
, location
, (size_t) bytes_to_do
);
863 if ((section
->lma
+ offset
+ bytes_to_do
- 1) <= 0xffff)
867 else if ((section
->lma
+ offset
+ bytes_to_do
- 1) <= 0xffffff
878 entry
->where
= section
->lma
+ offset
;
879 entry
->size
= bytes_to_do
;
881 /* Sort the records by address. Optimize for the common case of
882 adding a record to the end of the list. */
883 if (tdata
->tail
!= NULL
884 && entry
->where
>= tdata
->tail
->where
)
886 tdata
->tail
->next
= entry
;
892 register srec_data_list_type
**look
;
894 for (look
= &tdata
->head
;
895 *look
!= NULL
&& (*look
)->where
< entry
->where
;
896 look
= &(*look
)->next
)
900 if (entry
->next
== NULL
)
907 /* Write a record of type, of the supplied number of bytes. The
908 supplied bytes and length don't have a checksum. That's worked out
912 srec_write_record (abfd
, type
, address
, data
, end
)
916 const bfd_byte
*data
;
919 char buffer
[MAXCHUNK
];
920 unsigned int check_sum
= 0;
921 CONST bfd_byte
*src
= data
;
930 dst
+= 2; /* leave room for dst*/
936 TOHEX (dst
, (address
>> 24), check_sum
);
940 TOHEX (dst
, (address
>> 16), check_sum
);
945 TOHEX (dst
, (address
>> 8), check_sum
);
947 TOHEX (dst
, (address
), check_sum
);
952 for (src
= data
; src
< end
; src
++)
954 TOHEX (dst
, *src
, check_sum
);
958 /* Fill in the length */
959 TOHEX (length
, (dst
- length
) / 2, check_sum
);
961 check_sum
= 255 - check_sum
;
962 TOHEX (dst
, check_sum
, check_sum
);
967 wrlen
= dst
- buffer
;
968 if (bfd_write ((PTR
) buffer
, 1, wrlen
, abfd
) != wrlen
)
976 srec_write_header (abfd
)
979 bfd_byte buffer
[MAXCHUNK
];
980 bfd_byte
*dst
= buffer
;
983 /* I'll put an arbitary 40 char limit on header size */
984 for (i
= 0; i
< 40 && abfd
->filename
[i
]; i
++)
986 *dst
++ = abfd
->filename
[i
];
988 return srec_write_record (abfd
, 0, 0, buffer
, dst
);
992 srec_write_section (abfd
, tdata
, list
)
995 srec_data_list_type
*list
;
997 unsigned int bytes_written
= 0;
998 bfd_byte
*location
= list
->data
;
1000 while (bytes_written
< list
->size
)
1004 unsigned int bytes_this_chunk
= list
->size
- bytes_written
;
1006 if (bytes_this_chunk
> CHUNK
)
1008 bytes_this_chunk
= CHUNK
;
1011 address
= list
->where
+ bytes_written
;
1013 if (! srec_write_record (abfd
,
1017 location
+ bytes_this_chunk
))
1020 bytes_written
+= bytes_this_chunk
;
1021 location
+= bytes_this_chunk
;
1028 srec_write_terminator (abfd
, tdata
)
1034 return srec_write_record (abfd
, 10 - tdata
->type
,
1035 abfd
->start_address
, buffer
, buffer
);
1041 srec_write_symbols (abfd
)
1044 char buffer
[MAXCHUNK
];
1045 /* Dump out the symbols of a bfd */
1047 int count
= bfd_get_symcount (abfd
);
1052 asymbol
**table
= bfd_get_outsymbols (abfd
);
1053 sprintf (buffer
, "$$ %s\r\n", abfd
->filename
);
1055 len
= strlen (buffer
);
1056 if (bfd_write (buffer
, len
, 1, abfd
) != len
)
1059 for (i
= 0; i
< count
; i
++)
1061 asymbol
*s
= table
[i
];
1062 if (! bfd_is_local_label (abfd
, s
))
1064 /* Just dump out non debug symbols */
1069 s
->value
+ s
->section
->output_section
->lma
1070 + s
->section
->output_offset
);
1072 while (p
[0] == '0' && p
[1] != 0)
1074 sprintf (buffer
, " %s $%s\r\n", s
->name
, p
);
1075 l
= strlen (buffer
);
1076 if (bfd_write (buffer
, l
, 1, abfd
) != l
)
1080 sprintf (buffer
, "$$ \r\n");
1081 len
= strlen (buffer
);
1082 if (bfd_write (buffer
, len
, 1, abfd
) != len
)
1090 internal_srec_write_object_contents (abfd
, symbols
)
1094 tdata_type
*tdata
= abfd
->tdata
.srec_data
;
1095 srec_data_list_type
*list
;
1099 if (! srec_write_symbols (abfd
))
1103 if (! srec_write_header (abfd
))
1106 /* Now wander though all the sections provided and output them */
1109 while (list
!= (srec_data_list_type
*) NULL
)
1111 if (! srec_write_section (abfd
, tdata
, list
))
1115 return srec_write_terminator (abfd
, tdata
);
1119 srec_write_object_contents (abfd
)
1122 return internal_srec_write_object_contents (abfd
, 0);
1126 symbolsrec_write_object_contents (abfd
)
1129 return internal_srec_write_object_contents (abfd
, 1);
1134 srec_sizeof_headers (abfd
, exec
)
1142 srec_make_empty_symbol (abfd
)
1145 asymbol
*new = (asymbol
*) bfd_zalloc (abfd
, sizeof (asymbol
));
1147 new->the_bfd
= abfd
;
1151 /* Return the amount of memory needed to read the symbol table. */
1154 srec_get_symtab_upper_bound (abfd
)
1157 return (bfd_get_symcount (abfd
) + 1) * sizeof (asymbol
*);
1160 /* Return the symbol table. */
1163 srec_get_symtab (abfd
, alocation
)
1165 asymbol
**alocation
;
1167 unsigned int symcount
= bfd_get_symcount (abfd
);
1171 csymbols
= abfd
->tdata
.srec_data
->csymbols
;
1172 if (csymbols
== NULL
)
1175 struct srec_symbol
*s
;
1177 csymbols
= (asymbol
*) bfd_alloc (abfd
, symcount
* sizeof (asymbol
));
1178 if (csymbols
== NULL
&& symcount
!= 0)
1180 abfd
->tdata
.srec_data
->csymbols
= csymbols
;
1182 for (s
= abfd
->tdata
.srec_data
->symbols
, c
= csymbols
;
1189 c
->flags
= BSF_GLOBAL
;
1190 c
->section
= bfd_abs_section_ptr
;
1195 for (i
= 0; i
< symcount
; i
++)
1196 *alocation
++ = csymbols
++;
1204 srec_get_symbol_info (ignore_abfd
, symbol
, ret
)
1209 bfd_symbol_info (symbol
, ret
);
1214 srec_print_symbol (ignore_abfd
, afile
, symbol
, how
)
1218 bfd_print_symbol_type how
;
1220 FILE *file
= (FILE *) afile
;
1223 case bfd_print_symbol_name
:
1224 fprintf (file
, "%s", symbol
->name
);
1227 bfd_print_symbol_vandf ((PTR
) file
, symbol
);
1228 fprintf (file
, " %-5s %s",
1229 symbol
->section
->name
,
1235 #define srec_close_and_cleanup _bfd_generic_close_and_cleanup
1236 #define srec_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
1237 #define srec_new_section_hook _bfd_generic_new_section_hook
1239 #define srec_bfd_is_local_label_name bfd_generic_is_local_label_name
1240 #define srec_get_lineno _bfd_nosymbols_get_lineno
1241 #define srec_find_nearest_line _bfd_nosymbols_find_nearest_line
1242 #define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
1243 #define srec_read_minisymbols _bfd_generic_read_minisymbols
1244 #define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
1246 #define srec_get_reloc_upper_bound \
1247 ((long (*) PARAMS ((bfd *, asection *))) bfd_0l)
1248 #define srec_canonicalize_reloc \
1249 ((long (*) PARAMS ((bfd *, asection *, arelent **, asymbol **))) bfd_0l)
1250 #define srec_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
1252 #define srec_get_section_contents_in_window \
1253 _bfd_generic_get_section_contents_in_window
1255 #define srec_bfd_get_relocated_section_contents \
1256 bfd_generic_get_relocated_section_contents
1257 #define srec_bfd_relax_section bfd_generic_relax_section
1258 #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
1259 #define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
1260 #define srec_bfd_final_link _bfd_generic_final_link
1261 #define srec_bfd_link_split_section _bfd_generic_link_split_section
1263 const bfd_target srec_vec
=
1266 bfd_target_srec_flavour
,
1267 BFD_ENDIAN_UNKNOWN
, /* target byte order */
1268 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
1269 (HAS_RELOC
| EXEC_P
| /* object flags */
1270 HAS_LINENO
| HAS_DEBUG
|
1271 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
1272 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
1273 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
1274 0, /* leading underscore */
1275 ' ', /* ar_pad_char */
1276 16, /* ar_max_namelen */
1277 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1278 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1279 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
1280 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1281 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1282 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
1286 srec_object_p
, /* bfd_check_format */
1293 _bfd_generic_mkarchive
,
1296 { /* bfd_write_contents */
1298 srec_write_object_contents
,
1299 _bfd_write_archive_contents
,
1303 BFD_JUMP_TABLE_GENERIC (srec
),
1304 BFD_JUMP_TABLE_COPY (_bfd_generic
),
1305 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
1306 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
1307 BFD_JUMP_TABLE_SYMBOLS (srec
),
1308 BFD_JUMP_TABLE_RELOCS (srec
),
1309 BFD_JUMP_TABLE_WRITE (srec
),
1310 BFD_JUMP_TABLE_LINK (srec
),
1311 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),
1318 const bfd_target symbolsrec_vec
=
1320 "symbolsrec", /* name */
1321 bfd_target_srec_flavour
,
1322 BFD_ENDIAN_UNKNOWN
, /* target byte order */
1323 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
1324 (HAS_RELOC
| EXEC_P
| /* object flags */
1325 HAS_LINENO
| HAS_DEBUG
|
1326 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
1327 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
1328 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
1329 0, /* leading underscore */
1330 ' ', /* ar_pad_char */
1331 16, /* ar_max_namelen */
1332 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1333 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1334 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
1335 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
1336 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
1337 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
1341 symbolsrec_object_p
, /* bfd_check_format */
1348 _bfd_generic_mkarchive
,
1351 { /* bfd_write_contents */
1353 symbolsrec_write_object_contents
,
1354 _bfd_write_archive_contents
,
1358 BFD_JUMP_TABLE_GENERIC (srec
),
1359 BFD_JUMP_TABLE_COPY (_bfd_generic
),
1360 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
1361 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive
),
1362 BFD_JUMP_TABLE_SYMBOLS (srec
),
1363 BFD_JUMP_TABLE_RELOCS (srec
),
1364 BFD_JUMP_TABLE_WRITE (srec
),
1365 BFD_JUMP_TABLE_LINK (srec
),
1366 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),