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
) == true);
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
) == false)
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
== false)
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
== false)
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
)
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_release (abfd
, ieee
);
1534 abfd
->tdata
.ieee_ar_data
= save
;
1535 bfd_set_error (bfd_error_wrong_format
);
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
) == false)
1670 if (parse_int (&(ieee
->h
), &ieee
->ad
.number_of_maus_in_address
) == false)
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 (void) 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
) == true)
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
== true)
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_alloc (abfd
, s
->_raw_size
));
2404 memset ((PTR
) stream
, 0, (size_t) s
->_raw_size
);
2406 while (current_byte_index
< s
->_raw_size
)
2409 unsigned int MAXRUN
= 127;
2412 run
= (*p
)->address
- current_byte_index
;
2420 if (run
> s
->_raw_size
- current_byte_index
)
2422 run
= s
->_raw_size
- current_byte_index
;
2427 /* Output a stream of bytes */
2428 if (! ieee_write_int (abfd
, run
))
2430 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2433 current_byte_index
+= run
;
2435 /* Output any relocations here */
2436 if (relocs_to_go
&& (*p
) && (*p
)->address
== current_byte_index
)
2439 && (*p
) && (*p
)->address
== current_byte_index
)
2445 if (r
->howto
->pc_relative
)
2447 r
->addend
+= current_byte_index
;
2451 switch (r
->howto
->size
)
2455 ov
= bfd_get_signed_32 (abfd
,
2456 stream
+ current_byte_index
);
2457 current_byte_index
+= 4;
2460 ov
= bfd_get_signed_16 (abfd
,
2461 stream
+ current_byte_index
);
2462 current_byte_index
+= 2;
2465 ov
= bfd_get_signed_8 (abfd
,
2466 stream
+ current_byte_index
);
2467 current_byte_index
++;
2475 ov
&= r
->howto
->src_mask
;
2477 if (r
->howto
->pc_relative
2478 && ! r
->howto
->pcrel_offset
)
2481 if (! ieee_write_byte (abfd
,
2482 ieee_function_either_open_b_enum
))
2487 if (r
->sym_ptr_ptr
!= (asymbol
**) NULL
)
2489 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2491 r
->howto
->pc_relative
,
2492 (unsigned) s
->index
))
2497 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2499 r
->howto
->pc_relative
,
2500 (unsigned) s
->index
))
2504 if (number_of_maus_in_address
2505 != bfd_get_reloc_size (r
->howto
))
2507 bfd_vma rsize
= bfd_get_reloc_size (r
->howto
);
2508 if (! ieee_write_int (abfd
, rsize
))
2511 if (! ieee_write_byte (abfd
,
2512 ieee_function_either_close_b_enum
))
2526 /* If there are no relocations in the output section then we can be
2527 clever about how we write. We block items up into a max of 127
2531 do_as_repeat (abfd
, s
)
2537 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2538 || ! ieee_write_byte (abfd
,
2539 (bfd_byte
) (s
->index
2540 + IEEE_SECTION_NUMBER_BASE
))
2541 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
>> 8)
2542 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
& 0xff)
2543 || ! ieee_write_byte (abfd
,
2544 (bfd_byte
) (s
->index
2545 + IEEE_SECTION_NUMBER_BASE
)))
2548 if ((abfd
->flags
& EXEC_P
) != 0)
2550 if (! ieee_write_int (abfd
, s
->lma
))
2555 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2559 if (! ieee_write_byte (abfd
, ieee_repeat_data_enum
)
2560 || ! ieee_write_int (abfd
, s
->_raw_size
)
2561 || ! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
)
2562 || ! ieee_write_byte (abfd
, 1)
2563 || ! ieee_write_byte (abfd
, 0))
2571 do_without_relocs (abfd
, s
)
2575 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2577 if (stream
== 0 || ((s
->flags
& SEC_LOAD
) == 0))
2579 if (! do_as_repeat (abfd
, s
))
2585 for (i
= 0; i
< s
->_raw_size
; i
++)
2589 if (! do_with_relocs (abfd
, s
))
2594 if (! do_as_repeat (abfd
, s
))
2602 static unsigned char *output_ptr_start
;
2603 static unsigned char *output_ptr
;
2604 static unsigned char *output_ptr_end
;
2605 static unsigned char *input_ptr_start
;
2606 static unsigned char *input_ptr
;
2607 static unsigned char *input_ptr_end
;
2608 static bfd
*input_bfd
;
2609 static bfd
*output_bfd
;
2610 static int output_buffer
;
2613 ieee_mkobject (abfd
)
2618 output_ptr_start
= NULL
;
2620 output_ptr_end
= NULL
;
2621 input_ptr_start
= NULL
;
2623 input_ptr_end
= NULL
;
2627 amt
= sizeof (ieee_data_type
);
2628 abfd
->tdata
.ieee_data
= (ieee_data_type
*) bfd_zalloc (abfd
, amt
);
2629 return abfd
->tdata
.ieee_data
? true : false;
2635 bfd_size_type amt
= input_ptr_end
- input_ptr_start
;
2636 /* FIXME: Check return value. I'm not sure whether it needs to read
2637 the entire buffer or not. */
2638 bfd_bread ((PTR
) input_ptr_start
, amt
, input_bfd
);
2639 input_ptr
= input_ptr_start
;
2645 bfd_size_type amt
= output_ptr
- output_ptr_start
;
2646 if (bfd_bwrite ((PTR
) (output_ptr_start
), amt
, output_bfd
) != amt
)
2648 output_ptr
= output_ptr_start
;
2652 #define THIS() ( *input_ptr )
2653 #define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
2654 #define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
2660 if (value
>= 0 && value
<= 127)
2666 unsigned int length
;
2667 /* How many significant bytes ? */
2668 /* FIXME FOR LONGER INTS */
2669 if (value
& 0xff000000)
2673 else if (value
& 0x00ff0000)
2677 else if (value
& 0x0000ff00)
2684 OUT ((int) ieee_number_repeat_start_enum
+ length
);
2703 int length
= THIS ();
2715 #define VAR(x) ((x | 0x80))
2730 value
= (value
<< 8) | THIS ();
2732 value
= (value
<< 8) | THIS ();
2734 value
= (value
<< 8) | THIS ();
2742 value
= (value
<< 8) | THIS ();
2744 value
= (value
<< 8) | THIS ();
2752 value
= (value
<< 8) | THIS ();
2769 /* Not a number, just bug out with the answer */
2770 write_int (*(--tos
));
2786 ieee_data_type
*ieee
;
2789 section_number
= THIS ();
2792 ieee
= IEEE_DATA (input_bfd
);
2793 s
= ieee
->section_table
[section_number
];
2795 if (s
->output_section
)
2796 value
= s
->output_section
->lma
;
2797 value
+= s
->output_offset
;
2804 write_int (*(--tos
));
2812 /* Drop the int in the buffer, and copy a null into the gap, which we
2813 will overwrite later */
2817 struct output_buffer_struct
*buf
;
2819 if (buf
->buffer
== output_buffer
)
2821 /* Still a chance to output the size */
2822 int value
= output_ptr
- buf
->ptrp
+ 3;
2823 buf
->ptrp
[0] = value
>> 24;
2824 buf
->ptrp
[1] = value
>> 16;
2825 buf
->ptrp
[2] = value
>> 8;
2826 buf
->ptrp
[3] = value
>> 0;
2832 struct output_buffer_struct
*buf
;
2858 buf
->ptrp
= output_ptr
;
2859 buf
->buffer
= output_buffer
;
2899 #define ID copy_id()
2900 #define INT copy_int()
2901 #define EXP copy_expression()
2902 #define INTn(q) copy_int()
2903 #define EXPn(q) copy_expression()
2942 EXPn (instruction address
);
2976 EXPn (external function
);
2986 INTn (locked
register);
3009 /* Attribute record */
3078 /* Unique typedefs for module */
3079 /* GLobal typedefs */
3080 /* High level module scope beginning */
3082 struct output_buffer_struct ob
;
3097 /* Global function */
3099 struct output_buffer_struct ob
;
3113 EXPn (size of block
);
3119 /* File name for source line numbers */
3121 struct output_buffer_struct ob
;
3141 /* Local function */
3143 struct output_buffer_struct ob
;
3161 /* Assembler module scope beginning -*/
3163 struct output_buffer_struct ob
;
3189 struct output_buffer_struct ob
;
3196 INTn (section index
);
3204 EXPn (Size in Maus
);
3259 moves all the debug information from the source bfd to the output
3260 bfd, and relocates any expressions it finds
3264 relocate_debug (output
, input
)
3265 bfd
*output ATTRIBUTE_UNUSED
;
3270 unsigned char input_buffer
[IBS
];
3272 input_ptr_start
= input_ptr
= input_buffer
;
3273 input_ptr_end
= input_buffer
+ IBS
;
3275 /* FIXME: Check return value. I'm not sure whether it needs to read
3276 the entire buffer or not. */
3277 bfd_bread ((PTR
) input_ptr_start
, (bfd_size_type
) IBS
, input
);
3281 /* Gather together all the debug information from each input BFD into
3282 one place, relocating it and emitting it as we go. */
3285 ieee_write_debug_part (abfd
)
3288 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3289 bfd_chain_type
*chain
= ieee
->chain_root
;
3290 unsigned char obuff
[OBS
];
3291 boolean some_debug
= false;
3292 file_ptr here
= bfd_tell (abfd
);
3294 output_ptr_start
= output_ptr
= obuff
;
3295 output_ptr_end
= obuff
+ OBS
;
3299 if (chain
== (bfd_chain_type
*) NULL
)
3303 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
3304 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3308 ieee
->w
.r
.debug_information_part
= 0;
3312 ieee
->w
.r
.debug_information_part
= here
;
3313 if (bfd_bwrite (s
->contents
, s
->_raw_size
, abfd
) != s
->_raw_size
)
3318 while (chain
!= (bfd_chain_type
*) NULL
)
3320 bfd
*entry
= chain
->this;
3321 ieee_data_type
*entry_ieee
= IEEE_DATA (entry
);
3322 if (entry_ieee
->w
.r
.debug_information_part
)
3324 if (bfd_seek (entry
, entry_ieee
->w
.r
.debug_information_part
,
3327 relocate_debug (abfd
, entry
);
3330 chain
= chain
->next
;
3334 ieee
->w
.r
.debug_information_part
= here
;
3338 ieee
->w
.r
.debug_information_part
= 0;
3347 /* Write the data in an ieee way. */
3350 ieee_write_data_part (abfd
)
3354 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3355 ieee
->w
.r
.data_part
= bfd_tell (abfd
);
3356 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3358 /* Skip sections that have no loadable contents (.bss,
3360 if ((s
->flags
& SEC_LOAD
) == 0)
3363 /* Sort the reloc records so we can insert them in the correct
3365 if (s
->reloc_count
!= 0)
3367 if (! do_with_relocs (abfd
, s
))
3372 if (! do_without_relocs (abfd
, s
))
3382 init_for_output (abfd
)
3386 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3388 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3390 if (s
->_raw_size
!= 0)
3392 bfd_size_type size
= s
->_raw_size
;
3393 ieee_per_section (s
)->data
= (bfd_byte
*) (bfd_alloc (abfd
, size
));
3394 if (!ieee_per_section (s
)->data
)
3401 /** exec and core file sections */
3403 /* set section contents is complicated with IEEE since the format is
3404 * not a byte image, but a record stream.
3407 ieee_set_section_contents (abfd
, section
, location
, offset
, count
)
3412 bfd_size_type count
;
3414 if ((section
->flags
& SEC_DEBUGGING
) != 0)
3416 if (section
->contents
== NULL
)
3418 bfd_size_type size
= section
->_raw_size
;
3419 section
->contents
= (unsigned char *) bfd_alloc (abfd
, size
);
3420 if (section
->contents
== NULL
)
3423 /* bfd_set_section_contents has already checked that everything
3425 memcpy (section
->contents
+ offset
, location
, (size_t) count
);
3429 if (ieee_per_section (section
)->data
== (bfd_byte
*) NULL
)
3431 if (!init_for_output (abfd
))
3434 memcpy ((PTR
) (ieee_per_section (section
)->data
+ offset
),
3436 (unsigned int) count
);
3440 /* Write the external symbols of a file. IEEE considers two sorts of
3441 external symbols, public, and referenced. It uses to internal
3442 forms to index them as well. When we write them out we turn their
3443 symbol values into indexes from the right base. */
3446 ieee_write_external_part (abfd
)
3450 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3452 unsigned int reference_index
= IEEE_REFERENCE_BASE
;
3453 unsigned int public_index
= IEEE_PUBLIC_BASE
+ 2;
3454 file_ptr here
= bfd_tell (abfd
);
3455 boolean hadone
= false;
3456 if (abfd
->outsymbols
!= (asymbol
**) NULL
)
3459 for (q
= abfd
->outsymbols
; *q
!= (asymbol
*) NULL
; q
++)
3462 if (bfd_is_und_section (p
->section
))
3464 /* This must be a symbol reference .. */
3465 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3466 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3467 || ! ieee_write_id (abfd
, p
->name
))
3469 p
->value
= reference_index
;
3473 else if (bfd_is_com_section (p
->section
))
3475 /* This is a weak reference */
3476 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3477 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3478 || ! ieee_write_id (abfd
, p
->name
)
3479 || ! ieee_write_byte (abfd
,
3480 ieee_weak_external_reference_enum
)
3481 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3482 || ! ieee_write_int (abfd
, p
->value
))
3484 p
->value
= reference_index
;
3488 else if (p
->flags
& BSF_GLOBAL
)
3490 /* This must be a symbol definition */
3492 if (! ieee_write_byte (abfd
, ieee_external_symbol_enum
)
3493 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3494 || ! ieee_write_id (abfd
, p
->name
)
3495 || ! ieee_write_2bytes (abfd
, ieee_attribute_record_enum
)
3496 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3497 || ! ieee_write_byte (abfd
, 15) /* instruction address */
3498 || ! ieee_write_byte (abfd
, 19) /* static symbol */
3499 || ! ieee_write_byte (abfd
, 1)) /* one of them */
3502 /* Write out the value */
3503 if (! ieee_write_2bytes (abfd
, ieee_value_record_enum
)
3504 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
))
3506 if (! bfd_is_abs_section (p
->section
))
3508 if (abfd
->flags
& EXEC_P
)
3510 /* If fully linked, then output all symbols
3512 if (! (ieee_write_int
3515 + p
->section
->output_offset
3516 + p
->section
->output_section
->vma
))))
3521 if (! (ieee_write_expression
3523 p
->value
+ p
->section
->output_offset
,
3524 p
->section
->output_section
->symbol
,
3531 if (! ieee_write_expression (abfd
,
3533 bfd_abs_section_ptr
->symbol
,
3537 p
->value
= public_index
;
3543 /* This can happen - when there are gaps in the symbols read */
3544 /* from an input ieee file */
3549 ieee
->w
.r
.external_part
= here
;
3555 static const unsigned char exten
[] =
3558 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */
3559 0xf1, 0xce, 0x20, 0x00, 39, 2,/* keep symbol in original case */
3560 0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */
3563 static const unsigned char envi
[] =
3567 /* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
3570 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
3572 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
3573 /* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
3577 ieee_write_me_part (abfd
)
3580 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3581 ieee
->w
.r
.trailer_part
= bfd_tell (abfd
);
3582 if (abfd
->start_address
)
3584 if (! ieee_write_2bytes (abfd
, ieee_value_starting_address_enum
)
3585 || ! ieee_write_byte (abfd
, ieee_function_either_open_b_enum
)
3586 || ! ieee_write_int (abfd
, abfd
->start_address
)
3587 || ! ieee_write_byte (abfd
, ieee_function_either_close_b_enum
))
3590 ieee
->w
.r
.me_record
= bfd_tell (abfd
);
3591 if (! ieee_write_byte (abfd
, ieee_module_end_enum
))
3596 /* Write out the IEEE processor ID. */
3599 ieee_write_processor (abfd
)
3602 const bfd_arch_info_type
*arch
;
3604 arch
= bfd_get_arch_info (abfd
);
3608 if (! ieee_write_id (abfd
, bfd_printable_name (abfd
)))
3613 if (! ieee_write_id (abfd
, "29000"))
3617 case bfd_arch_h8300
:
3618 if (! ieee_write_id (abfd
, "H8/300"))
3622 case bfd_arch_h8500
:
3623 if (! ieee_write_id (abfd
, "H8/500"))
3631 case bfd_mach_i960_core
:
3632 case bfd_mach_i960_ka_sa
:
3633 if (! ieee_write_id (abfd
, "80960KA"))
3637 case bfd_mach_i960_kb_sb
:
3638 if (! ieee_write_id (abfd
, "80960KB"))
3642 case bfd_mach_i960_ca
:
3643 if (! ieee_write_id (abfd
, "80960CA"))
3647 case bfd_mach_i960_mc
:
3648 case bfd_mach_i960_xa
:
3649 if (! ieee_write_id (abfd
, "80960MC"))
3661 default: id
= "68020"; break;
3662 case bfd_mach_m68000
: id
= "68000"; break;
3663 case bfd_mach_m68008
: id
= "68008"; break;
3664 case bfd_mach_m68010
: id
= "68010"; break;
3665 case bfd_mach_m68020
: id
= "68020"; break;
3666 case bfd_mach_m68030
: id
= "68030"; break;
3667 case bfd_mach_m68040
: id
= "68040"; break;
3668 case bfd_mach_m68060
: id
= "68060"; break;
3669 case bfd_mach_cpu32
: id
= "cpu32"; break;
3670 case bfd_mach_mcf5200
:id
= "5200"; break;
3671 case bfd_mach_mcf5206e
:id
= "5206e"; break;
3672 case bfd_mach_mcf5307
:id
= "5307"; break;
3673 case bfd_mach_mcf5407
:id
= "5407"; break;
3676 if (! ieee_write_id (abfd
, id
))
3686 ieee_write_object_contents (abfd
)
3689 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3693 /* Fast forward over the header area */
3694 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
3697 if (! ieee_write_byte (abfd
, ieee_module_beginning_enum
)
3698 || ! ieee_write_processor (abfd
)
3699 || ! ieee_write_id (abfd
, abfd
->filename
))
3702 /* Fast forward over the variable bits */
3703 if (! ieee_write_byte (abfd
, ieee_address_descriptor_enum
))
3707 if (! ieee_write_byte (abfd
, (bfd_byte
) (bfd_arch_bits_per_byte (abfd
))))
3709 /* MAU's per address */
3710 if (! ieee_write_byte (abfd
,
3711 (bfd_byte
) (bfd_arch_bits_per_address (abfd
)
3712 / bfd_arch_bits_per_byte (abfd
))))
3715 old
= bfd_tell (abfd
);
3716 if (bfd_seek (abfd
, (file_ptr
) (8 * N_W_VARIABLES
), SEEK_CUR
) != 0)
3719 ieee
->w
.r
.extension_record
= bfd_tell (abfd
);
3720 if (bfd_bwrite ((char *) exten
, (bfd_size_type
) sizeof (exten
), abfd
)
3723 if (abfd
->flags
& EXEC_P
)
3725 if (! ieee_write_byte (abfd
, 0x1)) /* Absolute */
3730 if (! ieee_write_byte (abfd
, 0x2)) /* Relocateable */
3734 ieee
->w
.r
.environmental_record
= bfd_tell (abfd
);
3735 if (bfd_bwrite ((char *) envi
, (bfd_size_type
) sizeof (envi
), abfd
)
3739 /* The HP emulator database requires a timestamp in the file. */
3745 t
= (struct tm
*) localtime (&now
);
3746 if (! ieee_write_2bytes (abfd
, (int) ieee_atn_record_enum
)
3747 || ! ieee_write_byte (abfd
, 0x21)
3748 || ! ieee_write_byte (abfd
, 0)
3749 || ! ieee_write_byte (abfd
, 50)
3750 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_year
+ 1900))
3751 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_mon
+ 1))
3752 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_mday
)
3753 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_hour
)
3754 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_min
)
3755 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_sec
))
3763 if (! ieee_write_section_part (abfd
))
3765 /* First write the symbols. This changes their values into table
3766 indeces so we cant use it after this point. */
3767 if (! ieee_write_external_part (abfd
))
3770 /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
3772 /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
3775 /* Write any debugs we have been told about. */
3776 if (! ieee_write_debug_part (abfd
))
3779 /* Can only write the data once the symbols have been written, since
3780 the data contains relocation information which points to the
3782 if (! ieee_write_data_part (abfd
))
3785 /* At the end we put the end! */
3786 if (! ieee_write_me_part (abfd
))
3789 /* Generate the header */
3790 if (bfd_seek (abfd
, old
, SEEK_SET
) != 0)
3793 for (i
= 0; i
< N_W_VARIABLES
; i
++)
3795 if (! ieee_write_2bytes (abfd
, ieee_assign_value_to_variable_enum
)
3796 || ! ieee_write_byte (abfd
, (bfd_byte
) i
)
3797 || ! ieee_write_int5_out (abfd
, (bfd_vma
) ieee
->w
.offset
[i
]))
3804 /* Native-level interface to symbols. */
3806 /* We read the symbols into a buffer, which is discarded when this
3807 function exits. We read the strings into a buffer large enough to
3808 hold them all plus all the cached symbol entries. */
3811 ieee_make_empty_symbol (abfd
)
3814 bfd_size_type amt
= sizeof (ieee_symbol_type
);
3815 ieee_symbol_type
*new = (ieee_symbol_type
*) bfd_zalloc (abfd
, amt
);
3818 new->symbol
.the_bfd
= abfd
;
3819 return &new->symbol
;
3823 ieee_openr_next_archived_file (arch
, prev
)
3827 ieee_ar_data_type
*ar
= IEEE_AR_DATA (arch
);
3828 /* take the next one from the arch state, or reset */
3829 if (prev
== (bfd
*) NULL
)
3831 /* Reset the index - the first two entries are bogus*/
3832 ar
->element_index
= 2;
3836 ieee_ar_obstack_type
*p
= ar
->elements
+ ar
->element_index
;
3837 ar
->element_index
++;
3838 if (ar
->element_index
<= ar
->element_count
)
3840 if (p
->file_offset
!= (file_ptr
) 0)
3842 if (p
->abfd
== (bfd
*) NULL
)
3844 p
->abfd
= _bfd_create_empty_archive_element_shell (arch
);
3845 p
->abfd
->origin
= p
->file_offset
;
3852 bfd_set_error (bfd_error_no_more_archived_files
);
3853 return (bfd
*) NULL
;
3860 ieee_find_nearest_line (abfd
, section
, symbols
, offset
, filename_ptr
,
3861 functionname_ptr
, line_ptr
)
3862 bfd
*abfd ATTRIBUTE_UNUSED
;
3863 asection
*section ATTRIBUTE_UNUSED
;
3864 asymbol
**symbols ATTRIBUTE_UNUSED
;
3865 bfd_vma offset ATTRIBUTE_UNUSED
;
3866 const char **filename_ptr ATTRIBUTE_UNUSED
;
3867 const char **functionname_ptr ATTRIBUTE_UNUSED
;
3868 unsigned int *line_ptr ATTRIBUTE_UNUSED
;
3874 ieee_generic_stat_arch_elt (abfd
, buf
)
3878 ieee_ar_data_type
*ar
= (ieee_ar_data_type
*) NULL
;
3879 ieee_data_type
*ieee
;
3881 if (abfd
->my_archive
!= NULL
)
3882 ar
= abfd
->my_archive
->tdata
.ieee_ar_data
;
3883 if (ar
== (ieee_ar_data_type
*) NULL
)
3885 bfd_set_error (bfd_error_invalid_operation
);
3889 if (IEEE_DATA (abfd
) == NULL
)
3891 if (ieee_object_p (abfd
) == NULL
)
3893 bfd_set_error (bfd_error_wrong_format
);
3898 ieee
= IEEE_DATA (abfd
);
3900 buf
->st_size
= ieee
->w
.r
.me_record
+ 1;
3901 buf
->st_mode
= 0644;
3906 ieee_sizeof_headers (abfd
, x
)
3907 bfd
*abfd ATTRIBUTE_UNUSED
;
3908 boolean x ATTRIBUTE_UNUSED
;
3914 /* The debug info routines are never used. */
3918 ieee_bfd_debug_info_start (abfd
)
3925 ieee_bfd_debug_info_end (abfd
)
3932 /* Add this section to the list of sections we have debug info for, to
3933 be ready to output it at close time
3936 ieee_bfd_debug_info_accumulate (abfd
, section
)
3940 ieee_data_type
*ieee
= IEEE_DATA (section
->owner
);
3941 ieee_data_type
*output_ieee
= IEEE_DATA (abfd
);
3942 /* can only accumulate data from other ieee bfds */
3943 if (section
->owner
->xvec
!= abfd
->xvec
)
3945 /* Only bother once per bfd */
3946 if (ieee
->done_debug
== true)
3948 ieee
->done_debug
= true;
3950 /* Don't bother if there is no debug info */
3951 if (ieee
->w
.r
.debug_information_part
== 0)
3957 bfd_size_type amt
= sizeof (bfd_chain_type
);
3958 bfd_chain_type
*n
= (bfd_chain_type
*) bfd_alloc (abfd
, amt
);
3960 abort (); /* FIXME */
3961 n
->this = section
->owner
;
3962 n
->next
= (bfd_chain_type
*) NULL
;
3964 if (output_ieee
->chain_head
)
3966 output_ieee
->chain_head
->next
= n
;
3970 output_ieee
->chain_root
= n
;
3973 output_ieee
->chain_head
= n
;
3979 #define ieee_close_and_cleanup _bfd_generic_close_and_cleanup
3980 #define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
3982 #define ieee_slurp_armap bfd_true
3983 #define ieee_slurp_extended_name_table bfd_true
3984 #define ieee_construct_extended_name_table \
3985 ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
3987 #define ieee_truncate_arname bfd_dont_truncate_arname
3988 #define ieee_write_armap \
3990 PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
3992 #define ieee_read_ar_hdr bfd_nullvoidptr
3993 #define ieee_update_armap_timestamp bfd_true
3994 #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
3996 #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
3997 #define ieee_get_lineno _bfd_nosymbols_get_lineno
3998 #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
3999 #define ieee_read_minisymbols _bfd_generic_read_minisymbols
4000 #define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
4002 #define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
4004 #define ieee_set_arch_mach _bfd_generic_set_arch_mach
4006 #define ieee_get_section_contents_in_window \
4007 _bfd_generic_get_section_contents_in_window
4008 #define ieee_bfd_get_relocated_section_contents \
4009 bfd_generic_get_relocated_section_contents
4010 #define ieee_bfd_relax_section bfd_generic_relax_section
4011 #define ieee_bfd_gc_sections bfd_generic_gc_sections
4012 #define ieee_bfd_merge_sections bfd_generic_merge_sections
4013 #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
4014 #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
4015 #define ieee_bfd_final_link _bfd_generic_final_link
4016 #define ieee_bfd_link_split_section _bfd_generic_link_split_section
4019 const bfd_target ieee_vec
=
4022 bfd_target_ieee_flavour
,
4023 BFD_ENDIAN_UNKNOWN
, /* target byte order */
4024 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
4025 (HAS_RELOC
| EXEC_P
| /* object flags */
4026 HAS_LINENO
| HAS_DEBUG
|
4027 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
4028 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
4029 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
4030 '_', /* leading underscore */
4031 ' ', /* ar_pad_char */
4032 16, /* ar_max_namelen */
4033 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4034 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4035 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
4036 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4037 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4038 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
4041 ieee_object_p
, /* bfd_check_format */
4048 _bfd_generic_mkarchive
,
4053 ieee_write_object_contents
,
4054 _bfd_write_archive_contents
,
4058 /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
4059 ieee_get_section_contents, ieee_get_section_contents_in_window */
4060 BFD_JUMP_TABLE_GENERIC (ieee
),
4062 BFD_JUMP_TABLE_COPY (_bfd_generic
),
4063 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
4065 /* ieee_slurp_armap, ieee_slurp_extended_name_table,
4066 ieee_construct_extended_name_table, ieee_truncate_arname,
4067 ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
4068 ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
4069 ieee_update_armap_timestamp */
4070 BFD_JUMP_TABLE_ARCHIVE (ieee
),
4072 /* ieee_get_symtab_upper_bound, ieee_get_symtab, ieee_make_empty_symbol,
4073 ieee_print_symbol, ieee_get_symbol_info, ieee_bfd_is_local_label_name,
4074 ieee_get_lineno, ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
4075 ieee_read_minisymbols, ieee_minisymbol_to_symbol */
4076 BFD_JUMP_TABLE_SYMBOLS (ieee
),
4078 /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
4079 ieee_bfd_reloc_type_lookup */
4080 BFD_JUMP_TABLE_RELOCS (ieee
),
4082 /* ieee_set_arch_mach, ieee_set_section_contents */
4083 BFD_JUMP_TABLE_WRITE (ieee
),
4085 /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
4086 ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
4087 ieee_bfd_link_add_symbols, ieee_bfd_final_link,
4088 ieee_bfd_link_split_section, ieee_bfd_gc_sections,
4089 ieee_bfd_merge_sections */
4090 BFD_JUMP_TABLE_LINK (ieee
),
4092 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),