1 /* BFD back-end for ieee-695 objects.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4 Free Software Foundation, Inc.
6 Written by Steve Chamberlain of Cygnus Support.
8 This file is part of BFD, the Binary File Descriptor library.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24 #define KEEPMINUSPCININST 0
26 /* IEEE 695 format is a stream of records, which we parse using a simple one-
27 token (which is one byte in this lexicon) lookahead recursive decent
35 #include "safe-ctype.h"
37 struct output_buffer_struct
43 static boolean ieee_write_byte
PARAMS ((bfd
*, int));
44 static boolean ieee_write_2bytes
PARAMS ((bfd
*, int));
45 static boolean ieee_write_int
PARAMS ((bfd
*, bfd_vma
));
46 static boolean ieee_write_id
PARAMS ((bfd
*, const char *));
47 static unsigned short read_2bytes
PARAMS ((common_header_type
*));
48 static void bfd_get_string
PARAMS ((common_header_type
*, char *, size_t));
49 static char *read_id
PARAMS ((common_header_type
*));
50 static boolean ieee_write_expression
51 PARAMS ((bfd
*, bfd_vma
, asymbol
*, boolean
, unsigned int));
52 static void ieee_write_int5
PARAMS ((bfd_byte
*, bfd_vma
));
53 static boolean ieee_write_int5_out
PARAMS ((bfd
*, bfd_vma
));
54 static boolean parse_int
PARAMS ((common_header_type
*, bfd_vma
*));
55 static int parse_i
PARAMS ((common_header_type
*, boolean
*));
56 static bfd_vma must_parse_int
PARAMS ((common_header_type
*));
57 static void parse_expression
58 PARAMS ((ieee_data_type
*, bfd_vma
*, ieee_symbol_index_type
*,
59 boolean
*, unsigned int *, asection
**));
60 static file_ptr ieee_part_after
PARAMS ((ieee_data_type
*, file_ptr
));
61 static ieee_symbol_type
*get_symbol
62 PARAMS ((bfd
*, ieee_data_type
*, ieee_symbol_type
*, unsigned int *,
63 ieee_symbol_type
***, unsigned int *, int));
64 static boolean ieee_slurp_external_symbols
PARAMS ((bfd
*));
65 static boolean ieee_slurp_symbol_table
PARAMS ((bfd
*));
66 static long ieee_get_symtab_upper_bound
PARAMS ((bfd
*));
67 static long ieee_get_symtab
PARAMS ((bfd
*, asymbol
**));
68 static asection
*get_section_entry
69 PARAMS ((bfd
*, ieee_data_type
*i
, unsigned int));
70 static void ieee_slurp_sections
PARAMS ((bfd
*));
71 static boolean ieee_slurp_debug
PARAMS ((bfd
*));
72 const bfd_target
*ieee_archive_p
PARAMS ((bfd
*));
73 const bfd_target
*ieee_object_p
PARAMS ((bfd
*));
74 static void ieee_get_symbol_info
PARAMS ((bfd
*, asymbol
*, symbol_info
*));
75 static void ieee_print_symbol
76 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
78 PARAMS ((ieee_data_type
*, ieee_per_section_type
*, unsigned char *,
80 static boolean ieee_slurp_section_data
PARAMS ((bfd
*));
81 static boolean ieee_new_section_hook
PARAMS ((bfd
*, asection
*));
82 static long ieee_get_reloc_upper_bound
PARAMS ((bfd
*, sec_ptr
));
83 static boolean ieee_get_section_contents
84 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
85 static long ieee_canonicalize_reloc
86 PARAMS ((bfd
*, sec_ptr
, arelent
**, asymbol
**));
87 static int comp
PARAMS ((const PTR
, const PTR
));
88 static boolean ieee_write_section_part
PARAMS ((bfd
*));
89 static boolean do_with_relocs
PARAMS ((bfd
*, asection
*));
90 static boolean do_as_repeat
PARAMS ((bfd
*, asection
*));
91 static boolean do_without_relocs
PARAMS ((bfd
*, asection
*));
92 static boolean ieee_mkobject
PARAMS ((bfd
*));
93 static void fill
PARAMS ((void));
94 static void flush
PARAMS ((void));
95 static void write_int
PARAMS ((int));
96 static void copy_id
PARAMS ((void));
97 static void copy_expression
PARAMS ((void));
98 static void fill_int
PARAMS ((struct output_buffer_struct
*));
99 static void drop_int
PARAMS ((struct output_buffer_struct
*));
100 static void copy_int
PARAMS ((void));
101 static void f1_record
PARAMS ((void));
102 static void f0_record
PARAMS ((void));
103 static void copy_till_end
PARAMS ((void));
104 static void f2_record
PARAMS ((void));
105 static void f8_record
PARAMS ((void));
106 static void e2_record
PARAMS ((void));
107 static void block
PARAMS ((void));
108 static void relocate_debug
PARAMS ((bfd
*, bfd
*));
109 static boolean ieee_write_debug_part
PARAMS ((bfd
*));
110 static boolean ieee_write_data_part
PARAMS ((bfd
*));
111 static boolean init_for_output
PARAMS ((bfd
*));
112 static boolean ieee_set_section_contents
113 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
114 static boolean ieee_write_external_part
PARAMS ((bfd
*));
115 static boolean ieee_write_me_part
PARAMS ((bfd
*));
116 static boolean ieee_write_processor
PARAMS ((bfd
*));
117 static boolean ieee_write_object_contents
PARAMS ((bfd
*));
118 static asymbol
*ieee_make_empty_symbol
PARAMS ((bfd
*));
119 static bfd
*ieee_openr_next_archived_file
PARAMS ((bfd
*, bfd
*));
120 static boolean ieee_find_nearest_line
121 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
122 const char **, unsigned int *));
123 static int ieee_generic_stat_arch_elt
PARAMS ((bfd
*, struct stat
*));
124 static int ieee_sizeof_headers
PARAMS ((bfd
*, boolean
));
126 /* Functions for writing to ieee files in the strange way that the
127 standard requires. */
130 ieee_write_byte (abfd
, barg
)
137 if (bfd_bwrite ((PTR
) &byte
, (bfd_size_type
) 1, abfd
) != 1)
143 ieee_write_2bytes (abfd
, bytes
)
149 buffer
[0] = bytes
>> 8;
150 buffer
[1] = bytes
& 0xff;
151 if (bfd_bwrite ((PTR
) buffer
, (bfd_size_type
) 2, abfd
) != 2)
157 ieee_write_int (abfd
, value
)
163 if (! ieee_write_byte (abfd
, (bfd_byte
) value
))
170 /* How many significant bytes ? */
171 /* FIXME FOR LONGER INTS */
172 if (value
& 0xff000000)
174 else if (value
& 0x00ff0000)
176 else if (value
& 0x0000ff00)
181 if (! ieee_write_byte (abfd
,
182 (bfd_byte
) ((int) ieee_number_repeat_start_enum
188 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 24)))
192 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 16)))
196 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 8)))
200 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
)))
209 ieee_write_id (abfd
, id
)
213 size_t length
= strlen (id
);
217 if (! ieee_write_byte (abfd
, (bfd_byte
) length
))
220 else if (length
< 255)
222 if (! ieee_write_byte (abfd
, ieee_extension_length_1_enum
)
223 || ! ieee_write_byte (abfd
, (bfd_byte
) length
))
226 else if (length
< 65535)
228 if (! ieee_write_byte (abfd
, ieee_extension_length_2_enum
)
229 || ! ieee_write_2bytes (abfd
, (int) length
))
234 (*_bfd_error_handler
)
235 (_("%s: string too long (%d chars, max 65535)"),
236 bfd_get_filename (abfd
), length
);
237 bfd_set_error (bfd_error_invalid_operation
);
241 if (bfd_bwrite ((PTR
) id
, (bfd_size_type
) length
, abfd
) != length
)
246 /***************************************************************************
247 Functions for reading from ieee files in the strange way that the
251 #define this_byte(ieee) *((ieee)->input_p)
252 #define next_byte(ieee) ((ieee)->input_p++)
253 #define this_byte_and_next(ieee) (*((ieee)->input_p++))
255 static unsigned short
257 common_header_type
*ieee
;
259 unsigned char c1
= this_byte_and_next (ieee
);
260 unsigned char c2
= this_byte_and_next (ieee
);
261 return (c1
<< 8) | c2
;
265 bfd_get_string (ieee
, string
, length
)
266 common_header_type
*ieee
;
271 for (i
= 0; i
< length
; i
++)
273 string
[i
] = this_byte_and_next (ieee
);
279 common_header_type
*ieee
;
283 length
= this_byte_and_next (ieee
);
286 /* Simple string of length 0 to 127 */
288 else if (length
== 0xde)
290 /* Length is next byte, allowing 0..255 */
291 length
= this_byte_and_next (ieee
);
293 else if (length
== 0xdf)
295 /* Length is next two bytes, allowing 0..65535 */
296 length
= this_byte_and_next (ieee
);
297 length
= (length
* 256) + this_byte_and_next (ieee
);
299 /* Buy memory and read string */
300 string
= bfd_alloc (ieee
->abfd
, (bfd_size_type
) length
+ 1);
303 bfd_get_string (ieee
, string
, length
);
309 ieee_write_expression (abfd
, value
, symbol
, pcrel
, index
)
316 unsigned int term_count
= 0;
320 if (! ieee_write_int (abfd
, value
))
325 if (bfd_is_com_section (symbol
->section
)
326 || bfd_is_und_section (symbol
->section
))
328 /* Def of a common symbol */
329 if (! ieee_write_byte (abfd
, ieee_variable_X_enum
)
330 || ! ieee_write_int (abfd
, symbol
->value
))
334 else if (! bfd_is_abs_section (symbol
->section
))
336 /* Ref to defined symbol - */
338 if (symbol
->flags
& BSF_GLOBAL
)
340 if (! ieee_write_byte (abfd
, ieee_variable_I_enum
)
341 || ! ieee_write_int (abfd
, symbol
->value
))
345 else if (symbol
->flags
& (BSF_LOCAL
| BSF_SECTION_SYM
))
347 /* This is a reference to a defined local symbol. We can
348 easily do a local as a section+offset. */
349 if (! ieee_write_byte (abfd
, ieee_variable_R_enum
)
350 || ! ieee_write_byte (abfd
,
351 (bfd_byte
) (symbol
->section
->index
352 + IEEE_SECTION_NUMBER_BASE
)))
355 if (symbol
->value
!= 0)
357 if (! ieee_write_int (abfd
, symbol
->value
))
364 (*_bfd_error_handler
)
365 (_("%s: unrecognized symbol `%s' flags 0x%x"),
366 bfd_get_filename (abfd
), bfd_asymbol_name (symbol
),
368 bfd_set_error (bfd_error_invalid_operation
);
375 /* subtract the pc from here by asking for PC of this section*/
376 if (! ieee_write_byte (abfd
, ieee_variable_P_enum
)
377 || ! ieee_write_byte (abfd
,
378 (bfd_byte
) (index
+ IEEE_SECTION_NUMBER_BASE
))
379 || ! ieee_write_byte (abfd
, ieee_function_minus_enum
))
383 /* Handle the degenerate case of a 0 address. */
386 if (! ieee_write_int (abfd
, (bfd_vma
) 0))
390 while (term_count
> 1)
392 if (! ieee_write_byte (abfd
, ieee_function_plus_enum
))
400 /*****************************************************************************/
403 writes any integer into the buffer supplied and always takes 5 bytes
406 ieee_write_int5 (buffer
, value
)
410 buffer
[0] = (bfd_byte
) ieee_number_repeat_4_enum
;
411 buffer
[1] = (value
>> 24) & 0xff;
412 buffer
[2] = (value
>> 16) & 0xff;
413 buffer
[3] = (value
>> 8) & 0xff;
414 buffer
[4] = (value
>> 0) & 0xff;
418 ieee_write_int5_out (abfd
, value
)
424 ieee_write_int5 (b
, value
);
425 if (bfd_bwrite ((PTR
) b
, (bfd_size_type
) 5, abfd
) != 5)
431 parse_int (ieee
, value_ptr
)
432 common_header_type
*ieee
;
435 int value
= this_byte (ieee
);
437 if (value
>= 0 && value
<= 127)
443 else if (value
>= 0x80 && value
<= 0x88)
445 unsigned int count
= value
& 0xf;
450 result
= (result
<< 8) | this_byte_and_next (ieee
);
461 common_header_type
*ieee
;
465 *ok
= parse_int (ieee
, &x
);
470 must_parse_int (ieee
)
471 common_header_type
*ieee
;
474 BFD_ASSERT (parse_int (ieee
, &result
));
482 ieee_symbol_index_type symbol
;
486 #if KEEPMINUSPCININST
488 #define SRC_MASK(arg) arg
489 #define PCREL_OFFSET false
493 #define SRC_MASK(arg) 0
494 #define PCREL_OFFSET true
498 static reloc_howto_type abs32_howto
=
505 complain_overflow_bitfield
,
513 static reloc_howto_type abs16_howto
=
520 complain_overflow_bitfield
,
528 static reloc_howto_type abs8_howto
=
535 complain_overflow_bitfield
,
543 static reloc_howto_type rel32_howto
=
550 complain_overflow_signed
,
554 SRC_MASK (0xffffffff),
558 static reloc_howto_type rel16_howto
=
565 complain_overflow_signed
,
569 SRC_MASK (0x0000ffff),
573 static reloc_howto_type rel8_howto
=
580 complain_overflow_signed
,
584 SRC_MASK (0x000000ff),
588 static ieee_symbol_index_type NOSYMBOL
= {0, 0};
591 parse_expression (ieee
, value
, symbol
, pcrel
, extra
, section
)
592 ieee_data_type
*ieee
;
594 ieee_symbol_index_type
*symbol
;
607 ieee_value_type stack
[10];
609 /* The stack pointer always points to the next unused location */
610 #define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
611 #define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
612 ieee_value_type
*sp
= stack
;
615 while (loop
&& ieee
->h
.input_p
< ieee
->h
.last_byte
)
617 switch (this_byte (&(ieee
->h
)))
619 case ieee_variable_P_enum
:
620 /* P variable, current program counter for section n */
623 next_byte (&(ieee
->h
));
625 section_n
= must_parse_int (&(ieee
->h
));
626 PUSH (NOSYMBOL
, bfd_abs_section_ptr
, 0);
629 case ieee_variable_L_enum
:
630 /* L variable address of section N */
631 next_byte (&(ieee
->h
));
632 PUSH (NOSYMBOL
, ieee
->section_table
[must_parse_int (&(ieee
->h
))], 0);
634 case ieee_variable_R_enum
:
635 /* R variable, logical address of section module */
636 /* FIXME, this should be different to L */
637 next_byte (&(ieee
->h
));
638 PUSH (NOSYMBOL
, ieee
->section_table
[must_parse_int (&(ieee
->h
))], 0);
640 case ieee_variable_S_enum
:
641 /* S variable, size in MAUS of section module */
642 next_byte (&(ieee
->h
));
645 ieee
->section_table
[must_parse_int (&(ieee
->h
))]->_raw_size
);
647 case ieee_variable_I_enum
:
648 /* Push the address of variable n */
650 ieee_symbol_index_type sy
;
651 next_byte (&(ieee
->h
));
652 sy
.index
= (int) must_parse_int (&(ieee
->h
));
655 PUSH (sy
, bfd_abs_section_ptr
, 0);
658 case ieee_variable_X_enum
:
659 /* Push the address of external variable n */
661 ieee_symbol_index_type sy
;
662 next_byte (&(ieee
->h
));
663 sy
.index
= (int) (must_parse_int (&(ieee
->h
)));
666 PUSH (sy
, bfd_und_section_ptr
, 0);
669 case ieee_function_minus_enum
:
671 bfd_vma value1
, value2
;
672 asection
*section1
, *section_dummy
;
673 ieee_symbol_index_type sy
;
674 next_byte (&(ieee
->h
));
676 POP (sy
, section1
, value1
);
677 POP (sy
, section_dummy
, value2
);
678 PUSH (sy
, section1
? section1
: section_dummy
, value2
- value1
);
681 case ieee_function_plus_enum
:
683 bfd_vma value1
, value2
;
686 ieee_symbol_index_type sy1
;
687 ieee_symbol_index_type sy2
;
688 next_byte (&(ieee
->h
));
690 POP (sy1
, section1
, value1
);
691 POP (sy2
, section2
, value2
);
692 PUSH (sy1
.letter
? sy1
: sy2
,
693 bfd_is_abs_section (section1
) ? section2
: section1
,
700 BFD_ASSERT (this_byte (&(ieee
->h
)) < (int) ieee_variable_A_enum
701 || this_byte (&(ieee
->h
)) > (int) ieee_variable_Z_enum
);
702 if (parse_int (&(ieee
->h
), &va
))
704 PUSH (NOSYMBOL
, bfd_abs_section_ptr
, va
);
708 /* Thats all that we can understand. */
715 /* As far as I can see there is a bug in the Microtec IEEE output
716 which I'm using to scan, whereby the comma operator is omitted
717 sometimes in an expression, giving expressions with too many
718 terms. We can tell if that's the case by ensuring that
719 sp == stack here. If not, then we've pushed something too far,
720 so we keep adding. */
722 while (sp
!= stack
+ 1)
725 ieee_symbol_index_type sy1
;
726 POP (sy1
, section1
, *extra
);
729 POP (*symbol
, dummy
, *value
);
735 #define ieee_seek(ieee, offset) \
738 ieee->h.input_p = ieee->h.first_byte + offset; \
739 ieee->h.last_byte = (ieee->h.first_byte \
740 + ieee_part_after (ieee, offset)); \
744 #define ieee_pos(ieee) \
745 (ieee->h.input_p - ieee->h.first_byte)
747 /* Find the first part of the ieee file after HERE. */
750 ieee_part_after (ieee
, here
)
751 ieee_data_type
*ieee
;
755 file_ptr after
= ieee
->w
.r
.me_record
;
757 /* File parts can come in any order, except that module end is
758 guaranteed to be last (and the header first). */
759 for (part
= 0; part
< N_W_VARIABLES
; part
++)
760 if (ieee
->w
.offset
[part
] > here
&& after
> ieee
->w
.offset
[part
])
761 after
= ieee
->w
.offset
[part
];
766 static unsigned int last_index
;
767 static char last_type
; /* is the index for an X or a D */
769 static ieee_symbol_type
*
770 get_symbol (abfd
, ieee
, last_symbol
, symbol_count
, pptr
, max_index
, this_type
)
771 bfd
*abfd ATTRIBUTE_UNUSED
;
772 ieee_data_type
*ieee
;
773 ieee_symbol_type
*last_symbol
;
774 unsigned int *symbol_count
;
775 ieee_symbol_type
***pptr
;
776 unsigned int *max_index
;
779 /* Need a new symbol */
780 unsigned int new_index
= must_parse_int (&(ieee
->h
));
781 if (new_index
!= last_index
|| this_type
!= last_type
)
783 ieee_symbol_type
*new_symbol
;
784 bfd_size_type amt
= sizeof (ieee_symbol_type
);
786 new_symbol
= (ieee_symbol_type
*) bfd_alloc (ieee
->h
.abfd
, amt
);
790 new_symbol
->index
= new_index
;
791 last_index
= new_index
;
794 *pptr
= &new_symbol
->next
;
795 if (new_index
> *max_index
)
797 *max_index
= new_index
;
799 last_type
= this_type
;
800 new_symbol
->symbol
.section
= bfd_abs_section_ptr
;
807 ieee_slurp_external_symbols (abfd
)
810 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
811 file_ptr offset
= ieee
->w
.r
.external_part
;
813 ieee_symbol_type
**prev_symbols_ptr
= &ieee
->external_symbols
;
814 ieee_symbol_type
**prev_reference_ptr
= &ieee
->external_reference
;
815 ieee_symbol_type
*symbol
= (ieee_symbol_type
*) NULL
;
816 unsigned int symbol_count
= 0;
818 last_index
= 0xffffff;
819 ieee
->symbol_table_full
= true;
821 ieee_seek (ieee
, offset
);
825 switch (this_byte (&(ieee
->h
)))
828 next_byte (&(ieee
->h
));
830 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
832 &ieee
->external_symbol_max_index
, 'I');
836 symbol
->symbol
.the_bfd
= abfd
;
837 symbol
->symbol
.name
= read_id (&(ieee
->h
));
838 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
839 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
841 case ieee_external_symbol_enum
:
842 next_byte (&(ieee
->h
));
844 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
846 &ieee
->external_symbol_max_index
, 'D');
850 BFD_ASSERT (symbol
->index
>= ieee
->external_symbol_min_index
);
852 symbol
->symbol
.the_bfd
= abfd
;
853 symbol
->symbol
.name
= read_id (&(ieee
->h
));
854 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
855 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
857 case ieee_attribute_record_enum
>> 8:
859 unsigned int symbol_name_index
;
860 unsigned int symbol_type_index
;
861 unsigned int symbol_attribute_def
;
863 switch (read_2bytes (&ieee
->h
))
865 case ieee_attribute_record_enum
:
866 symbol_name_index
= must_parse_int (&(ieee
->h
));
867 symbol_type_index
= must_parse_int (&(ieee
->h
));
868 symbol_attribute_def
= must_parse_int (&(ieee
->h
));
869 switch (symbol_attribute_def
)
873 parse_int (&ieee
->h
, &value
);
876 (*_bfd_error_handler
)
877 (_("%s: unimplemented ATI record %u for symbol %u"),
878 bfd_archive_filename (abfd
), symbol_attribute_def
,
880 bfd_set_error (bfd_error_bad_value
);
885 case ieee_external_reference_info_record_enum
:
886 /* Skip over ATX record. */
887 parse_int (&(ieee
->h
), &value
);
888 parse_int (&(ieee
->h
), &value
);
889 parse_int (&(ieee
->h
), &value
);
890 parse_int (&(ieee
->h
), &value
);
892 case ieee_atn_record_enum
:
893 /* We may get call optimization information here,
894 which we just ignore. The format is
895 {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs} */
896 parse_int (&ieee
->h
, &value
);
897 parse_int (&ieee
->h
, &value
);
898 parse_int (&ieee
->h
, &value
);
901 (*_bfd_error_handler
)
902 (_("%s: unexpected ATN type %d in external part"),
903 bfd_archive_filename (abfd
), (int) value
);
904 bfd_set_error (bfd_error_bad_value
);
907 parse_int (&ieee
->h
, &value
);
908 parse_int (&ieee
->h
, &value
);
915 switch (read_2bytes (&ieee
->h
))
917 case ieee_asn_record_enum
:
918 parse_int (&ieee
->h
, &val1
);
919 parse_int (&ieee
->h
, &val1
);
923 (*_bfd_error_handler
)
924 (_("%s: unexpected type after ATN"),
925 bfd_archive_filename (abfd
));
926 bfd_set_error (bfd_error_bad_value
);
933 case ieee_value_record_enum
>> 8:
935 unsigned int symbol_name_index
;
936 ieee_symbol_index_type symbol_ignore
;
937 boolean pcrel_ignore
;
939 next_byte (&(ieee
->h
));
940 next_byte (&(ieee
->h
));
942 symbol_name_index
= must_parse_int (&(ieee
->h
));
943 parse_expression (ieee
,
944 &symbol
->symbol
.value
,
948 &symbol
->symbol
.section
);
950 /* Fully linked IEEE-695 files tend to give every symbol
951 an absolute value. Try to convert that back into a
952 section relative value. FIXME: This won't always to
954 if (bfd_is_abs_section (symbol
->symbol
.section
)
955 && (abfd
->flags
& HAS_RELOC
) == 0)
960 val
= symbol
->symbol
.value
;
961 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
963 if (val
>= s
->vma
&& val
< s
->vma
+ s
->_raw_size
)
965 symbol
->symbol
.section
= s
;
966 symbol
->symbol
.value
-= s
->vma
;
972 symbol
->symbol
.flags
= BSF_GLOBAL
| BSF_EXPORT
;
976 case ieee_weak_external_reference_enum
:
980 next_byte (&(ieee
->h
));
981 /* Throw away the external reference index */
982 (void) must_parse_int (&(ieee
->h
));
983 /* Fetch the default size if not resolved */
984 size
= must_parse_int (&(ieee
->h
));
985 /* Fetch the defautlt value if available */
986 if (! parse_int (&(ieee
->h
), &value
))
990 /* This turns into a common */
991 symbol
->symbol
.section
= bfd_com_section_ptr
;
992 symbol
->symbol
.value
= size
;
996 case ieee_external_reference_enum
:
997 next_byte (&(ieee
->h
));
999 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
1000 &prev_reference_ptr
,
1001 &ieee
->external_reference_max_index
, 'X');
1005 symbol
->symbol
.the_bfd
= abfd
;
1006 symbol
->symbol
.name
= read_id (&(ieee
->h
));
1007 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
1008 symbol
->symbol
.section
= bfd_und_section_ptr
;
1009 symbol
->symbol
.value
= (bfd_vma
) 0;
1010 symbol
->symbol
.flags
= 0;
1012 BFD_ASSERT (symbol
->index
>= ieee
->external_reference_min_index
);
1020 if (ieee
->external_symbol_max_index
!= 0)
1022 ieee
->external_symbol_count
=
1023 ieee
->external_symbol_max_index
-
1024 ieee
->external_symbol_min_index
+ 1;
1028 ieee
->external_symbol_count
= 0;
1031 if (ieee
->external_reference_max_index
!= 0)
1033 ieee
->external_reference_count
=
1034 ieee
->external_reference_max_index
-
1035 ieee
->external_reference_min_index
+ 1;
1039 ieee
->external_reference_count
= 0;
1043 ieee
->external_reference_count
+ ieee
->external_symbol_count
;
1045 if (symbol_count
!= abfd
->symcount
)
1047 /* There are gaps in the table -- */
1048 ieee
->symbol_table_full
= false;
1051 *prev_symbols_ptr
= (ieee_symbol_type
*) NULL
;
1052 *prev_reference_ptr
= (ieee_symbol_type
*) NULL
;
1058 ieee_slurp_symbol_table (abfd
)
1061 if (! IEEE_DATA (abfd
)->read_symbols
)
1063 if (! ieee_slurp_external_symbols (abfd
))
1065 IEEE_DATA (abfd
)->read_symbols
= true;
1071 ieee_get_symtab_upper_bound (abfd
)
1074 if (! ieee_slurp_symbol_table (abfd
))
1077 return (abfd
->symcount
!= 0) ?
1078 (abfd
->symcount
+ 1) * (sizeof (ieee_symbol_type
*)) : 0;
1082 Move from our internal lists to the canon table, and insert in
1086 extern const bfd_target ieee_vec
;
1089 ieee_get_symtab (abfd
, location
)
1093 ieee_symbol_type
*symp
;
1094 static bfd dummy_bfd
;
1095 static asymbol empty_symbol
=
1103 /* K&R compilers can't initialise unions. */
1110 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1111 dummy_bfd
.xvec
= &ieee_vec
;
1112 if (! ieee_slurp_symbol_table (abfd
))
1115 if (! ieee
->symbol_table_full
)
1117 /* Arrgh - there are gaps in the table, run through and fill them */
1118 /* up with pointers to a null place */
1120 for (i
= 0; i
< abfd
->symcount
; i
++)
1122 location
[i
] = &empty_symbol
;
1126 ieee
->external_symbol_base_offset
= -ieee
->external_symbol_min_index
;
1127 for (symp
= IEEE_DATA (abfd
)->external_symbols
;
1128 symp
!= (ieee_symbol_type
*) NULL
;
1131 /* Place into table at correct index locations */
1132 location
[symp
->index
+ ieee
->external_symbol_base_offset
] = &symp
->symbol
;
1135 /* The external refs are indexed in a bit */
1136 ieee
->external_reference_base_offset
=
1137 -ieee
->external_reference_min_index
+ ieee
->external_symbol_count
;
1139 for (symp
= IEEE_DATA (abfd
)->external_reference
;
1140 symp
!= (ieee_symbol_type
*) NULL
;
1143 location
[symp
->index
+ ieee
->external_reference_base_offset
] =
1150 location
[abfd
->symcount
] = (asymbol
*) NULL
;
1152 return abfd
->symcount
;
1156 get_section_entry (abfd
, ieee
, index
)
1158 ieee_data_type
*ieee
;
1161 if (index
>= ieee
->section_table_size
)
1167 c
= ieee
->section_table_size
;
1174 amt
*= sizeof (asection
*);
1175 n
= (asection
**) bfd_realloc (ieee
->section_table
, amt
);
1179 for (i
= ieee
->section_table_size
; i
< c
; i
++)
1182 ieee
->section_table
= n
;
1183 ieee
->section_table_size
= c
;
1186 if (ieee
->section_table
[index
] == (asection
*) NULL
)
1188 char *tmp
= bfd_alloc (abfd
, (bfd_size_type
) 11);
1193 sprintf (tmp
, " fsec%4d", index
);
1194 section
= bfd_make_section (abfd
, tmp
);
1195 ieee
->section_table
[index
] = section
;
1196 section
->flags
= SEC_NO_FLAGS
;
1197 section
->target_index
= index
;
1198 ieee
->section_table
[index
] = section
;
1200 return ieee
->section_table
[index
];
1204 ieee_slurp_sections (abfd
)
1207 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1208 file_ptr offset
= ieee
->w
.r
.section_part
;
1213 bfd_byte section_type
[3];
1214 ieee_seek (ieee
, offset
);
1217 switch (this_byte (&(ieee
->h
)))
1219 case ieee_section_type_enum
:
1222 unsigned int section_index
;
1223 next_byte (&(ieee
->h
));
1224 section_index
= must_parse_int (&(ieee
->h
));
1226 section
= get_section_entry (abfd
, ieee
, section_index
);
1228 section_type
[0] = this_byte_and_next (&(ieee
->h
));
1230 /* Set minimal section attributes. Attributes are
1231 extended later, based on section contents. */
1233 switch (section_type
[0])
1236 /* Normal attributes for absolute sections */
1237 section_type
[1] = this_byte (&(ieee
->h
));
1238 section
->flags
= SEC_ALLOC
;
1239 switch (section_type
[1])
1241 case 0xD3: /* AS Absolute section attributes */
1242 next_byte (&(ieee
->h
));
1243 section_type
[2] = this_byte (&(ieee
->h
));
1244 switch (section_type
[2])
1248 next_byte (&(ieee
->h
));
1249 section
->flags
|= SEC_CODE
;
1253 next_byte (&(ieee
->h
));
1254 section
->flags
|= SEC_DATA
;
1257 next_byte (&(ieee
->h
));
1258 /* Normal rom data */
1259 section
->flags
|= SEC_ROM
| SEC_DATA
;
1266 case 0xC3: /* Named relocatable sections (type C) */
1267 section_type
[1] = this_byte (&(ieee
->h
));
1268 section
->flags
= SEC_ALLOC
;
1269 switch (section_type
[1])
1271 case 0xD0: /* Normal code (CP) */
1272 next_byte (&(ieee
->h
));
1273 section
->flags
|= SEC_CODE
;
1275 case 0xC4: /* Normal data (CD) */
1276 next_byte (&(ieee
->h
));
1277 section
->flags
|= SEC_DATA
;
1279 case 0xD2: /* Normal rom data (CR) */
1280 next_byte (&(ieee
->h
));
1281 section
->flags
|= SEC_ROM
| SEC_DATA
;
1288 /* Read section name, use it if non empty. */
1289 name
= read_id (&ieee
->h
);
1291 section
->name
= name
;
1293 /* Skip these fields, which we don't care about */
1295 bfd_vma parent
, brother
, context
;
1296 parse_int (&(ieee
->h
), &parent
);
1297 parse_int (&(ieee
->h
), &brother
);
1298 parse_int (&(ieee
->h
), &context
);
1302 case ieee_section_alignment_enum
:
1304 unsigned int section_index
;
1307 next_byte (&(ieee
->h
));
1308 section_index
= must_parse_int (&ieee
->h
);
1309 section
= get_section_entry (abfd
, ieee
, section_index
);
1310 if (section_index
> ieee
->section_count
)
1312 ieee
->section_count
= section_index
;
1314 section
->alignment_power
=
1315 bfd_log2 (must_parse_int (&ieee
->h
));
1316 (void) parse_int (&(ieee
->h
), &value
);
1319 case ieee_e2_first_byte_enum
:
1322 ieee_record_enum_type t
;
1324 t
= (ieee_record_enum_type
) (read_2bytes (&(ieee
->h
)));
1327 case ieee_section_size_enum
:
1328 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1329 section
->_raw_size
= must_parse_int (&(ieee
->h
));
1331 case ieee_physical_region_size_enum
:
1332 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1333 section
->_raw_size
= must_parse_int (&(ieee
->h
));
1335 case ieee_region_base_address_enum
:
1336 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1337 section
->vma
= must_parse_int (&(ieee
->h
));
1338 section
->lma
= section
->vma
;
1340 case ieee_mau_size_enum
:
1341 must_parse_int (&(ieee
->h
));
1342 must_parse_int (&(ieee
->h
));
1344 case ieee_m_value_enum
:
1345 must_parse_int (&(ieee
->h
));
1346 must_parse_int (&(ieee
->h
));
1348 case ieee_section_base_address_enum
:
1349 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1350 section
->vma
= must_parse_int (&(ieee
->h
));
1351 section
->lma
= section
->vma
;
1353 case ieee_section_offset_enum
:
1354 (void) must_parse_int (&(ieee
->h
));
1355 (void) must_parse_int (&(ieee
->h
));
1369 /* Make a section for the debugging information, if any. We don't try
1370 to interpret the debugging information; we just point the section
1371 at the area in the file so that program which understand can dig it
1375 ieee_slurp_debug (abfd
)
1378 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1382 if (ieee
->w
.r
.debug_information_part
== 0)
1385 sec
= bfd_make_section (abfd
, ".debug");
1388 sec
->flags
|= SEC_DEBUGGING
| SEC_HAS_CONTENTS
;
1389 sec
->filepos
= ieee
->w
.r
.debug_information_part
;
1391 debug_end
= ieee_part_after (ieee
, ieee
->w
.r
.debug_information_part
);
1392 sec
->_raw_size
= debug_end
- ieee
->w
.r
.debug_information_part
;
1397 /***********************************************************************
1402 ieee_archive_p (abfd
)
1407 unsigned char buffer
[512];
1408 file_ptr buffer_offset
= 0;
1409 ieee_ar_data_type
*save
= abfd
->tdata
.ieee_ar_data
;
1410 ieee_ar_data_type
*ieee
;
1411 bfd_size_type alc_elts
;
1412 ieee_ar_obstack_type
*elts
= NULL
;
1413 bfd_size_type amt
= sizeof (ieee_ar_data_type
);
1415 abfd
->tdata
.ieee_ar_data
= (ieee_ar_data_type
*) bfd_alloc (abfd
, amt
);
1416 if (!abfd
->tdata
.ieee_ar_data
)
1417 goto error_ret_restore
;
1418 ieee
= IEEE_AR_DATA (abfd
);
1420 /* Ignore the return value here. It doesn't matter if we don't read
1421 the entire buffer. We might have a very small ieee file. */
1422 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1424 ieee
->h
.first_byte
= buffer
;
1425 ieee
->h
.input_p
= buffer
;
1427 ieee
->h
.abfd
= abfd
;
1429 if (this_byte (&(ieee
->h
)) != Module_Beginning
)
1430 goto got_wrong_format_error
;
1432 next_byte (&(ieee
->h
));
1433 library
= read_id (&(ieee
->h
));
1434 if (strcmp (library
, "LIBRARY") != 0)
1435 goto got_wrong_format_error
;
1437 /* Throw away the filename. */
1438 read_id (&(ieee
->h
));
1440 ieee
->element_count
= 0;
1441 ieee
->element_index
= 0;
1443 next_byte (&(ieee
->h
)); /* Drop the ad part. */
1444 must_parse_int (&(ieee
->h
)); /* And the two dummy numbers. */
1445 must_parse_int (&(ieee
->h
));
1448 elts
= (ieee_ar_obstack_type
*) bfd_malloc (alc_elts
* sizeof *elts
);
1452 /* Read the index of the BB table. */
1456 ieee_ar_obstack_type
*t
;
1458 rec
= read_2bytes (&(ieee
->h
));
1459 if (rec
!= (int) ieee_assign_value_to_variable_enum
)
1462 if (ieee
->element_count
>= alc_elts
)
1464 ieee_ar_obstack_type
*n
;
1467 n
= ((ieee_ar_obstack_type
*)
1468 bfd_realloc (elts
, alc_elts
* sizeof *elts
));
1474 t
= &elts
[ieee
->element_count
];
1475 ieee
->element_count
++;
1477 must_parse_int (&(ieee
->h
));
1478 t
->file_offset
= must_parse_int (&(ieee
->h
));
1479 t
->abfd
= (bfd
*) NULL
;
1481 /* Make sure that we don't go over the end of the buffer. */
1482 if ((size_t) ieee_pos (IEEE_DATA (abfd
)) > sizeof (buffer
) / 2)
1484 /* Past half way, reseek and reprime. */
1485 buffer_offset
+= ieee_pos (IEEE_DATA (abfd
));
1486 if (bfd_seek (abfd
, buffer_offset
, SEEK_SET
) != 0)
1489 /* Again ignore return value of bfd_bread. */
1490 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1491 ieee
->h
.first_byte
= buffer
;
1492 ieee
->h
.input_p
= buffer
;
1496 amt
= ieee
->element_count
;
1497 amt
*= sizeof *ieee
->elements
;
1498 ieee
->elements
= (ieee_ar_obstack_type
*) bfd_alloc (abfd
, amt
);
1499 if (ieee
->elements
== NULL
)
1502 memcpy (ieee
->elements
, elts
, (size_t) amt
);
1506 /* Now scan the area again, and replace BB offsets with file offsets. */
1507 for (i
= 2; i
< ieee
->element_count
; i
++)
1509 if (bfd_seek (abfd
, ieee
->elements
[i
].file_offset
, SEEK_SET
) != 0)
1512 /* Again ignore return value of bfd_bread. */
1513 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1514 ieee
->h
.first_byte
= buffer
;
1515 ieee
->h
.input_p
= buffer
;
1517 next_byte (&(ieee
->h
)); /* Drop F8. */
1518 next_byte (&(ieee
->h
)); /* Drop 14. */
1519 must_parse_int (&(ieee
->h
)); /* Drop size of block. */
1521 if (must_parse_int (&(ieee
->h
)) != 0)
1522 /* This object has been deleted. */
1523 ieee
->elements
[i
].file_offset
= 0;
1525 ieee
->elements
[i
].file_offset
= must_parse_int (&(ieee
->h
));
1528 /* abfd->has_armap = ;*/
1532 got_wrong_format_error
:
1533 bfd_set_error (bfd_error_wrong_format
);
1537 bfd_release (abfd
, ieee
);
1539 abfd
->tdata
.ieee_ar_data
= save
;
1545 ieee_object_p (abfd
)
1550 ieee_data_type
*ieee
;
1551 unsigned char buffer
[300];
1552 ieee_data_type
*save
= IEEE_DATA (abfd
);
1555 abfd
->tdata
.ieee_data
= 0;
1556 ieee_mkobject (abfd
);
1558 ieee
= IEEE_DATA (abfd
);
1559 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
1561 /* Read the first few bytes in to see if it makes sense. Ignore
1562 bfd_bread return value; The file might be very small. */
1563 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1565 ieee
->h
.input_p
= buffer
;
1566 if (this_byte_and_next (&(ieee
->h
)) != Module_Beginning
)
1567 goto got_wrong_format
;
1569 ieee
->read_symbols
= false;
1570 ieee
->read_data
= false;
1571 ieee
->section_count
= 0;
1572 ieee
->external_symbol_max_index
= 0;
1573 ieee
->external_symbol_min_index
= IEEE_PUBLIC_BASE
;
1574 ieee
->external_reference_min_index
= IEEE_REFERENCE_BASE
;
1575 ieee
->external_reference_max_index
= 0;
1576 ieee
->h
.abfd
= abfd
;
1577 ieee
->section_table
= NULL
;
1578 ieee
->section_table_size
= 0;
1580 processor
= ieee
->mb
.processor
= read_id (&(ieee
->h
));
1581 if (strcmp (processor
, "LIBRARY") == 0)
1582 goto got_wrong_format
;
1583 ieee
->mb
.module_name
= read_id (&(ieee
->h
));
1584 if (abfd
->filename
== (const char *) NULL
)
1586 abfd
->filename
= ieee
->mb
.module_name
;
1588 /* Determine the architecture and machine type of the object file.
1591 const bfd_arch_info_type
*arch
;
1594 /* IEEE does not specify the format of the processor identificaton
1595 string, so the compiler is free to put in it whatever it wants.
1596 We try here to recognize different processors belonging to the
1597 m68k family. Code for other processors can be added here. */
1598 if ((processor
[0] == '6') && (processor
[1] == '8'))
1600 if (processor
[2] == '3') /* 683xx integrated processors */
1602 switch (processor
[3])
1604 case '0': /* 68302, 68306, 68307 */
1605 case '2': /* 68322, 68328 */
1606 case '5': /* 68356 */
1607 strcpy (family
, "68000"); /* MC68000-based controllers */
1610 case '3': /* 68330, 68331, 68332, 68333,
1611 68334, 68335, 68336, 68338 */
1612 case '6': /* 68360 */
1613 case '7': /* 68376 */
1614 strcpy (family
, "68332"); /* CPU32 and CPU32+ */
1618 if (processor
[4] == '9') /* 68349 */
1619 strcpy (family
, "68030"); /* CPU030 */
1620 else /* 68340, 68341 */
1621 strcpy (family
, "68332"); /* CPU32 and CPU32+ */
1624 default: /* Does not exist yet */
1625 strcpy (family
, "68332"); /* Guess it will be CPU32 */
1628 else if (TOUPPER (processor
[3]) == 'F') /* 68F333 */
1629 strcpy (family
, "68332"); /* CPU32 */
1630 else if ((TOUPPER (processor
[3]) == 'C') /* Embedded controllers */
1631 && ((TOUPPER (processor
[2]) == 'E')
1632 || (TOUPPER (processor
[2]) == 'H')
1633 || (TOUPPER (processor
[2]) == 'L')))
1635 strcpy (family
, "68");
1636 strncat (family
, processor
+ 4, 7);
1639 else /* "Regular" processors */
1641 strncpy (family
, processor
, 9);
1645 else if ((strncmp (processor
, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
1646 || (strncmp (processor
, "CPU32", 5) == 0))
1647 strcpy (family
, "68332");
1650 strncpy (family
, processor
, 9);
1654 arch
= bfd_scan_arch (family
);
1656 goto got_wrong_format
;
1657 abfd
->arch_info
= arch
;
1660 if (this_byte (&(ieee
->h
)) != (int) ieee_address_descriptor_enum
)
1664 next_byte (&(ieee
->h
));
1666 if (! parse_int (&(ieee
->h
), &ieee
->ad
.number_of_bits_mau
))
1670 if (! parse_int (&(ieee
->h
), &ieee
->ad
.number_of_maus_in_address
))
1675 /* If there is a byte order info, take it */
1676 if (this_byte (&(ieee
->h
)) == (int) ieee_variable_L_enum
||
1677 this_byte (&(ieee
->h
)) == (int) ieee_variable_M_enum
)
1678 next_byte (&(ieee
->h
));
1680 for (part
= 0; part
< N_W_VARIABLES
; part
++)
1683 if (read_2bytes (&(ieee
->h
)) != (int) ieee_assign_value_to_variable_enum
)
1687 if (this_byte_and_next (&(ieee
->h
)) != part
)
1692 ieee
->w
.offset
[part
] = parse_i (&(ieee
->h
), &ok
);
1700 if (ieee
->w
.r
.external_part
!= 0)
1701 abfd
->flags
= HAS_SYMS
;
1703 /* By now we know that this is a real IEEE file, we're going to read
1704 the whole thing into memory so that we can run up and down it
1705 quickly. We can work out how big the file is from the trailer
1708 amt
= ieee
->w
.r
.me_record
+ 1;
1709 IEEE_DATA (abfd
)->h
.first_byte
=
1710 (unsigned char *) bfd_alloc (ieee
->h
.abfd
, amt
);
1711 if (!IEEE_DATA (abfd
)->h
.first_byte
)
1713 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
1715 /* FIXME: Check return value. I'm not sure whether it needs to read
1716 the entire buffer or not. */
1717 bfd_bread ((PTR
) (IEEE_DATA (abfd
)->h
.first_byte
),
1718 (bfd_size_type
) ieee
->w
.r
.me_record
+ 1, abfd
);
1720 ieee_slurp_sections (abfd
);
1722 if (! ieee_slurp_debug (abfd
))
1725 /* Parse section data to activate file and section flags implied by
1726 section contents. */
1728 if (! ieee_slurp_section_data (abfd
))
1733 bfd_set_error (bfd_error_wrong_format
);
1735 bfd_release (abfd
, ieee
);
1736 abfd
->tdata
.ieee_data
= save
;
1737 return (const bfd_target
*) NULL
;
1741 ieee_get_symbol_info (ignore_abfd
, symbol
, ret
)
1742 bfd
*ignore_abfd ATTRIBUTE_UNUSED
;
1746 bfd_symbol_info (symbol
, ret
);
1747 if (symbol
->name
[0] == ' ')
1748 ret
->name
= "* empty table entry ";
1749 if (!symbol
->section
)
1750 ret
->type
= (symbol
->flags
& BSF_LOCAL
) ? 'a' : 'A';
1754 ieee_print_symbol (abfd
, afile
, symbol
, how
)
1758 bfd_print_symbol_type how
;
1760 FILE *file
= (FILE *) afile
;
1764 case bfd_print_symbol_name
:
1765 fprintf (file
, "%s", symbol
->name
);
1767 case bfd_print_symbol_more
:
1769 fprintf (file
, "%4x %2x", aout_symbol (symbol
)->desc
& 0xffff,
1770 aout_symbol (symbol
)->other
& 0xff);
1774 case bfd_print_symbol_all
:
1776 const char *section_name
=
1777 (symbol
->section
== (asection
*) NULL
1779 : symbol
->section
->name
);
1780 if (symbol
->name
[0] == ' ')
1782 fprintf (file
, "* empty table entry ");
1786 bfd_print_symbol_vandf (abfd
, (PTR
) file
, symbol
);
1788 fprintf (file
, " %-5s %04x %02x %s",
1790 (unsigned) ieee_symbol (symbol
)->index
,
1800 do_one (ieee
, current_map
, location_ptr
, s
, iterations
)
1801 ieee_data_type
*ieee
;
1802 ieee_per_section_type
*current_map
;
1803 unsigned char *location_ptr
;
1807 switch (this_byte (&(ieee
->h
)))
1809 case ieee_load_constant_bytes_enum
:
1811 unsigned int number_of_maus
;
1813 next_byte (&(ieee
->h
));
1814 number_of_maus
= must_parse_int (&(ieee
->h
));
1816 for (i
= 0; i
< number_of_maus
; i
++)
1818 location_ptr
[current_map
->pc
++] = this_byte (&(ieee
->h
));
1819 next_byte (&(ieee
->h
));
1824 case ieee_load_with_relocation_enum
:
1826 boolean loop
= true;
1827 next_byte (&(ieee
->h
));
1830 switch (this_byte (&(ieee
->h
)))
1832 case ieee_variable_R_enum
:
1834 case ieee_function_signed_open_b_enum
:
1835 case ieee_function_unsigned_open_b_enum
:
1836 case ieee_function_either_open_b_enum
:
1838 unsigned int extra
= 4;
1839 boolean pcrel
= false;
1842 bfd_size_type amt
= sizeof (ieee_reloc_type
);
1844 r
= (ieee_reloc_type
*) bfd_alloc (ieee
->h
.abfd
, amt
);
1848 *(current_map
->reloc_tail_ptr
) = r
;
1849 current_map
->reloc_tail_ptr
= &r
->next
;
1850 r
->next
= (ieee_reloc_type
*) NULL
;
1851 next_byte (&(ieee
->h
));
1853 r
->relent
.sym_ptr_ptr
= 0;
1854 parse_expression (ieee
,
1857 &pcrel
, &extra
, §ion
);
1858 r
->relent
.address
= current_map
->pc
;
1859 s
->flags
|= SEC_RELOC
;
1860 s
->owner
->flags
|= HAS_RELOC
;
1862 if (r
->relent
.sym_ptr_ptr
== NULL
&& section
!= NULL
)
1863 r
->relent
.sym_ptr_ptr
= section
->symbol_ptr_ptr
;
1865 if (this_byte (&(ieee
->h
)) == (int) ieee_comma
)
1867 next_byte (&(ieee
->h
));
1868 /* Fetch number of bytes to pad */
1869 extra
= must_parse_int (&(ieee
->h
));
1872 switch (this_byte (&(ieee
->h
)))
1874 case ieee_function_signed_close_b_enum
:
1875 next_byte (&(ieee
->h
));
1877 case ieee_function_unsigned_close_b_enum
:
1878 next_byte (&(ieee
->h
));
1880 case ieee_function_either_close_b_enum
:
1881 next_byte (&(ieee
->h
));
1886 /* Build a relocation entry for this type */
1887 /* If pc rel then stick -ve pc into instruction
1888 and take out of reloc ..
1890 I've changed this. It's all too complicated. I
1891 keep 0 in the instruction now. */
1900 #if KEEPMINUSPCININST
1901 bfd_put_32 (ieee
->h
.abfd
, -current_map
->pc
,
1902 location_ptr
+ current_map
->pc
);
1903 r
->relent
.howto
= &rel32_howto
;
1904 r
->relent
.addend
-= current_map
->pc
;
1906 bfd_put_32 (ieee
->h
.abfd
, (bfd_vma
) 0, location_ptr
+
1908 r
->relent
.howto
= &rel32_howto
;
1913 bfd_put_32 (ieee
->h
.abfd
, (bfd_vma
) 0,
1914 location_ptr
+ current_map
->pc
);
1915 r
->relent
.howto
= &abs32_howto
;
1917 current_map
->pc
+= 4;
1922 #if KEEPMINUSPCININST
1923 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) -current_map
->pc
,
1924 location_ptr
+ current_map
->pc
);
1925 r
->relent
.addend
-= current_map
->pc
;
1926 r
->relent
.howto
= &rel16_howto
;
1929 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) 0,
1930 location_ptr
+ current_map
->pc
);
1931 r
->relent
.howto
= &rel16_howto
;
1937 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) 0,
1938 location_ptr
+ current_map
->pc
);
1939 r
->relent
.howto
= &abs16_howto
;
1941 current_map
->pc
+= 2;
1946 #if KEEPMINUSPCININST
1947 bfd_put_8 (ieee
->h
.abfd
, (int) (-current_map
->pc
), location_ptr
+ current_map
->pc
);
1948 r
->relent
.addend
-= current_map
->pc
;
1949 r
->relent
.howto
= &rel8_howto
;
1951 bfd_put_8 (ieee
->h
.abfd
, 0, location_ptr
+ current_map
->pc
);
1952 r
->relent
.howto
= &rel8_howto
;
1957 bfd_put_8 (ieee
->h
.abfd
, 0, location_ptr
+ current_map
->pc
);
1958 r
->relent
.howto
= &abs8_howto
;
1960 current_map
->pc
+= 1;
1972 if (parse_int (&(ieee
->h
), &this_size
))
1975 for (i
= 0; i
< this_size
; i
++)
1977 location_ptr
[current_map
->pc
++] = this_byte (&(ieee
->h
));
1978 next_byte (&(ieee
->h
));
1988 /* Prevent more than the first load-item of an LR record
1989 from being repeated (MRI convention). */
1990 if (iterations
!= 1)
1998 /* Read in all the section data and relocation stuff too */
2000 ieee_slurp_section_data (abfd
)
2003 bfd_byte
*location_ptr
= (bfd_byte
*) NULL
;
2004 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2005 unsigned int section_number
;
2007 ieee_per_section_type
*current_map
= (ieee_per_section_type
*) NULL
;
2009 /* Seek to the start of the data area */
2010 if (ieee
->read_data
)
2012 ieee
->read_data
= true;
2013 ieee_seek (ieee
, ieee
->w
.r
.data_part
);
2015 /* Allocate enough space for all the section contents */
2017 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
2019 ieee_per_section_type
*per
= (ieee_per_section_type
*) s
->used_by_bfd
;
2020 if ((s
->flags
& SEC_DEBUGGING
) != 0)
2022 per
->data
= (bfd_byte
*) bfd_alloc (ieee
->h
.abfd
, s
->_raw_size
);
2026 per
->reloc_tail_ptr
=
2027 (ieee_reloc_type
**) & (s
->relocation
);
2032 switch (this_byte (&(ieee
->h
)))
2034 /* IF we see anything strange then quit */
2038 case ieee_set_current_section_enum
:
2039 next_byte (&(ieee
->h
));
2040 section_number
= must_parse_int (&(ieee
->h
));
2041 s
= ieee
->section_table
[section_number
];
2042 s
->flags
|= SEC_LOAD
| SEC_HAS_CONTENTS
;
2043 current_map
= (ieee_per_section_type
*) s
->used_by_bfd
;
2044 location_ptr
= current_map
->data
- s
->vma
;
2045 /* The document I have says that Microtec's compilers reset */
2046 /* this after a sec section, even though the standard says not */
2048 current_map
->pc
= s
->vma
;
2051 case ieee_e2_first_byte_enum
:
2052 next_byte (&(ieee
->h
));
2053 switch (this_byte (&(ieee
->h
)))
2055 case ieee_set_current_pc_enum
& 0xff:
2058 ieee_symbol_index_type symbol
;
2061 next_byte (&(ieee
->h
));
2062 must_parse_int (&(ieee
->h
)); /* Throw away section #*/
2063 parse_expression (ieee
, &value
,
2067 current_map
->pc
= value
;
2068 BFD_ASSERT ((unsigned) (value
- s
->vma
) <= s
->_raw_size
);
2072 case ieee_value_starting_address_enum
& 0xff:
2073 next_byte (&(ieee
->h
));
2074 if (this_byte (&(ieee
->h
)) == ieee_function_either_open_b_enum
)
2075 next_byte (&(ieee
->h
));
2076 abfd
->start_address
= must_parse_int (&(ieee
->h
));
2077 /* We've got to the end of the data now - */
2084 case ieee_repeat_data_enum
:
2086 /* Repeat the following LD or LR n times - we do this by
2087 remembering the stream pointer before running it and
2088 resetting it and running it n times. We special case
2089 the repetition of a repeat_data/load_constant
2092 unsigned int iterations
;
2093 unsigned char *start
;
2094 next_byte (&(ieee
->h
));
2095 iterations
= must_parse_int (&(ieee
->h
));
2096 start
= ieee
->h
.input_p
;
2097 if (start
[0] == (int) ieee_load_constant_bytes_enum
&&
2100 while (iterations
!= 0)
2102 location_ptr
[current_map
->pc
++] = start
[2];
2105 next_byte (&(ieee
->h
));
2106 next_byte (&(ieee
->h
));
2107 next_byte (&(ieee
->h
));
2111 while (iterations
!= 0)
2113 ieee
->h
.input_p
= start
;
2114 if (!do_one (ieee
, current_map
, location_ptr
, s
,
2122 case ieee_load_constant_bytes_enum
:
2123 case ieee_load_with_relocation_enum
:
2125 if (!do_one (ieee
, current_map
, location_ptr
, s
, 1))
2133 ieee_new_section_hook (abfd
, newsect
)
2137 newsect
->used_by_bfd
= (PTR
)
2138 bfd_alloc (abfd
, (bfd_size_type
) sizeof (ieee_per_section_type
));
2139 if (!newsect
->used_by_bfd
)
2141 ieee_per_section (newsect
)->data
= (bfd_byte
*) NULL
;
2142 ieee_per_section (newsect
)->section
= newsect
;
2147 ieee_get_reloc_upper_bound (abfd
, asect
)
2151 if ((asect
->flags
& SEC_DEBUGGING
) != 0)
2153 if (! ieee_slurp_section_data (abfd
))
2155 return (asect
->reloc_count
+ 1) * sizeof (arelent
*);
2159 ieee_get_section_contents (abfd
, section
, location
, offset
, count
)
2164 bfd_size_type count
;
2166 ieee_per_section_type
*p
= (ieee_per_section_type
*) section
->used_by_bfd
;
2167 if ((section
->flags
& SEC_DEBUGGING
) != 0)
2168 return _bfd_generic_get_section_contents (abfd
, section
, location
,
2170 ieee_slurp_section_data (abfd
);
2171 (void) memcpy ((PTR
) location
, (PTR
) (p
->data
+ offset
), (unsigned) count
);
2176 ieee_canonicalize_reloc (abfd
, section
, relptr
, symbols
)
2182 /* ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;*/
2183 ieee_reloc_type
*src
= (ieee_reloc_type
*) (section
->relocation
);
2184 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2186 if ((section
->flags
& SEC_DEBUGGING
) != 0)
2189 while (src
!= (ieee_reloc_type
*) NULL
)
2191 /* Work out which symbol to attach it this reloc to */
2192 switch (src
->symbol
.letter
)
2195 src
->relent
.sym_ptr_ptr
=
2196 symbols
+ src
->symbol
.index
+ ieee
->external_symbol_base_offset
;
2199 src
->relent
.sym_ptr_ptr
=
2200 symbols
+ src
->symbol
.index
+ ieee
->external_reference_base_offset
;
2203 if (src
->relent
.sym_ptr_ptr
!= NULL
)
2204 src
->relent
.sym_ptr_ptr
=
2205 src
->relent
.sym_ptr_ptr
[0]->section
->symbol_ptr_ptr
;
2211 *relptr
++ = &src
->relent
;
2214 *relptr
= (arelent
*) NULL
;
2215 return section
->reloc_count
;
2223 arelent
*a
= *((arelent
**) ap
);
2224 arelent
*b
= *((arelent
**) bp
);
2225 return a
->address
- b
->address
;
2228 /* Write the section headers. */
2231 ieee_write_section_part (abfd
)
2234 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2236 ieee
->w
.r
.section_part
= bfd_tell (abfd
);
2237 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
2239 if (! bfd_is_abs_section (s
)
2240 && (s
->flags
& SEC_DEBUGGING
) == 0)
2242 if (! ieee_write_byte (abfd
, ieee_section_type_enum
)
2243 || ! ieee_write_byte (abfd
,
2244 (bfd_byte
) (s
->index
2245 + IEEE_SECTION_NUMBER_BASE
)))
2248 if (abfd
->flags
& EXEC_P
)
2250 /* This image is executable, so output absolute sections */
2251 if (! ieee_write_byte (abfd
, ieee_variable_A_enum
)
2252 || ! ieee_write_byte (abfd
, ieee_variable_S_enum
))
2257 if (! ieee_write_byte (abfd
, ieee_variable_C_enum
))
2261 switch (s
->flags
& (SEC_CODE
| SEC_DATA
| SEC_ROM
))
2263 case SEC_CODE
| SEC_LOAD
:
2265 if (! ieee_write_byte (abfd
, ieee_variable_P_enum
))
2270 if (! ieee_write_byte (abfd
, ieee_variable_D_enum
))
2274 case SEC_ROM
| SEC_DATA
:
2275 case SEC_ROM
| SEC_LOAD
:
2276 case SEC_ROM
| SEC_DATA
| SEC_LOAD
:
2277 if (! ieee_write_byte (abfd
, ieee_variable_R_enum
))
2282 if (! ieee_write_id (abfd
, s
->name
))
2285 ieee_write_int (abfd
, 0); /* Parent */
2286 ieee_write_int (abfd
, 0); /* Brother */
2287 ieee_write_int (abfd
, 0); /* Context */
2290 if (! ieee_write_byte (abfd
, ieee_section_alignment_enum
)
2291 || ! ieee_write_byte (abfd
,
2292 (bfd_byte
) (s
->index
2293 + IEEE_SECTION_NUMBER_BASE
))
2294 || ! ieee_write_int (abfd
, (bfd_vma
) 1 << s
->alignment_power
))
2298 if (! ieee_write_2bytes (abfd
, ieee_section_size_enum
)
2299 || ! ieee_write_byte (abfd
,
2300 (bfd_byte
) (s
->index
2301 + IEEE_SECTION_NUMBER_BASE
))
2302 || ! ieee_write_int (abfd
, s
->_raw_size
))
2304 if (abfd
->flags
& EXEC_P
)
2306 /* Relocateable sections don't have asl records */
2308 if (! ieee_write_2bytes (abfd
, ieee_section_base_address_enum
)
2309 || ! ieee_write_byte (abfd
,
2312 + IEEE_SECTION_NUMBER_BASE
)))
2313 || ! ieee_write_int (abfd
, s
->lma
))
2324 do_with_relocs (abfd
, s
)
2328 unsigned int number_of_maus_in_address
=
2329 bfd_arch_bits_per_address (abfd
) / bfd_arch_bits_per_byte (abfd
);
2330 unsigned int relocs_to_go
= s
->reloc_count
;
2331 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2332 arelent
**p
= s
->orelocation
;
2333 bfd_size_type current_byte_index
= 0;
2335 qsort (s
->orelocation
,
2337 sizeof (arelent
**),
2340 /* Output the section preheader */
2341 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2342 || ! ieee_write_byte (abfd
,
2343 (bfd_byte
) (s
->index
+ IEEE_SECTION_NUMBER_BASE
))
2344 || ! ieee_write_2bytes (abfd
, ieee_set_current_pc_enum
)
2345 || ! ieee_write_byte (abfd
,
2346 (bfd_byte
) (s
->index
+ IEEE_SECTION_NUMBER_BASE
)))
2349 if ((abfd
->flags
& EXEC_P
) != 0 && relocs_to_go
== 0)
2351 if (! ieee_write_int (abfd
, s
->lma
))
2356 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2360 if (relocs_to_go
== 0)
2362 /* If there aren't any relocations then output the load constant
2363 byte opcode rather than the load with relocation opcode */
2365 while (current_byte_index
< s
->_raw_size
)
2368 unsigned int MAXRUN
= 127;
2370 if (run
> s
->_raw_size
- current_byte_index
)
2372 run
= s
->_raw_size
- current_byte_index
;
2377 if (! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
))
2379 /* Output a stream of bytes */
2380 if (! ieee_write_int (abfd
, run
))
2382 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2385 current_byte_index
+= run
;
2391 if (! ieee_write_byte (abfd
, ieee_load_with_relocation_enum
))
2394 /* Output the data stream as the longest sequence of bytes
2395 possible, allowing for the a reasonable packet size and
2396 relocation stuffs. */
2398 if ((PTR
) stream
== (PTR
) NULL
)
2400 /* Outputting a section without data, fill it up */
2401 stream
= (unsigned char *) bfd_zalloc (abfd
, s
->_raw_size
);
2405 while (current_byte_index
< s
->_raw_size
)
2408 unsigned int MAXRUN
= 127;
2411 run
= (*p
)->address
- current_byte_index
;
2419 if (run
> s
->_raw_size
- current_byte_index
)
2421 run
= s
->_raw_size
- current_byte_index
;
2426 /* Output a stream of bytes */
2427 if (! ieee_write_int (abfd
, run
))
2429 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2432 current_byte_index
+= run
;
2434 /* Output any relocations here */
2435 if (relocs_to_go
&& (*p
) && (*p
)->address
== current_byte_index
)
2438 && (*p
) && (*p
)->address
== current_byte_index
)
2444 if (r
->howto
->pc_relative
)
2446 r
->addend
+= current_byte_index
;
2450 switch (r
->howto
->size
)
2454 ov
= bfd_get_signed_32 (abfd
,
2455 stream
+ current_byte_index
);
2456 current_byte_index
+= 4;
2459 ov
= bfd_get_signed_16 (abfd
,
2460 stream
+ current_byte_index
);
2461 current_byte_index
+= 2;
2464 ov
= bfd_get_signed_8 (abfd
,
2465 stream
+ current_byte_index
);
2466 current_byte_index
++;
2474 ov
&= r
->howto
->src_mask
;
2476 if (r
->howto
->pc_relative
2477 && ! r
->howto
->pcrel_offset
)
2480 if (! ieee_write_byte (abfd
,
2481 ieee_function_either_open_b_enum
))
2486 if (r
->sym_ptr_ptr
!= (asymbol
**) NULL
)
2488 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2490 r
->howto
->pc_relative
,
2491 (unsigned) s
->index
))
2496 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2498 r
->howto
->pc_relative
,
2499 (unsigned) s
->index
))
2503 if (number_of_maus_in_address
2504 != bfd_get_reloc_size (r
->howto
))
2506 bfd_vma rsize
= bfd_get_reloc_size (r
->howto
);
2507 if (! ieee_write_int (abfd
, rsize
))
2510 if (! ieee_write_byte (abfd
,
2511 ieee_function_either_close_b_enum
))
2525 /* If there are no relocations in the output section then we can be
2526 clever about how we write. We block items up into a max of 127
2530 do_as_repeat (abfd
, s
)
2536 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2537 || ! ieee_write_byte (abfd
,
2538 (bfd_byte
) (s
->index
2539 + IEEE_SECTION_NUMBER_BASE
))
2540 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
>> 8)
2541 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
& 0xff)
2542 || ! ieee_write_byte (abfd
,
2543 (bfd_byte
) (s
->index
2544 + IEEE_SECTION_NUMBER_BASE
)))
2547 if ((abfd
->flags
& EXEC_P
) != 0)
2549 if (! ieee_write_int (abfd
, s
->lma
))
2554 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2558 if (! ieee_write_byte (abfd
, ieee_repeat_data_enum
)
2559 || ! ieee_write_int (abfd
, s
->_raw_size
)
2560 || ! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
)
2561 || ! ieee_write_byte (abfd
, 1)
2562 || ! ieee_write_byte (abfd
, 0))
2570 do_without_relocs (abfd
, s
)
2574 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2576 if (stream
== 0 || ((s
->flags
& SEC_LOAD
) == 0))
2578 if (! do_as_repeat (abfd
, s
))
2584 for (i
= 0; i
< s
->_raw_size
; i
++)
2588 if (! do_with_relocs (abfd
, s
))
2593 if (! do_as_repeat (abfd
, s
))
2601 static unsigned char *output_ptr_start
;
2602 static unsigned char *output_ptr
;
2603 static unsigned char *output_ptr_end
;
2604 static unsigned char *input_ptr_start
;
2605 static unsigned char *input_ptr
;
2606 static unsigned char *input_ptr_end
;
2607 static bfd
*input_bfd
;
2608 static bfd
*output_bfd
;
2609 static int output_buffer
;
2612 ieee_mkobject (abfd
)
2617 output_ptr_start
= NULL
;
2619 output_ptr_end
= NULL
;
2620 input_ptr_start
= NULL
;
2622 input_ptr_end
= NULL
;
2626 amt
= sizeof (ieee_data_type
);
2627 abfd
->tdata
.ieee_data
= (ieee_data_type
*) bfd_zalloc (abfd
, amt
);
2628 return abfd
->tdata
.ieee_data
!= NULL
;
2634 bfd_size_type amt
= input_ptr_end
- input_ptr_start
;
2635 /* FIXME: Check return value. I'm not sure whether it needs to read
2636 the entire buffer or not. */
2637 bfd_bread ((PTR
) input_ptr_start
, amt
, input_bfd
);
2638 input_ptr
= input_ptr_start
;
2644 bfd_size_type amt
= output_ptr
- output_ptr_start
;
2645 if (bfd_bwrite ((PTR
) (output_ptr_start
), amt
, output_bfd
) != amt
)
2647 output_ptr
= output_ptr_start
;
2651 #define THIS() ( *input_ptr )
2652 #define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
2653 #define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
2659 if (value
>= 0 && value
<= 127)
2665 unsigned int length
;
2666 /* How many significant bytes ? */
2667 /* FIXME FOR LONGER INTS */
2668 if (value
& 0xff000000)
2672 else if (value
& 0x00ff0000)
2676 else if (value
& 0x0000ff00)
2683 OUT ((int) ieee_number_repeat_start_enum
+ length
);
2702 int length
= THIS ();
2714 #define VAR(x) ((x | 0x80))
2729 value
= (value
<< 8) | THIS ();
2731 value
= (value
<< 8) | THIS ();
2733 value
= (value
<< 8) | THIS ();
2741 value
= (value
<< 8) | THIS ();
2743 value
= (value
<< 8) | THIS ();
2751 value
= (value
<< 8) | THIS ();
2768 /* Not a number, just bug out with the answer */
2769 write_int (*(--tos
));
2785 ieee_data_type
*ieee
;
2788 section_number
= THIS ();
2791 ieee
= IEEE_DATA (input_bfd
);
2792 s
= ieee
->section_table
[section_number
];
2794 if (s
->output_section
)
2795 value
= s
->output_section
->lma
;
2796 value
+= s
->output_offset
;
2803 write_int (*(--tos
));
2811 /* Drop the int in the buffer, and copy a null into the gap, which we
2812 will overwrite later */
2816 struct output_buffer_struct
*buf
;
2818 if (buf
->buffer
== output_buffer
)
2820 /* Still a chance to output the size */
2821 int value
= output_ptr
- buf
->ptrp
+ 3;
2822 buf
->ptrp
[0] = value
>> 24;
2823 buf
->ptrp
[1] = value
>> 16;
2824 buf
->ptrp
[2] = value
>> 8;
2825 buf
->ptrp
[3] = value
>> 0;
2831 struct output_buffer_struct
*buf
;
2857 buf
->ptrp
= output_ptr
;
2858 buf
->buffer
= output_buffer
;
2898 #define ID copy_id()
2899 #define INT copy_int()
2900 #define EXP copy_expression()
2901 #define INTn(q) copy_int()
2902 #define EXPn(q) copy_expression()
2941 EXPn (instruction address
);
2975 EXPn (external function
);
2985 INTn (locked
register);
3008 /* Attribute record */
3077 /* Unique typedefs for module */
3078 /* GLobal typedefs */
3079 /* High level module scope beginning */
3081 struct output_buffer_struct ob
;
3096 /* Global function */
3098 struct output_buffer_struct ob
;
3112 EXPn (size of block
);
3118 /* File name for source line numbers */
3120 struct output_buffer_struct ob
;
3140 /* Local function */
3142 struct output_buffer_struct ob
;
3160 /* Assembler module scope beginning -*/
3162 struct output_buffer_struct ob
;
3188 struct output_buffer_struct ob
;
3195 INTn (section index
);
3203 EXPn (Size in Maus
);
3258 moves all the debug information from the source bfd to the output
3259 bfd, and relocates any expressions it finds
3263 relocate_debug (output
, input
)
3264 bfd
*output ATTRIBUTE_UNUSED
;
3269 unsigned char input_buffer
[IBS
];
3271 input_ptr_start
= input_ptr
= input_buffer
;
3272 input_ptr_end
= input_buffer
+ IBS
;
3274 /* FIXME: Check return value. I'm not sure whether it needs to read
3275 the entire buffer or not. */
3276 bfd_bread ((PTR
) input_ptr_start
, (bfd_size_type
) IBS
, input
);
3280 /* Gather together all the debug information from each input BFD into
3281 one place, relocating it and emitting it as we go. */
3284 ieee_write_debug_part (abfd
)
3287 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3288 bfd_chain_type
*chain
= ieee
->chain_root
;
3289 unsigned char obuff
[OBS
];
3290 boolean some_debug
= false;
3291 file_ptr here
= bfd_tell (abfd
);
3293 output_ptr_start
= output_ptr
= obuff
;
3294 output_ptr_end
= obuff
+ OBS
;
3298 if (chain
== (bfd_chain_type
*) NULL
)
3302 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
3303 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3307 ieee
->w
.r
.debug_information_part
= 0;
3311 ieee
->w
.r
.debug_information_part
= here
;
3312 if (bfd_bwrite (s
->contents
, s
->_raw_size
, abfd
) != s
->_raw_size
)
3317 while (chain
!= (bfd_chain_type
*) NULL
)
3319 bfd
*entry
= chain
->this;
3320 ieee_data_type
*entry_ieee
= IEEE_DATA (entry
);
3321 if (entry_ieee
->w
.r
.debug_information_part
)
3323 if (bfd_seek (entry
, entry_ieee
->w
.r
.debug_information_part
,
3326 relocate_debug (abfd
, entry
);
3329 chain
= chain
->next
;
3333 ieee
->w
.r
.debug_information_part
= here
;
3337 ieee
->w
.r
.debug_information_part
= 0;
3346 /* Write the data in an ieee way. */
3349 ieee_write_data_part (abfd
)
3353 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3354 ieee
->w
.r
.data_part
= bfd_tell (abfd
);
3355 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3357 /* Skip sections that have no loadable contents (.bss,
3359 if ((s
->flags
& SEC_LOAD
) == 0)
3362 /* Sort the reloc records so we can insert them in the correct
3364 if (s
->reloc_count
!= 0)
3366 if (! do_with_relocs (abfd
, s
))
3371 if (! do_without_relocs (abfd
, s
))
3381 init_for_output (abfd
)
3385 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3387 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3389 if (s
->_raw_size
!= 0)
3391 bfd_size_type size
= s
->_raw_size
;
3392 ieee_per_section (s
)->data
= (bfd_byte
*) (bfd_alloc (abfd
, size
));
3393 if (!ieee_per_section (s
)->data
)
3400 /** exec and core file sections */
3402 /* set section contents is complicated with IEEE since the format is
3403 * not a byte image, but a record stream.
3406 ieee_set_section_contents (abfd
, section
, location
, offset
, count
)
3411 bfd_size_type count
;
3413 if ((section
->flags
& SEC_DEBUGGING
) != 0)
3415 if (section
->contents
== NULL
)
3417 bfd_size_type size
= section
->_raw_size
;
3418 section
->contents
= (unsigned char *) bfd_alloc (abfd
, size
);
3419 if (section
->contents
== NULL
)
3422 /* bfd_set_section_contents has already checked that everything
3424 memcpy (section
->contents
+ offset
, location
, (size_t) count
);
3428 if (ieee_per_section (section
)->data
== (bfd_byte
*) NULL
)
3430 if (!init_for_output (abfd
))
3433 memcpy ((PTR
) (ieee_per_section (section
)->data
+ offset
),
3435 (unsigned int) count
);
3439 /* Write the external symbols of a file. IEEE considers two sorts of
3440 external symbols, public, and referenced. It uses to internal
3441 forms to index them as well. When we write them out we turn their
3442 symbol values into indexes from the right base. */
3445 ieee_write_external_part (abfd
)
3449 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3451 unsigned int reference_index
= IEEE_REFERENCE_BASE
;
3452 unsigned int public_index
= IEEE_PUBLIC_BASE
+ 2;
3453 file_ptr here
= bfd_tell (abfd
);
3454 boolean hadone
= false;
3455 if (abfd
->outsymbols
!= (asymbol
**) NULL
)
3458 for (q
= abfd
->outsymbols
; *q
!= (asymbol
*) NULL
; q
++)
3461 if (bfd_is_und_section (p
->section
))
3463 /* This must be a symbol reference .. */
3464 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3465 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3466 || ! ieee_write_id (abfd
, p
->name
))
3468 p
->value
= reference_index
;
3472 else if (bfd_is_com_section (p
->section
))
3474 /* This is a weak reference */
3475 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3476 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3477 || ! ieee_write_id (abfd
, p
->name
)
3478 || ! ieee_write_byte (abfd
,
3479 ieee_weak_external_reference_enum
)
3480 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3481 || ! ieee_write_int (abfd
, p
->value
))
3483 p
->value
= reference_index
;
3487 else if (p
->flags
& BSF_GLOBAL
)
3489 /* This must be a symbol definition */
3491 if (! ieee_write_byte (abfd
, ieee_external_symbol_enum
)
3492 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3493 || ! ieee_write_id (abfd
, p
->name
)
3494 || ! ieee_write_2bytes (abfd
, ieee_attribute_record_enum
)
3495 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3496 || ! ieee_write_byte (abfd
, 15) /* instruction address */
3497 || ! ieee_write_byte (abfd
, 19) /* static symbol */
3498 || ! ieee_write_byte (abfd
, 1)) /* one of them */
3501 /* Write out the value */
3502 if (! ieee_write_2bytes (abfd
, ieee_value_record_enum
)
3503 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
))
3505 if (! bfd_is_abs_section (p
->section
))
3507 if (abfd
->flags
& EXEC_P
)
3509 /* If fully linked, then output all symbols
3511 if (! (ieee_write_int
3514 + p
->section
->output_offset
3515 + p
->section
->output_section
->vma
))))
3520 if (! (ieee_write_expression
3522 p
->value
+ p
->section
->output_offset
,
3523 p
->section
->output_section
->symbol
,
3530 if (! ieee_write_expression (abfd
,
3532 bfd_abs_section_ptr
->symbol
,
3536 p
->value
= public_index
;
3542 /* This can happen - when there are gaps in the symbols read */
3543 /* from an input ieee file */
3548 ieee
->w
.r
.external_part
= here
;
3554 static const unsigned char exten
[] =
3557 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */
3558 0xf1, 0xce, 0x20, 0x00, 39, 2,/* keep symbol in original case */
3559 0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */
3562 static const unsigned char envi
[] =
3566 /* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
3569 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
3571 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
3572 /* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
3576 ieee_write_me_part (abfd
)
3579 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3580 ieee
->w
.r
.trailer_part
= bfd_tell (abfd
);
3581 if (abfd
->start_address
)
3583 if (! ieee_write_2bytes (abfd
, ieee_value_starting_address_enum
)
3584 || ! ieee_write_byte (abfd
, ieee_function_either_open_b_enum
)
3585 || ! ieee_write_int (abfd
, abfd
->start_address
)
3586 || ! ieee_write_byte (abfd
, ieee_function_either_close_b_enum
))
3589 ieee
->w
.r
.me_record
= bfd_tell (abfd
);
3590 if (! ieee_write_byte (abfd
, ieee_module_end_enum
))
3595 /* Write out the IEEE processor ID. */
3598 ieee_write_processor (abfd
)
3601 const bfd_arch_info_type
*arch
;
3603 arch
= bfd_get_arch_info (abfd
);
3607 if (! ieee_write_id (abfd
, bfd_printable_name (abfd
)))
3612 if (! ieee_write_id (abfd
, "29000"))
3616 case bfd_arch_h8300
:
3617 if (! ieee_write_id (abfd
, "H8/300"))
3621 case bfd_arch_h8500
:
3622 if (! ieee_write_id (abfd
, "H8/500"))
3630 case bfd_mach_i960_core
:
3631 case bfd_mach_i960_ka_sa
:
3632 if (! ieee_write_id (abfd
, "80960KA"))
3636 case bfd_mach_i960_kb_sb
:
3637 if (! ieee_write_id (abfd
, "80960KB"))
3641 case bfd_mach_i960_ca
:
3642 if (! ieee_write_id (abfd
, "80960CA"))
3646 case bfd_mach_i960_mc
:
3647 case bfd_mach_i960_xa
:
3648 if (! ieee_write_id (abfd
, "80960MC"))
3660 default: id
= "68020"; break;
3661 case bfd_mach_m68000
: id
= "68000"; break;
3662 case bfd_mach_m68008
: id
= "68008"; break;
3663 case bfd_mach_m68010
: id
= "68010"; break;
3664 case bfd_mach_m68020
: id
= "68020"; break;
3665 case bfd_mach_m68030
: id
= "68030"; break;
3666 case bfd_mach_m68040
: id
= "68040"; break;
3667 case bfd_mach_m68060
: id
= "68060"; break;
3668 case bfd_mach_cpu32
: id
= "cpu32"; break;
3669 case bfd_mach_mcf5200
:id
= "5200"; break;
3670 case bfd_mach_mcf5206e
:id
= "5206e"; break;
3671 case bfd_mach_mcf5307
:id
= "5307"; break;
3672 case bfd_mach_mcf5407
:id
= "5407"; break;
3675 if (! ieee_write_id (abfd
, id
))
3685 ieee_write_object_contents (abfd
)
3688 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3692 /* Fast forward over the header area */
3693 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
3696 if (! ieee_write_byte (abfd
, ieee_module_beginning_enum
)
3697 || ! ieee_write_processor (abfd
)
3698 || ! ieee_write_id (abfd
, abfd
->filename
))
3701 /* Fast forward over the variable bits */
3702 if (! ieee_write_byte (abfd
, ieee_address_descriptor_enum
))
3706 if (! ieee_write_byte (abfd
, (bfd_byte
) (bfd_arch_bits_per_byte (abfd
))))
3708 /* MAU's per address */
3709 if (! ieee_write_byte (abfd
,
3710 (bfd_byte
) (bfd_arch_bits_per_address (abfd
)
3711 / bfd_arch_bits_per_byte (abfd
))))
3714 old
= bfd_tell (abfd
);
3715 if (bfd_seek (abfd
, (file_ptr
) (8 * N_W_VARIABLES
), SEEK_CUR
) != 0)
3718 ieee
->w
.r
.extension_record
= bfd_tell (abfd
);
3719 if (bfd_bwrite ((char *) exten
, (bfd_size_type
) sizeof (exten
), abfd
)
3722 if (abfd
->flags
& EXEC_P
)
3724 if (! ieee_write_byte (abfd
, 0x1)) /* Absolute */
3729 if (! ieee_write_byte (abfd
, 0x2)) /* Relocateable */
3733 ieee
->w
.r
.environmental_record
= bfd_tell (abfd
);
3734 if (bfd_bwrite ((char *) envi
, (bfd_size_type
) sizeof (envi
), abfd
)
3738 /* The HP emulator database requires a timestamp in the file. */
3744 t
= (struct tm
*) localtime (&now
);
3745 if (! ieee_write_2bytes (abfd
, (int) ieee_atn_record_enum
)
3746 || ! ieee_write_byte (abfd
, 0x21)
3747 || ! ieee_write_byte (abfd
, 0)
3748 || ! ieee_write_byte (abfd
, 50)
3749 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_year
+ 1900))
3750 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_mon
+ 1))
3751 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_mday
)
3752 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_hour
)
3753 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_min
)
3754 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_sec
))
3762 if (! ieee_write_section_part (abfd
))
3764 /* First write the symbols. This changes their values into table
3765 indeces so we cant use it after this point. */
3766 if (! ieee_write_external_part (abfd
))
3769 /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
3771 /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
3774 /* Write any debugs we have been told about. */
3775 if (! ieee_write_debug_part (abfd
))
3778 /* Can only write the data once the symbols have been written, since
3779 the data contains relocation information which points to the
3781 if (! ieee_write_data_part (abfd
))
3784 /* At the end we put the end! */
3785 if (! ieee_write_me_part (abfd
))
3788 /* Generate the header */
3789 if (bfd_seek (abfd
, old
, SEEK_SET
) != 0)
3792 for (i
= 0; i
< N_W_VARIABLES
; i
++)
3794 if (! ieee_write_2bytes (abfd
, ieee_assign_value_to_variable_enum
)
3795 || ! ieee_write_byte (abfd
, (bfd_byte
) i
)
3796 || ! ieee_write_int5_out (abfd
, (bfd_vma
) ieee
->w
.offset
[i
]))
3803 /* Native-level interface to symbols. */
3805 /* We read the symbols into a buffer, which is discarded when this
3806 function exits. We read the strings into a buffer large enough to
3807 hold them all plus all the cached symbol entries. */
3810 ieee_make_empty_symbol (abfd
)
3813 bfd_size_type amt
= sizeof (ieee_symbol_type
);
3814 ieee_symbol_type
*new = (ieee_symbol_type
*) bfd_zalloc (abfd
, amt
);
3817 new->symbol
.the_bfd
= abfd
;
3818 return &new->symbol
;
3822 ieee_openr_next_archived_file (arch
, prev
)
3826 ieee_ar_data_type
*ar
= IEEE_AR_DATA (arch
);
3827 /* take the next one from the arch state, or reset */
3828 if (prev
== (bfd
*) NULL
)
3830 /* Reset the index - the first two entries are bogus*/
3831 ar
->element_index
= 2;
3835 ieee_ar_obstack_type
*p
= ar
->elements
+ ar
->element_index
;
3836 ar
->element_index
++;
3837 if (ar
->element_index
<= ar
->element_count
)
3839 if (p
->file_offset
!= (file_ptr
) 0)
3841 if (p
->abfd
== (bfd
*) NULL
)
3843 p
->abfd
= _bfd_create_empty_archive_element_shell (arch
);
3844 p
->abfd
->origin
= p
->file_offset
;
3851 bfd_set_error (bfd_error_no_more_archived_files
);
3852 return (bfd
*) NULL
;
3859 ieee_find_nearest_line (abfd
, section
, symbols
, offset
, filename_ptr
,
3860 functionname_ptr
, line_ptr
)
3861 bfd
*abfd ATTRIBUTE_UNUSED
;
3862 asection
*section ATTRIBUTE_UNUSED
;
3863 asymbol
**symbols ATTRIBUTE_UNUSED
;
3864 bfd_vma offset ATTRIBUTE_UNUSED
;
3865 const char **filename_ptr ATTRIBUTE_UNUSED
;
3866 const char **functionname_ptr ATTRIBUTE_UNUSED
;
3867 unsigned int *line_ptr ATTRIBUTE_UNUSED
;
3873 ieee_generic_stat_arch_elt (abfd
, buf
)
3877 ieee_ar_data_type
*ar
= (ieee_ar_data_type
*) NULL
;
3878 ieee_data_type
*ieee
;
3880 if (abfd
->my_archive
!= NULL
)
3881 ar
= abfd
->my_archive
->tdata
.ieee_ar_data
;
3882 if (ar
== (ieee_ar_data_type
*) NULL
)
3884 bfd_set_error (bfd_error_invalid_operation
);
3888 if (IEEE_DATA (abfd
) == NULL
)
3890 if (ieee_object_p (abfd
) == NULL
)
3892 bfd_set_error (bfd_error_wrong_format
);
3897 ieee
= IEEE_DATA (abfd
);
3899 buf
->st_size
= ieee
->w
.r
.me_record
+ 1;
3900 buf
->st_mode
= 0644;
3905 ieee_sizeof_headers (abfd
, x
)
3906 bfd
*abfd ATTRIBUTE_UNUSED
;
3907 boolean x ATTRIBUTE_UNUSED
;
3913 /* The debug info routines are never used. */
3917 ieee_bfd_debug_info_start (abfd
)
3924 ieee_bfd_debug_info_end (abfd
)
3931 /* Add this section to the list of sections we have debug info for, to
3932 be ready to output it at close time
3935 ieee_bfd_debug_info_accumulate (abfd
, section
)
3939 ieee_data_type
*ieee
= IEEE_DATA (section
->owner
);
3940 ieee_data_type
*output_ieee
= IEEE_DATA (abfd
);
3941 /* can only accumulate data from other ieee bfds */
3942 if (section
->owner
->xvec
!= abfd
->xvec
)
3944 /* Only bother once per bfd */
3945 if (ieee
->done_debug
)
3947 ieee
->done_debug
= true;
3949 /* Don't bother if there is no debug info */
3950 if (ieee
->w
.r
.debug_information_part
== 0)
3956 bfd_size_type amt
= sizeof (bfd_chain_type
);
3957 bfd_chain_type
*n
= (bfd_chain_type
*) bfd_alloc (abfd
, amt
);
3959 abort (); /* FIXME */
3960 n
->this = section
->owner
;
3961 n
->next
= (bfd_chain_type
*) NULL
;
3963 if (output_ieee
->chain_head
)
3965 output_ieee
->chain_head
->next
= n
;
3969 output_ieee
->chain_root
= n
;
3972 output_ieee
->chain_head
= n
;
3978 #define ieee_close_and_cleanup _bfd_generic_close_and_cleanup
3979 #define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
3981 #define ieee_slurp_armap bfd_true
3982 #define ieee_slurp_extended_name_table bfd_true
3983 #define ieee_construct_extended_name_table \
3984 ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
3986 #define ieee_truncate_arname bfd_dont_truncate_arname
3987 #define ieee_write_armap \
3989 PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
3991 #define ieee_read_ar_hdr bfd_nullvoidptr
3992 #define ieee_update_armap_timestamp bfd_true
3993 #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
3995 #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
3996 #define ieee_get_lineno _bfd_nosymbols_get_lineno
3997 #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
3998 #define ieee_read_minisymbols _bfd_generic_read_minisymbols
3999 #define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
4001 #define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
4003 #define ieee_set_arch_mach _bfd_generic_set_arch_mach
4005 #define ieee_get_section_contents_in_window \
4006 _bfd_generic_get_section_contents_in_window
4007 #define ieee_bfd_get_relocated_section_contents \
4008 bfd_generic_get_relocated_section_contents
4009 #define ieee_bfd_relax_section bfd_generic_relax_section
4010 #define ieee_bfd_gc_sections bfd_generic_gc_sections
4011 #define ieee_bfd_merge_sections bfd_generic_merge_sections
4012 #define ieee_bfd_discard_group bfd_generic_discard_group
4013 #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
4014 #define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
4015 #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
4016 #define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
4017 #define ieee_bfd_final_link _bfd_generic_final_link
4018 #define ieee_bfd_link_split_section _bfd_generic_link_split_section
4021 const bfd_target ieee_vec
=
4024 bfd_target_ieee_flavour
,
4025 BFD_ENDIAN_UNKNOWN
, /* target byte order */
4026 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
4027 (HAS_RELOC
| EXEC_P
| /* object flags */
4028 HAS_LINENO
| HAS_DEBUG
|
4029 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
4030 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
4031 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
4032 '_', /* leading underscore */
4033 ' ', /* ar_pad_char */
4034 16, /* ar_max_namelen */
4035 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4036 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4037 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
4038 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4039 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4040 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
4043 ieee_object_p
, /* bfd_check_format */
4050 _bfd_generic_mkarchive
,
4055 ieee_write_object_contents
,
4056 _bfd_write_archive_contents
,
4060 /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
4061 ieee_get_section_contents, ieee_get_section_contents_in_window */
4062 BFD_JUMP_TABLE_GENERIC (ieee
),
4064 BFD_JUMP_TABLE_COPY (_bfd_generic
),
4065 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
4067 /* ieee_slurp_armap, ieee_slurp_extended_name_table,
4068 ieee_construct_extended_name_table, ieee_truncate_arname,
4069 ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
4070 ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
4071 ieee_update_armap_timestamp */
4072 BFD_JUMP_TABLE_ARCHIVE (ieee
),
4074 /* ieee_get_symtab_upper_bound, ieee_get_symtab, ieee_make_empty_symbol,
4075 ieee_print_symbol, ieee_get_symbol_info, ieee_bfd_is_local_label_name,
4076 ieee_get_lineno, ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
4077 ieee_read_minisymbols, ieee_minisymbol_to_symbol */
4078 BFD_JUMP_TABLE_SYMBOLS (ieee
),
4080 /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
4081 ieee_bfd_reloc_type_lookup */
4082 BFD_JUMP_TABLE_RELOCS (ieee
),
4084 /* ieee_set_arch_mach, ieee_set_section_contents */
4085 BFD_JUMP_TABLE_WRITE (ieee
),
4087 /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
4088 ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
4089 _bfd_generic_link_hash_table_free,
4090 ieee_bfd_link_add_symbols, ieee_bfd_final_link,
4091 ieee_bfd_link_split_section, ieee_bfd_gc_sections,
4092 ieee_bfd_merge_sections */
4093 BFD_JUMP_TABLE_LINK (ieee
),
4095 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),