1 /* BFD back-end for ieee-695 objects.
2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003, 2004
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 bfd_boolean ieee_write_byte
44 PARAMS ((bfd
*, int));
45 static bfd_boolean ieee_write_2bytes
46 PARAMS ((bfd
*, int));
47 static bfd_boolean ieee_write_int
48 PARAMS ((bfd
*, bfd_vma
));
49 static bfd_boolean ieee_write_id
50 PARAMS ((bfd
*, const char *));
51 static unsigned short read_2bytes
52 PARAMS ((common_header_type
*));
53 static void bfd_get_string
54 PARAMS ((common_header_type
*, char *, size_t));
56 PARAMS ((common_header_type
*));
57 static bfd_boolean ieee_write_expression
58 PARAMS ((bfd
*, bfd_vma
, asymbol
*, bfd_boolean
, unsigned int));
59 static void ieee_write_int5
60 PARAMS ((bfd_byte
*, bfd_vma
));
61 static bfd_boolean ieee_write_int5_out
62 PARAMS ((bfd
*, bfd_vma
));
63 static bfd_boolean parse_int
64 PARAMS ((common_header_type
*, bfd_vma
*));
66 PARAMS ((common_header_type
*, bfd_boolean
*));
67 static bfd_vma must_parse_int
68 PARAMS ((common_header_type
*));
69 static void parse_expression
70 PARAMS ((ieee_data_type
*, bfd_vma
*, ieee_symbol_index_type
*,
71 bfd_boolean
*, unsigned int *, asection
**));
72 static file_ptr ieee_part_after
73 PARAMS ((ieee_data_type
*, file_ptr
));
74 static ieee_symbol_type
*get_symbol
75 PARAMS ((bfd
*, ieee_data_type
*, ieee_symbol_type
*, unsigned int *,
76 ieee_symbol_type
***, unsigned int *, int));
77 static bfd_boolean ieee_slurp_external_symbols
79 static bfd_boolean ieee_slurp_symbol_table
81 static long ieee_get_symtab_upper_bound
83 static long ieee_canonicalize_symtab
84 PARAMS ((bfd
*, asymbol
**));
85 static asection
*get_section_entry
86 PARAMS ((bfd
*, ieee_data_type
*i
, unsigned int));
87 static void ieee_slurp_sections
89 static bfd_boolean ieee_slurp_debug
91 const bfd_target
*ieee_archive_p
93 const bfd_target
*ieee_object_p
95 static void ieee_get_symbol_info
96 PARAMS ((bfd
*, asymbol
*, symbol_info
*));
97 static void ieee_print_symbol
98 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
99 static bfd_boolean do_one
100 PARAMS ((ieee_data_type
*, ieee_per_section_type
*, unsigned char *,
102 static bfd_boolean ieee_slurp_section_data
104 static bfd_boolean ieee_new_section_hook
105 PARAMS ((bfd
*, asection
*));
106 static long ieee_get_reloc_upper_bound
107 PARAMS ((bfd
*, sec_ptr
));
108 static bfd_boolean ieee_get_section_contents
109 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
110 static long ieee_canonicalize_reloc
111 PARAMS ((bfd
*, sec_ptr
, arelent
**, asymbol
**));
113 PARAMS ((const PTR
, const PTR
));
114 static bfd_boolean ieee_write_section_part
116 static bfd_boolean do_with_relocs
117 PARAMS ((bfd
*, asection
*));
118 static bfd_boolean do_as_repeat
119 PARAMS ((bfd
*, asection
*));
120 static bfd_boolean do_without_relocs
121 PARAMS ((bfd
*, asection
*));
122 static bfd_boolean ieee_mkobject
128 static void write_int
132 static void copy_expression
135 PARAMS ((struct output_buffer_struct
*));
137 PARAMS ((struct output_buffer_struct
*));
140 static void f1_record
142 static void f0_record
144 static void copy_till_end
146 static void f2_record
148 static void f8_record
150 static void e2_record
154 static void relocate_debug
155 PARAMS ((bfd
*, bfd
*));
156 static bfd_boolean ieee_write_debug_part
158 static bfd_boolean ieee_write_data_part
160 static bfd_boolean init_for_output
162 static bfd_boolean ieee_set_section_contents
163 PARAMS ((bfd
*, sec_ptr
, const PTR
, file_ptr
, bfd_size_type
));
164 static bfd_boolean ieee_write_external_part
166 static bfd_boolean ieee_write_me_part
168 static bfd_boolean ieee_write_processor
170 static bfd_boolean ieee_write_object_contents
172 static asymbol
*ieee_make_empty_symbol
174 static bfd
*ieee_openr_next_archived_file
175 PARAMS ((bfd
*, bfd
*));
176 static bfd_boolean ieee_find_nearest_line
177 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
178 const char **, unsigned int *));
179 static int ieee_generic_stat_arch_elt
180 PARAMS ((bfd
*, struct stat
*));
181 static int ieee_sizeof_headers
182 PARAMS ((bfd
*, bfd_boolean
));
184 /* Functions for writing to ieee files in the strange way that the
185 standard requires. */
188 ieee_write_byte (abfd
, barg
)
195 if (bfd_bwrite ((PTR
) &byte
, (bfd_size_type
) 1, abfd
) != 1)
201 ieee_write_2bytes (abfd
, bytes
)
207 buffer
[0] = bytes
>> 8;
208 buffer
[1] = bytes
& 0xff;
209 if (bfd_bwrite ((PTR
) buffer
, (bfd_size_type
) 2, abfd
) != 2)
215 ieee_write_int (abfd
, value
)
221 if (! ieee_write_byte (abfd
, (bfd_byte
) value
))
228 /* How many significant bytes ? */
229 /* FIXME FOR LONGER INTS. */
230 if (value
& 0xff000000)
232 else if (value
& 0x00ff0000)
234 else if (value
& 0x0000ff00)
239 if (! ieee_write_byte (abfd
,
240 (bfd_byte
) ((int) ieee_number_repeat_start_enum
246 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 24)))
250 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 16)))
254 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 8)))
258 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
)))
267 ieee_write_id (abfd
, id
)
271 size_t length
= strlen (id
);
275 if (! ieee_write_byte (abfd
, (bfd_byte
) length
))
278 else if (length
< 255)
280 if (! ieee_write_byte (abfd
, ieee_extension_length_1_enum
)
281 || ! ieee_write_byte (abfd
, (bfd_byte
) length
))
284 else if (length
< 65535)
286 if (! ieee_write_byte (abfd
, ieee_extension_length_2_enum
)
287 || ! ieee_write_2bytes (abfd
, (int) length
))
292 (*_bfd_error_handler
)
293 (_("%s: string too long (%d chars, max 65535)"),
294 bfd_get_filename (abfd
), length
);
295 bfd_set_error (bfd_error_invalid_operation
);
299 if (bfd_bwrite ((PTR
) id
, (bfd_size_type
) length
, abfd
) != length
)
304 /* Functions for reading from ieee files in the strange way that the
305 standard requires. */
307 #define this_byte(ieee) *((ieee)->input_p)
308 #define next_byte(ieee) ((ieee)->input_p++)
309 #define this_byte_and_next(ieee) (*((ieee)->input_p++))
311 static unsigned short
313 common_header_type
*ieee
;
315 unsigned char c1
= this_byte_and_next (ieee
);
316 unsigned char c2
= this_byte_and_next (ieee
);
318 return (c1
<< 8) | c2
;
322 bfd_get_string (ieee
, string
, length
)
323 common_header_type
*ieee
;
329 for (i
= 0; i
< length
; i
++)
330 string
[i
] = this_byte_and_next (ieee
);
335 common_header_type
*ieee
;
340 length
= this_byte_and_next (ieee
);
343 /* Simple string of length 0 to 127. */
345 else if (length
== 0xde)
347 /* Length is next byte, allowing 0..255. */
348 length
= this_byte_and_next (ieee
);
350 else if (length
== 0xdf)
352 /* Length is next two bytes, allowing 0..65535. */
353 length
= this_byte_and_next (ieee
);
354 length
= (length
* 256) + this_byte_and_next (ieee
);
357 /* Buy memory and read string. */
358 string
= bfd_alloc (ieee
->abfd
, (bfd_size_type
) length
+ 1);
361 bfd_get_string (ieee
, string
, length
);
367 ieee_write_expression (abfd
, value
, symbol
, pcrel
, index
)
374 unsigned int term_count
= 0;
378 if (! ieee_write_int (abfd
, value
))
383 /* Badly formatted binaries can have a missing symbol,
384 so test here to prevent a seg fault. */
387 if (bfd_is_com_section (symbol
->section
)
388 || bfd_is_und_section (symbol
->section
))
390 /* Def of a common symbol. */
391 if (! ieee_write_byte (abfd
, ieee_variable_X_enum
)
392 || ! ieee_write_int (abfd
, symbol
->value
))
396 else if (! bfd_is_abs_section (symbol
->section
))
398 /* Ref to defined symbol - */
400 if (symbol
->flags
& BSF_GLOBAL
)
402 if (! ieee_write_byte (abfd
, ieee_variable_I_enum
)
403 || ! ieee_write_int (abfd
, symbol
->value
))
407 else if (symbol
->flags
& (BSF_LOCAL
| BSF_SECTION_SYM
))
409 /* This is a reference to a defined local symbol. We can
410 easily do a local as a section+offset. */
411 if (! ieee_write_byte (abfd
, ieee_variable_R_enum
)
412 || ! ieee_write_byte (abfd
,
413 (bfd_byte
) (symbol
->section
->index
414 + IEEE_SECTION_NUMBER_BASE
)))
418 if (symbol
->value
!= 0)
420 if (! ieee_write_int (abfd
, symbol
->value
))
427 (*_bfd_error_handler
)
428 (_("%s: unrecognized symbol `%s' flags 0x%x"),
429 bfd_get_filename (abfd
), bfd_asymbol_name (symbol
),
431 bfd_set_error (bfd_error_invalid_operation
);
439 /* Subtract the pc from here by asking for PC of this section. */
440 if (! ieee_write_byte (abfd
, ieee_variable_P_enum
)
441 || ! ieee_write_byte (abfd
,
442 (bfd_byte
) (index
+ IEEE_SECTION_NUMBER_BASE
))
443 || ! ieee_write_byte (abfd
, ieee_function_minus_enum
))
447 /* Handle the degenerate case of a 0 address. */
449 if (! ieee_write_int (abfd
, (bfd_vma
) 0))
452 while (term_count
> 1)
454 if (! ieee_write_byte (abfd
, ieee_function_plus_enum
))
462 /* Writes any integer into the buffer supplied and always takes 5 bytes. */
465 ieee_write_int5 (buffer
, value
)
469 buffer
[0] = (bfd_byte
) ieee_number_repeat_4_enum
;
470 buffer
[1] = (value
>> 24) & 0xff;
471 buffer
[2] = (value
>> 16) & 0xff;
472 buffer
[3] = (value
>> 8) & 0xff;
473 buffer
[4] = (value
>> 0) & 0xff;
477 ieee_write_int5_out (abfd
, value
)
483 ieee_write_int5 (b
, value
);
484 if (bfd_bwrite ((PTR
) b
, (bfd_size_type
) 5, abfd
) != 5)
490 parse_int (ieee
, value_ptr
)
491 common_header_type
*ieee
;
494 int value
= this_byte (ieee
);
497 if (value
>= 0 && value
<= 127)
503 else if (value
>= 0x80 && value
<= 0x88)
505 unsigned int count
= value
& 0xf;
511 result
= (result
<< 8) | this_byte_and_next (ieee
);
522 common_header_type
*ieee
;
526 *ok
= parse_int (ieee
, &x
);
531 must_parse_int (ieee
)
532 common_header_type
*ieee
;
535 BFD_ASSERT (parse_int (ieee
, &result
));
543 ieee_symbol_index_type symbol
;
547 #if KEEPMINUSPCININST
549 #define SRC_MASK(arg) arg
550 #define PCREL_OFFSET FALSE
554 #define SRC_MASK(arg) 0
555 #define PCREL_OFFSET TRUE
559 static reloc_howto_type abs32_howto
=
566 complain_overflow_bitfield
,
574 static reloc_howto_type abs16_howto
=
581 complain_overflow_bitfield
,
589 static reloc_howto_type abs8_howto
=
596 complain_overflow_bitfield
,
604 static reloc_howto_type rel32_howto
=
611 complain_overflow_signed
,
615 SRC_MASK (0xffffffff),
619 static reloc_howto_type rel16_howto
=
626 complain_overflow_signed
,
630 SRC_MASK (0x0000ffff),
634 static reloc_howto_type rel8_howto
=
641 complain_overflow_signed
,
645 SRC_MASK (0x000000ff),
649 static ieee_symbol_index_type NOSYMBOL
= {0, 0};
652 parse_expression (ieee
, value
, symbol
, pcrel
, extra
, section
)
653 ieee_data_type
*ieee
;
655 ieee_symbol_index_type
*symbol
;
667 bfd_boolean loop
= TRUE
;
668 ieee_value_type stack
[10];
670 /* The stack pointer always points to the next unused location. */
671 #define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
672 #define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
673 ieee_value_type
*sp
= stack
;
676 while (loop
&& ieee
->h
.input_p
< ieee
->h
.last_byte
)
678 switch (this_byte (&(ieee
->h
)))
680 case ieee_variable_P_enum
:
681 /* P variable, current program counter for section n. */
685 next_byte (&(ieee
->h
));
687 section_n
= must_parse_int (&(ieee
->h
));
688 PUSH (NOSYMBOL
, bfd_abs_section_ptr
, 0);
691 case ieee_variable_L_enum
:
692 /* L variable address of section N. */
693 next_byte (&(ieee
->h
));
694 PUSH (NOSYMBOL
, ieee
->section_table
[must_parse_int (&(ieee
->h
))], 0);
696 case ieee_variable_R_enum
:
697 /* R variable, logical address of section module. */
698 /* FIXME, this should be different to L. */
699 next_byte (&(ieee
->h
));
700 PUSH (NOSYMBOL
, ieee
->section_table
[must_parse_int (&(ieee
->h
))], 0);
702 case ieee_variable_S_enum
:
703 /* S variable, size in MAUS of section module. */
704 next_byte (&(ieee
->h
));
707 ieee
->section_table
[must_parse_int (&(ieee
->h
))]->size
);
709 case ieee_variable_I_enum
:
710 /* Push the address of variable n. */
712 ieee_symbol_index_type sy
;
713 next_byte (&(ieee
->h
));
714 sy
.index
= (int) must_parse_int (&(ieee
->h
));
717 PUSH (sy
, bfd_abs_section_ptr
, 0);
720 case ieee_variable_X_enum
:
721 /* Push the address of external variable n. */
723 ieee_symbol_index_type sy
;
724 next_byte (&(ieee
->h
));
725 sy
.index
= (int) (must_parse_int (&(ieee
->h
)));
728 PUSH (sy
, bfd_und_section_ptr
, 0);
731 case ieee_function_minus_enum
:
733 bfd_vma value1
, value2
;
734 asection
*section1
, *section_dummy
;
735 ieee_symbol_index_type sy
;
736 next_byte (&(ieee
->h
));
738 POP (sy
, section1
, value1
);
739 POP (sy
, section_dummy
, value2
);
740 PUSH (sy
, section1
? section1
: section_dummy
, value2
- value1
);
743 case ieee_function_plus_enum
:
745 bfd_vma value1
, value2
;
748 ieee_symbol_index_type sy1
;
749 ieee_symbol_index_type sy2
;
750 next_byte (&(ieee
->h
));
752 POP (sy1
, section1
, value1
);
753 POP (sy2
, section2
, value2
);
754 PUSH (sy1
.letter
? sy1
: sy2
,
755 bfd_is_abs_section (section1
) ? section2
: section1
,
762 BFD_ASSERT (this_byte (&(ieee
->h
)) < (int) ieee_variable_A_enum
763 || this_byte (&(ieee
->h
)) > (int) ieee_variable_Z_enum
);
764 if (parse_int (&(ieee
->h
), &va
))
766 PUSH (NOSYMBOL
, bfd_abs_section_ptr
, va
);
770 /* Thats all that we can understand. */
777 /* As far as I can see there is a bug in the Microtec IEEE output
778 which I'm using to scan, whereby the comma operator is omitted
779 sometimes in an expression, giving expressions with too many
780 terms. We can tell if that's the case by ensuring that
781 sp == stack here. If not, then we've pushed something too far,
782 so we keep adding. */
783 while (sp
!= stack
+ 1)
786 ieee_symbol_index_type sy1
;
787 POP (sy1
, section1
, *extra
);
790 POP (*symbol
, dummy
, *value
);
796 #define ieee_seek(ieee, offset) \
799 ieee->h.input_p = ieee->h.first_byte + offset; \
800 ieee->h.last_byte = (ieee->h.first_byte \
801 + ieee_part_after (ieee, offset)); \
805 #define ieee_pos(ieee) \
806 (ieee->h.input_p - ieee->h.first_byte)
808 /* Find the first part of the ieee file after HERE. */
811 ieee_part_after (ieee
, here
)
812 ieee_data_type
*ieee
;
816 file_ptr after
= ieee
->w
.r
.me_record
;
818 /* File parts can come in any order, except that module end is
819 guaranteed to be last (and the header first). */
820 for (part
= 0; part
< N_W_VARIABLES
; part
++)
821 if (ieee
->w
.offset
[part
] > here
&& after
> ieee
->w
.offset
[part
])
822 after
= ieee
->w
.offset
[part
];
827 static unsigned int last_index
;
828 static char last_type
; /* Is the index for an X or a D. */
830 static ieee_symbol_type
*
831 get_symbol (abfd
, ieee
, last_symbol
, symbol_count
, pptr
, max_index
, this_type
)
832 bfd
*abfd ATTRIBUTE_UNUSED
;
833 ieee_data_type
*ieee
;
834 ieee_symbol_type
*last_symbol
;
835 unsigned int *symbol_count
;
836 ieee_symbol_type
***pptr
;
837 unsigned int *max_index
;
840 /* Need a new symbol. */
841 unsigned int new_index
= must_parse_int (&(ieee
->h
));
843 if (new_index
!= last_index
|| this_type
!= last_type
)
845 ieee_symbol_type
*new_symbol
;
846 bfd_size_type amt
= sizeof (ieee_symbol_type
);
848 new_symbol
= (ieee_symbol_type
*) bfd_alloc (ieee
->h
.abfd
, amt
);
852 new_symbol
->index
= new_index
;
853 last_index
= new_index
;
856 *pptr
= &new_symbol
->next
;
857 if (new_index
> *max_index
)
858 *max_index
= new_index
;
860 last_type
= this_type
;
861 new_symbol
->symbol
.section
= bfd_abs_section_ptr
;
868 ieee_slurp_external_symbols (abfd
)
871 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
872 file_ptr offset
= ieee
->w
.r
.external_part
;
874 ieee_symbol_type
**prev_symbols_ptr
= &ieee
->external_symbols
;
875 ieee_symbol_type
**prev_reference_ptr
= &ieee
->external_reference
;
876 ieee_symbol_type
*symbol
= (ieee_symbol_type
*) NULL
;
877 unsigned int symbol_count
= 0;
878 bfd_boolean loop
= TRUE
;
879 last_index
= 0xffffff;
880 ieee
->symbol_table_full
= TRUE
;
882 ieee_seek (ieee
, offset
);
886 switch (this_byte (&(ieee
->h
)))
889 next_byte (&(ieee
->h
));
891 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
893 &ieee
->external_symbol_max_index
, 'I');
897 symbol
->symbol
.the_bfd
= abfd
;
898 symbol
->symbol
.name
= read_id (&(ieee
->h
));
899 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
900 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
902 case ieee_external_symbol_enum
:
903 next_byte (&(ieee
->h
));
905 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
907 &ieee
->external_symbol_max_index
, 'D');
911 BFD_ASSERT (symbol
->index
>= ieee
->external_symbol_min_index
);
913 symbol
->symbol
.the_bfd
= abfd
;
914 symbol
->symbol
.name
= read_id (&(ieee
->h
));
915 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
916 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
918 case ieee_attribute_record_enum
>> 8:
920 unsigned int symbol_name_index
;
921 unsigned int symbol_type_index
;
922 unsigned int symbol_attribute_def
;
924 switch (read_2bytes (&ieee
->h
))
926 case ieee_attribute_record_enum
:
927 symbol_name_index
= must_parse_int (&(ieee
->h
));
928 symbol_type_index
= must_parse_int (&(ieee
->h
));
929 symbol_attribute_def
= must_parse_int (&(ieee
->h
));
930 switch (symbol_attribute_def
)
934 parse_int (&ieee
->h
, &value
);
937 (*_bfd_error_handler
)
938 (_("%B: unimplemented ATI record %u for symbol %u"),
939 abfd
, symbol_attribute_def
, symbol_name_index
);
940 bfd_set_error (bfd_error_bad_value
);
945 case ieee_external_reference_info_record_enum
:
946 /* Skip over ATX record. */
947 parse_int (&(ieee
->h
), &value
);
948 parse_int (&(ieee
->h
), &value
);
949 parse_int (&(ieee
->h
), &value
);
950 parse_int (&(ieee
->h
), &value
);
952 case ieee_atn_record_enum
:
953 /* We may get call optimization information here,
954 which we just ignore. The format is
955 {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs}. */
956 parse_int (&ieee
->h
, &value
);
957 parse_int (&ieee
->h
, &value
);
958 parse_int (&ieee
->h
, &value
);
961 (*_bfd_error_handler
)
962 (_("%B: unexpected ATN type %d in external part"),
964 bfd_set_error (bfd_error_bad_value
);
967 parse_int (&ieee
->h
, &value
);
968 parse_int (&ieee
->h
, &value
);
975 switch (read_2bytes (&ieee
->h
))
977 case ieee_asn_record_enum
:
978 parse_int (&ieee
->h
, &val1
);
979 parse_int (&ieee
->h
, &val1
);
983 (*_bfd_error_handler
)
984 (_("%B: unexpected type after ATN"), abfd
);
985 bfd_set_error (bfd_error_bad_value
);
992 case ieee_value_record_enum
>> 8:
994 unsigned int symbol_name_index
;
995 ieee_symbol_index_type symbol_ignore
;
996 bfd_boolean pcrel_ignore
;
998 next_byte (&(ieee
->h
));
999 next_byte (&(ieee
->h
));
1001 symbol_name_index
= must_parse_int (&(ieee
->h
));
1002 parse_expression (ieee
,
1003 &symbol
->symbol
.value
,
1007 &symbol
->symbol
.section
);
1009 /* Fully linked IEEE-695 files tend to give every symbol
1010 an absolute value. Try to convert that back into a
1011 section relative value. FIXME: This won't always to
1013 if (bfd_is_abs_section (symbol
->symbol
.section
)
1014 && (abfd
->flags
& HAS_RELOC
) == 0)
1019 val
= symbol
->symbol
.value
;
1020 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
1022 if (val
>= s
->vma
&& val
< s
->vma
+ s
->size
)
1024 symbol
->symbol
.section
= s
;
1025 symbol
->symbol
.value
-= s
->vma
;
1031 symbol
->symbol
.flags
= BSF_GLOBAL
| BSF_EXPORT
;
1035 case ieee_weak_external_reference_enum
:
1039 next_byte (&(ieee
->h
));
1040 /* Throw away the external reference index. */
1041 (void) must_parse_int (&(ieee
->h
));
1042 /* Fetch the default size if not resolved. */
1043 size
= must_parse_int (&(ieee
->h
));
1044 /* Fetch the default value if available. */
1045 if (! parse_int (&(ieee
->h
), &value
))
1049 /* This turns into a common. */
1050 symbol
->symbol
.section
= bfd_com_section_ptr
;
1051 symbol
->symbol
.value
= size
;
1055 case ieee_external_reference_enum
:
1056 next_byte (&(ieee
->h
));
1058 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
1059 &prev_reference_ptr
,
1060 &ieee
->external_reference_max_index
, 'X');
1064 symbol
->symbol
.the_bfd
= abfd
;
1065 symbol
->symbol
.name
= read_id (&(ieee
->h
));
1066 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
1067 symbol
->symbol
.section
= bfd_und_section_ptr
;
1068 symbol
->symbol
.value
= (bfd_vma
) 0;
1069 symbol
->symbol
.flags
= 0;
1071 BFD_ASSERT (symbol
->index
>= ieee
->external_reference_min_index
);
1079 if (ieee
->external_symbol_max_index
!= 0)
1081 ieee
->external_symbol_count
=
1082 ieee
->external_symbol_max_index
-
1083 ieee
->external_symbol_min_index
+ 1;
1087 ieee
->external_symbol_count
= 0;
1090 if (ieee
->external_reference_max_index
!= 0)
1092 ieee
->external_reference_count
=
1093 ieee
->external_reference_max_index
-
1094 ieee
->external_reference_min_index
+ 1;
1098 ieee
->external_reference_count
= 0;
1102 ieee
->external_reference_count
+ ieee
->external_symbol_count
;
1104 if (symbol_count
!= abfd
->symcount
)
1106 /* There are gaps in the table -- */
1107 ieee
->symbol_table_full
= FALSE
;
1110 *prev_symbols_ptr
= (ieee_symbol_type
*) NULL
;
1111 *prev_reference_ptr
= (ieee_symbol_type
*) NULL
;
1117 ieee_slurp_symbol_table (abfd
)
1120 if (! IEEE_DATA (abfd
)->read_symbols
)
1122 if (! ieee_slurp_external_symbols (abfd
))
1124 IEEE_DATA (abfd
)->read_symbols
= TRUE
;
1130 ieee_get_symtab_upper_bound (abfd
)
1133 if (! ieee_slurp_symbol_table (abfd
))
1136 return (abfd
->symcount
!= 0) ?
1137 (abfd
->symcount
+ 1) * (sizeof (ieee_symbol_type
*)) : 0;
1140 /* Move from our internal lists to the canon table, and insert in
1141 symbol index order. */
1143 extern const bfd_target ieee_vec
;
1146 ieee_canonicalize_symtab (abfd
, location
)
1150 ieee_symbol_type
*symp
;
1151 static bfd dummy_bfd
;
1152 static asymbol empty_symbol
=
1160 /* K&R compilers can't initialise unions. */
1167 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1168 dummy_bfd
.xvec
= &ieee_vec
;
1169 if (! ieee_slurp_symbol_table (abfd
))
1172 if (! ieee
->symbol_table_full
)
1174 /* Arrgh - there are gaps in the table, run through and fill them
1175 up with pointers to a null place. */
1178 for (i
= 0; i
< abfd
->symcount
; i
++)
1179 location
[i
] = &empty_symbol
;
1182 ieee
->external_symbol_base_offset
= -ieee
->external_symbol_min_index
;
1183 for (symp
= IEEE_DATA (abfd
)->external_symbols
;
1184 symp
!= (ieee_symbol_type
*) NULL
;
1186 /* Place into table at correct index locations. */
1187 location
[symp
->index
+ ieee
->external_symbol_base_offset
] = &symp
->symbol
;
1189 /* The external refs are indexed in a bit. */
1190 ieee
->external_reference_base_offset
=
1191 -ieee
->external_reference_min_index
+ ieee
->external_symbol_count
;
1193 for (symp
= IEEE_DATA (abfd
)->external_reference
;
1194 symp
!= (ieee_symbol_type
*) NULL
;
1196 location
[symp
->index
+ ieee
->external_reference_base_offset
] =
1201 location
[abfd
->symcount
] = (asymbol
*) NULL
;
1203 return abfd
->symcount
;
1207 get_section_entry (abfd
, ieee
, index
)
1209 ieee_data_type
*ieee
;
1212 if (index
>= ieee
->section_table_size
)
1218 c
= ieee
->section_table_size
;
1225 amt
*= sizeof (asection
*);
1226 n
= (asection
**) bfd_realloc (ieee
->section_table
, amt
);
1230 for (i
= ieee
->section_table_size
; i
< c
; i
++)
1233 ieee
->section_table
= n
;
1234 ieee
->section_table_size
= c
;
1237 if (ieee
->section_table
[index
] == (asection
*) NULL
)
1239 char *tmp
= bfd_alloc (abfd
, (bfd_size_type
) 11);
1244 sprintf (tmp
, " fsec%4d", index
);
1245 section
= bfd_make_section (abfd
, tmp
);
1246 ieee
->section_table
[index
] = section
;
1247 section
->flags
= SEC_NO_FLAGS
;
1248 section
->target_index
= index
;
1249 ieee
->section_table
[index
] = section
;
1251 return ieee
->section_table
[index
];
1255 ieee_slurp_sections (abfd
)
1258 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1259 file_ptr offset
= ieee
->w
.r
.section_part
;
1264 bfd_byte section_type
[3];
1265 ieee_seek (ieee
, offset
);
1268 switch (this_byte (&(ieee
->h
)))
1270 case ieee_section_type_enum
:
1273 unsigned int section_index
;
1274 next_byte (&(ieee
->h
));
1275 section_index
= must_parse_int (&(ieee
->h
));
1277 section
= get_section_entry (abfd
, ieee
, section_index
);
1279 section_type
[0] = this_byte_and_next (&(ieee
->h
));
1281 /* Set minimal section attributes. Attributes are
1282 extended later, based on section contents. */
1283 switch (section_type
[0])
1286 /* Normal attributes for absolute sections. */
1287 section_type
[1] = this_byte (&(ieee
->h
));
1288 section
->flags
= SEC_ALLOC
;
1289 switch (section_type
[1])
1291 case 0xD3: /* AS Absolute section attributes. */
1292 next_byte (&(ieee
->h
));
1293 section_type
[2] = this_byte (&(ieee
->h
));
1294 switch (section_type
[2])
1298 next_byte (&(ieee
->h
));
1299 section
->flags
|= SEC_CODE
;
1303 next_byte (&(ieee
->h
));
1304 section
->flags
|= SEC_DATA
;
1307 next_byte (&(ieee
->h
));
1308 /* Normal rom data. */
1309 section
->flags
|= SEC_ROM
| SEC_DATA
;
1316 case 0xC3: /* Named relocatable sections (type C). */
1317 section_type
[1] = this_byte (&(ieee
->h
));
1318 section
->flags
= SEC_ALLOC
;
1319 switch (section_type
[1])
1321 case 0xD0: /* Normal code (CP). */
1322 next_byte (&(ieee
->h
));
1323 section
->flags
|= SEC_CODE
;
1325 case 0xC4: /* Normal data (CD). */
1326 next_byte (&(ieee
->h
));
1327 section
->flags
|= SEC_DATA
;
1329 case 0xD2: /* Normal rom data (CR). */
1330 next_byte (&(ieee
->h
));
1331 section
->flags
|= SEC_ROM
| SEC_DATA
;
1338 /* Read section name, use it if non empty. */
1339 name
= read_id (&ieee
->h
);
1341 section
->name
= name
;
1343 /* Skip these fields, which we don't care about. */
1345 bfd_vma parent
, brother
, context
;
1346 parse_int (&(ieee
->h
), &parent
);
1347 parse_int (&(ieee
->h
), &brother
);
1348 parse_int (&(ieee
->h
), &context
);
1352 case ieee_section_alignment_enum
:
1354 unsigned int section_index
;
1357 next_byte (&(ieee
->h
));
1358 section_index
= must_parse_int (&ieee
->h
);
1359 section
= get_section_entry (abfd
, ieee
, section_index
);
1360 if (section_index
> ieee
->section_count
)
1362 ieee
->section_count
= section_index
;
1364 section
->alignment_power
=
1365 bfd_log2 (must_parse_int (&ieee
->h
));
1366 (void) parse_int (&(ieee
->h
), &value
);
1369 case ieee_e2_first_byte_enum
:
1372 ieee_record_enum_type t
;
1374 t
= (ieee_record_enum_type
) (read_2bytes (&(ieee
->h
)));
1377 case ieee_section_size_enum
:
1378 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1379 section
->size
= must_parse_int (&(ieee
->h
));
1381 case ieee_physical_region_size_enum
:
1382 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1383 section
->size
= must_parse_int (&(ieee
->h
));
1385 case ieee_region_base_address_enum
:
1386 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1387 section
->vma
= must_parse_int (&(ieee
->h
));
1388 section
->lma
= section
->vma
;
1390 case ieee_mau_size_enum
:
1391 must_parse_int (&(ieee
->h
));
1392 must_parse_int (&(ieee
->h
));
1394 case ieee_m_value_enum
:
1395 must_parse_int (&(ieee
->h
));
1396 must_parse_int (&(ieee
->h
));
1398 case ieee_section_base_address_enum
:
1399 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1400 section
->vma
= must_parse_int (&(ieee
->h
));
1401 section
->lma
= section
->vma
;
1403 case ieee_section_offset_enum
:
1404 (void) must_parse_int (&(ieee
->h
));
1405 (void) must_parse_int (&(ieee
->h
));
1419 /* Make a section for the debugging information, if any. We don't try
1420 to interpret the debugging information; we just point the section
1421 at the area in the file so that program which understand can dig it
1425 ieee_slurp_debug (abfd
)
1428 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1432 if (ieee
->w
.r
.debug_information_part
== 0)
1435 sec
= bfd_make_section (abfd
, ".debug");
1438 sec
->flags
|= SEC_DEBUGGING
| SEC_HAS_CONTENTS
;
1439 sec
->filepos
= ieee
->w
.r
.debug_information_part
;
1441 debug_end
= ieee_part_after (ieee
, ieee
->w
.r
.debug_information_part
);
1442 sec
->size
= debug_end
- ieee
->w
.r
.debug_information_part
;
1447 /* Archive stuff. */
1450 ieee_archive_p (abfd
)
1455 unsigned char buffer
[512];
1456 file_ptr buffer_offset
= 0;
1457 ieee_ar_data_type
*save
= abfd
->tdata
.ieee_ar_data
;
1458 ieee_ar_data_type
*ieee
;
1459 bfd_size_type alc_elts
;
1460 ieee_ar_obstack_type
*elts
= NULL
;
1461 bfd_size_type amt
= sizeof (ieee_ar_data_type
);
1463 abfd
->tdata
.ieee_ar_data
= (ieee_ar_data_type
*) bfd_alloc (abfd
, amt
);
1464 if (!abfd
->tdata
.ieee_ar_data
)
1465 goto error_ret_restore
;
1466 ieee
= IEEE_AR_DATA (abfd
);
1468 /* Ignore the return value here. It doesn't matter if we don't read
1469 the entire buffer. We might have a very small ieee file. */
1470 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1472 ieee
->h
.first_byte
= buffer
;
1473 ieee
->h
.input_p
= buffer
;
1475 ieee
->h
.abfd
= abfd
;
1477 if (this_byte (&(ieee
->h
)) != Module_Beginning
)
1478 goto got_wrong_format_error
;
1480 next_byte (&(ieee
->h
));
1481 library
= read_id (&(ieee
->h
));
1482 if (strcmp (library
, "LIBRARY") != 0)
1483 goto got_wrong_format_error
;
1485 /* Throw away the filename. */
1486 read_id (&(ieee
->h
));
1488 ieee
->element_count
= 0;
1489 ieee
->element_index
= 0;
1491 next_byte (&(ieee
->h
)); /* Drop the ad part. */
1492 must_parse_int (&(ieee
->h
)); /* And the two dummy numbers. */
1493 must_parse_int (&(ieee
->h
));
1496 elts
= (ieee_ar_obstack_type
*) bfd_malloc (alc_elts
* sizeof *elts
);
1500 /* Read the index of the BB table. */
1504 ieee_ar_obstack_type
*t
;
1506 rec
= read_2bytes (&(ieee
->h
));
1507 if (rec
!= (int) ieee_assign_value_to_variable_enum
)
1510 if (ieee
->element_count
>= alc_elts
)
1512 ieee_ar_obstack_type
*n
;
1515 n
= ((ieee_ar_obstack_type
*)
1516 bfd_realloc (elts
, alc_elts
* sizeof *elts
));
1522 t
= &elts
[ieee
->element_count
];
1523 ieee
->element_count
++;
1525 must_parse_int (&(ieee
->h
));
1526 t
->file_offset
= must_parse_int (&(ieee
->h
));
1527 t
->abfd
= (bfd
*) NULL
;
1529 /* Make sure that we don't go over the end of the buffer. */
1530 if ((size_t) ieee_pos (IEEE_DATA (abfd
)) > sizeof (buffer
) / 2)
1532 /* Past half way, reseek and reprime. */
1533 buffer_offset
+= ieee_pos (IEEE_DATA (abfd
));
1534 if (bfd_seek (abfd
, buffer_offset
, SEEK_SET
) != 0)
1537 /* Again ignore return value of bfd_bread. */
1538 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1539 ieee
->h
.first_byte
= buffer
;
1540 ieee
->h
.input_p
= buffer
;
1544 amt
= ieee
->element_count
;
1545 amt
*= sizeof *ieee
->elements
;
1546 ieee
->elements
= (ieee_ar_obstack_type
*) bfd_alloc (abfd
, amt
);
1547 if (ieee
->elements
== NULL
)
1550 memcpy (ieee
->elements
, elts
, (size_t) amt
);
1554 /* Now scan the area again, and replace BB offsets with file offsets. */
1555 for (i
= 2; i
< ieee
->element_count
; i
++)
1557 if (bfd_seek (abfd
, ieee
->elements
[i
].file_offset
, SEEK_SET
) != 0)
1560 /* Again ignore return value of bfd_bread. */
1561 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1562 ieee
->h
.first_byte
= buffer
;
1563 ieee
->h
.input_p
= buffer
;
1565 next_byte (&(ieee
->h
)); /* Drop F8. */
1566 next_byte (&(ieee
->h
)); /* Drop 14. */
1567 must_parse_int (&(ieee
->h
)); /* Drop size of block. */
1569 if (must_parse_int (&(ieee
->h
)) != 0)
1570 /* This object has been deleted. */
1571 ieee
->elements
[i
].file_offset
= 0;
1573 ieee
->elements
[i
].file_offset
= must_parse_int (&(ieee
->h
));
1576 /* abfd->has_armap = ;*/
1580 got_wrong_format_error
:
1581 bfd_set_error (bfd_error_wrong_format
);
1585 bfd_release (abfd
, ieee
);
1587 abfd
->tdata
.ieee_ar_data
= save
;
1593 ieee_object_p (abfd
)
1598 ieee_data_type
*ieee
;
1599 unsigned char buffer
[300];
1600 ieee_data_type
*save
= IEEE_DATA (abfd
);
1603 abfd
->tdata
.ieee_data
= 0;
1604 ieee_mkobject (abfd
);
1606 ieee
= IEEE_DATA (abfd
);
1607 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
1609 /* Read the first few bytes in to see if it makes sense. Ignore
1610 bfd_bread return value; The file might be very small. */
1611 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1613 ieee
->h
.input_p
= buffer
;
1614 if (this_byte_and_next (&(ieee
->h
)) != Module_Beginning
)
1615 goto got_wrong_format
;
1617 ieee
->read_symbols
= FALSE
;
1618 ieee
->read_data
= FALSE
;
1619 ieee
->section_count
= 0;
1620 ieee
->external_symbol_max_index
= 0;
1621 ieee
->external_symbol_min_index
= IEEE_PUBLIC_BASE
;
1622 ieee
->external_reference_min_index
= IEEE_REFERENCE_BASE
;
1623 ieee
->external_reference_max_index
= 0;
1624 ieee
->h
.abfd
= abfd
;
1625 ieee
->section_table
= NULL
;
1626 ieee
->section_table_size
= 0;
1628 processor
= ieee
->mb
.processor
= read_id (&(ieee
->h
));
1629 if (strcmp (processor
, "LIBRARY") == 0)
1630 goto got_wrong_format
;
1631 ieee
->mb
.module_name
= read_id (&(ieee
->h
));
1632 if (abfd
->filename
== (const char *) NULL
)
1633 abfd
->filename
= ieee
->mb
.module_name
;
1635 /* Determine the architecture and machine type of the object file. */
1637 const bfd_arch_info_type
*arch
;
1640 /* IEEE does not specify the format of the processor identification
1641 string, so the compiler is free to put in it whatever it wants.
1642 We try here to recognize different processors belonging to the
1643 m68k family. Code for other processors can be added here. */
1644 if ((processor
[0] == '6') && (processor
[1] == '8'))
1646 if (processor
[2] == '3') /* 683xx integrated processors */
1648 switch (processor
[3])
1650 case '0': /* 68302, 68306, 68307 */
1651 case '2': /* 68322, 68328 */
1652 case '5': /* 68356 */
1653 strcpy (family
, "68000"); /* MC68000-based controllers */
1656 case '3': /* 68330, 68331, 68332, 68333,
1657 68334, 68335, 68336, 68338 */
1658 case '6': /* 68360 */
1659 case '7': /* 68376 */
1660 strcpy (family
, "68332"); /* CPU32 and CPU32+ */
1664 if (processor
[4] == '9') /* 68349 */
1665 strcpy (family
, "68030"); /* CPU030 */
1666 else /* 68340, 68341 */
1667 strcpy (family
, "68332"); /* CPU32 and CPU32+ */
1670 default: /* Does not exist yet */
1671 strcpy (family
, "68332"); /* Guess it will be CPU32 */
1674 else if (TOUPPER (processor
[3]) == 'F') /* 68F333 */
1675 strcpy (family
, "68332"); /* CPU32 */
1676 else if ((TOUPPER (processor
[3]) == 'C') /* Embedded controllers. */
1677 && ((TOUPPER (processor
[2]) == 'E')
1678 || (TOUPPER (processor
[2]) == 'H')
1679 || (TOUPPER (processor
[2]) == 'L')))
1681 strcpy (family
, "68");
1682 strncat (family
, processor
+ 4, 7);
1685 else /* "Regular" processors. */
1687 strncpy (family
, processor
, 9);
1691 else if ((strncmp (processor
, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
1692 || (strncmp (processor
, "CPU32", 5) == 0))
1693 strcpy (family
, "68332");
1696 strncpy (family
, processor
, 9);
1700 arch
= bfd_scan_arch (family
);
1702 goto got_wrong_format
;
1703 abfd
->arch_info
= arch
;
1706 if (this_byte (&(ieee
->h
)) != (int) ieee_address_descriptor_enum
)
1709 next_byte (&(ieee
->h
));
1711 if (! parse_int (&(ieee
->h
), &ieee
->ad
.number_of_bits_mau
))
1714 if (! parse_int (&(ieee
->h
), &ieee
->ad
.number_of_maus_in_address
))
1717 /* If there is a byte order info, take it. */
1718 if (this_byte (&(ieee
->h
)) == (int) ieee_variable_L_enum
1719 || this_byte (&(ieee
->h
)) == (int) ieee_variable_M_enum
)
1720 next_byte (&(ieee
->h
));
1722 for (part
= 0; part
< N_W_VARIABLES
; part
++)
1726 if (read_2bytes (&(ieee
->h
)) != (int) ieee_assign_value_to_variable_enum
)
1729 if (this_byte_and_next (&(ieee
->h
)) != part
)
1732 ieee
->w
.offset
[part
] = parse_i (&(ieee
->h
), &ok
);
1737 if (ieee
->w
.r
.external_part
!= 0)
1738 abfd
->flags
= HAS_SYMS
;
1740 /* By now we know that this is a real IEEE file, we're going to read
1741 the whole thing into memory so that we can run up and down it
1742 quickly. We can work out how big the file is from the trailer
1745 amt
= ieee
->w
.r
.me_record
+ 1;
1746 IEEE_DATA (abfd
)->h
.first_byte
=
1747 (unsigned char *) bfd_alloc (ieee
->h
.abfd
, amt
);
1748 if (!IEEE_DATA (abfd
)->h
.first_byte
)
1750 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
1752 /* FIXME: Check return value. I'm not sure whether it needs to read
1753 the entire buffer or not. */
1754 bfd_bread ((PTR
) (IEEE_DATA (abfd
)->h
.first_byte
),
1755 (bfd_size_type
) ieee
->w
.r
.me_record
+ 1, abfd
);
1757 ieee_slurp_sections (abfd
);
1759 if (! ieee_slurp_debug (abfd
))
1762 /* Parse section data to activate file and section flags implied by
1763 section contents. */
1764 if (! ieee_slurp_section_data (abfd
))
1769 bfd_set_error (bfd_error_wrong_format
);
1771 bfd_release (abfd
, ieee
);
1772 abfd
->tdata
.ieee_data
= save
;
1773 return (const bfd_target
*) NULL
;
1777 ieee_get_symbol_info (ignore_abfd
, symbol
, ret
)
1778 bfd
*ignore_abfd ATTRIBUTE_UNUSED
;
1782 bfd_symbol_info (symbol
, ret
);
1783 if (symbol
->name
[0] == ' ')
1784 ret
->name
= "* empty table entry ";
1785 if (!symbol
->section
)
1786 ret
->type
= (symbol
->flags
& BSF_LOCAL
) ? 'a' : 'A';
1790 ieee_print_symbol (abfd
, afile
, symbol
, how
)
1794 bfd_print_symbol_type how
;
1796 FILE *file
= (FILE *) afile
;
1800 case bfd_print_symbol_name
:
1801 fprintf (file
, "%s", symbol
->name
);
1803 case bfd_print_symbol_more
:
1805 fprintf (file
, "%4x %2x", aout_symbol (symbol
)->desc
& 0xffff,
1806 aout_symbol (symbol
)->other
& 0xff);
1810 case bfd_print_symbol_all
:
1812 const char *section_name
=
1813 (symbol
->section
== (asection
*) NULL
1815 : symbol
->section
->name
);
1817 if (symbol
->name
[0] == ' ')
1819 fprintf (file
, "* empty table entry ");
1823 bfd_print_symbol_vandf (abfd
, (PTR
) file
, symbol
);
1825 fprintf (file
, " %-5s %04x %02x %s",
1827 (unsigned) ieee_symbol (symbol
)->index
,
1837 do_one (ieee
, current_map
, location_ptr
, s
, iterations
)
1838 ieee_data_type
*ieee
;
1839 ieee_per_section_type
*current_map
;
1840 unsigned char *location_ptr
;
1844 switch (this_byte (&(ieee
->h
)))
1846 case ieee_load_constant_bytes_enum
:
1848 unsigned int number_of_maus
;
1851 next_byte (&(ieee
->h
));
1852 number_of_maus
= must_parse_int (&(ieee
->h
));
1854 for (i
= 0; i
< number_of_maus
; i
++)
1856 location_ptr
[current_map
->pc
++] = this_byte (&(ieee
->h
));
1857 next_byte (&(ieee
->h
));
1862 case ieee_load_with_relocation_enum
:
1864 bfd_boolean loop
= TRUE
;
1866 next_byte (&(ieee
->h
));
1869 switch (this_byte (&(ieee
->h
)))
1871 case ieee_variable_R_enum
:
1873 case ieee_function_signed_open_b_enum
:
1874 case ieee_function_unsigned_open_b_enum
:
1875 case ieee_function_either_open_b_enum
:
1877 unsigned int extra
= 4;
1878 bfd_boolean pcrel
= FALSE
;
1881 bfd_size_type amt
= sizeof (ieee_reloc_type
);
1883 r
= (ieee_reloc_type
*) bfd_alloc (ieee
->h
.abfd
, amt
);
1887 *(current_map
->reloc_tail_ptr
) = r
;
1888 current_map
->reloc_tail_ptr
= &r
->next
;
1889 r
->next
= (ieee_reloc_type
*) NULL
;
1890 next_byte (&(ieee
->h
));
1892 r
->relent
.sym_ptr_ptr
= 0;
1893 parse_expression (ieee
,
1896 &pcrel
, &extra
, §ion
);
1897 r
->relent
.address
= current_map
->pc
;
1898 s
->flags
|= SEC_RELOC
;
1899 s
->owner
->flags
|= HAS_RELOC
;
1901 if (r
->relent
.sym_ptr_ptr
== NULL
&& section
!= NULL
)
1902 r
->relent
.sym_ptr_ptr
= section
->symbol_ptr_ptr
;
1904 if (this_byte (&(ieee
->h
)) == (int) ieee_comma
)
1906 next_byte (&(ieee
->h
));
1907 /* Fetch number of bytes to pad. */
1908 extra
= must_parse_int (&(ieee
->h
));
1911 switch (this_byte (&(ieee
->h
)))
1913 case ieee_function_signed_close_b_enum
:
1914 next_byte (&(ieee
->h
));
1916 case ieee_function_unsigned_close_b_enum
:
1917 next_byte (&(ieee
->h
));
1919 case ieee_function_either_close_b_enum
:
1920 next_byte (&(ieee
->h
));
1925 /* Build a relocation entry for this type. */
1926 /* If pc rel then stick -ve pc into instruction
1927 and take out of reloc ..
1929 I've changed this. It's all too complicated. I
1930 keep 0 in the instruction now. */
1939 #if KEEPMINUSPCININST
1940 bfd_put_32 (ieee
->h
.abfd
, -current_map
->pc
,
1941 location_ptr
+ current_map
->pc
);
1942 r
->relent
.howto
= &rel32_howto
;
1943 r
->relent
.addend
-= current_map
->pc
;
1945 bfd_put_32 (ieee
->h
.abfd
, (bfd_vma
) 0, location_ptr
+
1947 r
->relent
.howto
= &rel32_howto
;
1952 bfd_put_32 (ieee
->h
.abfd
, (bfd_vma
) 0,
1953 location_ptr
+ current_map
->pc
);
1954 r
->relent
.howto
= &abs32_howto
;
1956 current_map
->pc
+= 4;
1961 #if KEEPMINUSPCININST
1962 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) -current_map
->pc
,
1963 location_ptr
+ current_map
->pc
);
1964 r
->relent
.addend
-= current_map
->pc
;
1965 r
->relent
.howto
= &rel16_howto
;
1968 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) 0,
1969 location_ptr
+ current_map
->pc
);
1970 r
->relent
.howto
= &rel16_howto
;
1976 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) 0,
1977 location_ptr
+ current_map
->pc
);
1978 r
->relent
.howto
= &abs16_howto
;
1980 current_map
->pc
+= 2;
1985 #if KEEPMINUSPCININST
1986 bfd_put_8 (ieee
->h
.abfd
, (int) (-current_map
->pc
), location_ptr
+ current_map
->pc
);
1987 r
->relent
.addend
-= current_map
->pc
;
1988 r
->relent
.howto
= &rel8_howto
;
1990 bfd_put_8 (ieee
->h
.abfd
, 0, location_ptr
+ current_map
->pc
);
1991 r
->relent
.howto
= &rel8_howto
;
1996 bfd_put_8 (ieee
->h
.abfd
, 0, location_ptr
+ current_map
->pc
);
1997 r
->relent
.howto
= &abs8_howto
;
1999 current_map
->pc
+= 1;
2011 if (parse_int (&(ieee
->h
), &this_size
))
2014 for (i
= 0; i
< this_size
; i
++)
2016 location_ptr
[current_map
->pc
++] = this_byte (&(ieee
->h
));
2017 next_byte (&(ieee
->h
));
2027 /* Prevent more than the first load-item of an LR record
2028 from being repeated (MRI convention). */
2029 if (iterations
!= 1)
2037 /* Read in all the section data and relocation stuff too. */
2040 ieee_slurp_section_data (abfd
)
2043 bfd_byte
*location_ptr
= (bfd_byte
*) NULL
;
2044 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2045 unsigned int section_number
;
2047 ieee_per_section_type
*current_map
= (ieee_per_section_type
*) NULL
;
2049 /* Seek to the start of the data area. */
2050 if (ieee
->read_data
)
2052 ieee
->read_data
= TRUE
;
2053 ieee_seek (ieee
, ieee
->w
.r
.data_part
);
2055 /* Allocate enough space for all the section contents. */
2056 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
2058 ieee_per_section_type
*per
= ieee_per_section (s
);
2059 if ((s
->flags
& SEC_DEBUGGING
) != 0)
2061 per
->data
= (bfd_byte
*) bfd_alloc (ieee
->h
.abfd
, s
->size
);
2064 per
->reloc_tail_ptr
=
2065 (ieee_reloc_type
**) & (s
->relocation
);
2070 switch (this_byte (&(ieee
->h
)))
2072 /* IF we see anything strange then quit. */
2076 case ieee_set_current_section_enum
:
2077 next_byte (&(ieee
->h
));
2078 section_number
= must_parse_int (&(ieee
->h
));
2079 s
= ieee
->section_table
[section_number
];
2080 s
->flags
|= SEC_LOAD
| SEC_HAS_CONTENTS
;
2081 current_map
= ieee_per_section (s
);
2082 location_ptr
= current_map
->data
- s
->vma
;
2083 /* The document I have says that Microtec's compilers reset
2084 this after a sec section, even though the standard says not
2086 current_map
->pc
= s
->vma
;
2089 case ieee_e2_first_byte_enum
:
2090 next_byte (&(ieee
->h
));
2091 switch (this_byte (&(ieee
->h
)))
2093 case ieee_set_current_pc_enum
& 0xff:
2096 ieee_symbol_index_type symbol
;
2100 next_byte (&(ieee
->h
));
2101 must_parse_int (&(ieee
->h
)); /* Throw away section #. */
2102 parse_expression (ieee
, &value
,
2106 current_map
->pc
= value
;
2107 BFD_ASSERT ((unsigned) (value
- s
->vma
) <= s
->size
);
2111 case ieee_value_starting_address_enum
& 0xff:
2112 next_byte (&(ieee
->h
));
2113 if (this_byte (&(ieee
->h
)) == ieee_function_either_open_b_enum
)
2114 next_byte (&(ieee
->h
));
2115 abfd
->start_address
= must_parse_int (&(ieee
->h
));
2116 /* We've got to the end of the data now - */
2123 case ieee_repeat_data_enum
:
2125 /* Repeat the following LD or LR n times - we do this by
2126 remembering the stream pointer before running it and
2127 resetting it and running it n times. We special case
2128 the repetition of a repeat_data/load_constant. */
2129 unsigned int iterations
;
2130 unsigned char *start
;
2132 next_byte (&(ieee
->h
));
2133 iterations
= must_parse_int (&(ieee
->h
));
2134 start
= ieee
->h
.input_p
;
2135 if (start
[0] == (int) ieee_load_constant_bytes_enum
2138 while (iterations
!= 0)
2140 location_ptr
[current_map
->pc
++] = start
[2];
2143 next_byte (&(ieee
->h
));
2144 next_byte (&(ieee
->h
));
2145 next_byte (&(ieee
->h
));
2149 while (iterations
!= 0)
2151 ieee
->h
.input_p
= start
;
2152 if (!do_one (ieee
, current_map
, location_ptr
, s
,
2160 case ieee_load_constant_bytes_enum
:
2161 case ieee_load_with_relocation_enum
:
2162 if (!do_one (ieee
, current_map
, location_ptr
, s
, 1))
2169 ieee_new_section_hook (abfd
, newsect
)
2173 newsect
->used_by_bfd
2174 = (PTR
) bfd_alloc (abfd
, (bfd_size_type
) sizeof (ieee_per_section_type
));
2175 if (!newsect
->used_by_bfd
)
2177 ieee_per_section (newsect
)->data
= (bfd_byte
*) NULL
;
2178 ieee_per_section (newsect
)->section
= newsect
;
2183 ieee_get_reloc_upper_bound (abfd
, asect
)
2187 if ((asect
->flags
& SEC_DEBUGGING
) != 0)
2189 if (! ieee_slurp_section_data (abfd
))
2191 return (asect
->reloc_count
+ 1) * sizeof (arelent
*);
2195 ieee_get_section_contents (abfd
, section
, location
, offset
, count
)
2200 bfd_size_type count
;
2202 ieee_per_section_type
*p
= ieee_per_section (section
);
2203 if ((section
->flags
& SEC_DEBUGGING
) != 0)
2204 return _bfd_generic_get_section_contents (abfd
, section
, location
,
2206 ieee_slurp_section_data (abfd
);
2207 (void) memcpy ((PTR
) location
, (PTR
) (p
->data
+ offset
), (unsigned) count
);
2212 ieee_canonicalize_reloc (abfd
, section
, relptr
, symbols
)
2218 ieee_reloc_type
*src
= (ieee_reloc_type
*) (section
->relocation
);
2219 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2221 if ((section
->flags
& SEC_DEBUGGING
) != 0)
2224 while (src
!= (ieee_reloc_type
*) NULL
)
2226 /* Work out which symbol to attach it this reloc to. */
2227 switch (src
->symbol
.letter
)
2230 src
->relent
.sym_ptr_ptr
=
2231 symbols
+ src
->symbol
.index
+ ieee
->external_symbol_base_offset
;
2234 src
->relent
.sym_ptr_ptr
=
2235 symbols
+ src
->symbol
.index
+ ieee
->external_reference_base_offset
;
2238 if (src
->relent
.sym_ptr_ptr
!= NULL
)
2239 src
->relent
.sym_ptr_ptr
=
2240 src
->relent
.sym_ptr_ptr
[0]->section
->symbol_ptr_ptr
;
2246 *relptr
++ = &src
->relent
;
2249 *relptr
= (arelent
*) NULL
;
2250 return section
->reloc_count
;
2258 arelent
*a
= *((arelent
**) ap
);
2259 arelent
*b
= *((arelent
**) bp
);
2260 return a
->address
- b
->address
;
2263 /* Write the section headers. */
2266 ieee_write_section_part (abfd
)
2269 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2271 ieee
->w
.r
.section_part
= bfd_tell (abfd
);
2272 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
2274 if (! bfd_is_abs_section (s
)
2275 && (s
->flags
& SEC_DEBUGGING
) == 0)
2277 if (! ieee_write_byte (abfd
, ieee_section_type_enum
)
2278 || ! ieee_write_byte (abfd
,
2279 (bfd_byte
) (s
->index
2280 + IEEE_SECTION_NUMBER_BASE
)))
2283 if (abfd
->flags
& EXEC_P
)
2285 /* This image is executable, so output absolute sections. */
2286 if (! ieee_write_byte (abfd
, ieee_variable_A_enum
)
2287 || ! ieee_write_byte (abfd
, ieee_variable_S_enum
))
2292 if (! ieee_write_byte (abfd
, ieee_variable_C_enum
))
2296 switch (s
->flags
& (SEC_CODE
| SEC_DATA
| SEC_ROM
))
2298 case SEC_CODE
| SEC_LOAD
:
2300 if (! ieee_write_byte (abfd
, ieee_variable_P_enum
))
2305 if (! ieee_write_byte (abfd
, ieee_variable_D_enum
))
2309 case SEC_ROM
| SEC_DATA
:
2310 case SEC_ROM
| SEC_LOAD
:
2311 case SEC_ROM
| SEC_DATA
| SEC_LOAD
:
2312 if (! ieee_write_byte (abfd
, ieee_variable_R_enum
))
2317 if (! ieee_write_id (abfd
, s
->name
))
2320 ieee_write_int (abfd
, 0); /* Parent */
2321 ieee_write_int (abfd
, 0); /* Brother */
2322 ieee_write_int (abfd
, 0); /* Context */
2325 if (! ieee_write_byte (abfd
, ieee_section_alignment_enum
)
2326 || ! ieee_write_byte (abfd
,
2327 (bfd_byte
) (s
->index
2328 + IEEE_SECTION_NUMBER_BASE
))
2329 || ! ieee_write_int (abfd
, (bfd_vma
) 1 << s
->alignment_power
))
2333 if (! ieee_write_2bytes (abfd
, ieee_section_size_enum
)
2334 || ! ieee_write_byte (abfd
,
2335 (bfd_byte
) (s
->index
2336 + IEEE_SECTION_NUMBER_BASE
))
2337 || ! ieee_write_int (abfd
, s
->size
))
2339 if (abfd
->flags
& EXEC_P
)
2341 /* Relocateable sections don't have asl records. */
2343 if (! ieee_write_2bytes (abfd
, ieee_section_base_address_enum
)
2344 || ! ieee_write_byte (abfd
,
2347 + IEEE_SECTION_NUMBER_BASE
)))
2348 || ! ieee_write_int (abfd
, s
->lma
))
2359 do_with_relocs (abfd
, s
)
2363 unsigned int number_of_maus_in_address
=
2364 bfd_arch_bits_per_address (abfd
) / bfd_arch_bits_per_byte (abfd
);
2365 unsigned int relocs_to_go
= s
->reloc_count
;
2366 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2367 arelent
**p
= s
->orelocation
;
2368 bfd_size_type current_byte_index
= 0;
2370 qsort (s
->orelocation
,
2372 sizeof (arelent
**),
2375 /* Output the section preheader. */
2376 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2377 || ! ieee_write_byte (abfd
,
2378 (bfd_byte
) (s
->index
+ IEEE_SECTION_NUMBER_BASE
))
2379 || ! ieee_write_2bytes (abfd
, ieee_set_current_pc_enum
)
2380 || ! ieee_write_byte (abfd
,
2381 (bfd_byte
) (s
->index
+ IEEE_SECTION_NUMBER_BASE
)))
2384 if ((abfd
->flags
& EXEC_P
) != 0 && relocs_to_go
== 0)
2386 if (! ieee_write_int (abfd
, s
->lma
))
2391 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2395 if (relocs_to_go
== 0)
2397 /* If there aren't any relocations then output the load constant
2398 byte opcode rather than the load with relocation opcode. */
2399 while (current_byte_index
< s
->size
)
2402 unsigned int MAXRUN
= 127;
2405 if (run
> s
->size
- current_byte_index
)
2406 run
= s
->size
- current_byte_index
;
2410 if (! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
))
2412 /* Output a stream of bytes. */
2413 if (! ieee_write_int (abfd
, run
))
2415 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2418 current_byte_index
+= run
;
2424 if (! ieee_write_byte (abfd
, ieee_load_with_relocation_enum
))
2427 /* Output the data stream as the longest sequence of bytes
2428 possible, allowing for the a reasonable packet size and
2429 relocation stuffs. */
2431 if ((PTR
) stream
== (PTR
) NULL
)
2433 /* Outputting a section without data, fill it up. */
2434 stream
= (unsigned char *) bfd_zalloc (abfd
, s
->size
);
2438 while (current_byte_index
< s
->size
)
2441 unsigned int MAXRUN
= 127;
2445 run
= (*p
)->address
- current_byte_index
;
2452 if (run
> s
->size
- current_byte_index
)
2453 run
= s
->size
- current_byte_index
;
2457 /* Output a stream of bytes. */
2458 if (! ieee_write_int (abfd
, run
))
2460 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2463 current_byte_index
+= run
;
2466 /* Output any relocations here. */
2467 if (relocs_to_go
&& (*p
) && (*p
)->address
== current_byte_index
)
2470 && (*p
) && (*p
)->address
== current_byte_index
)
2475 if (r
->howto
->pc_relative
)
2476 r
->addend
+= current_byte_index
;
2478 switch (r
->howto
->size
)
2482 ov
= bfd_get_signed_32 (abfd
,
2483 stream
+ current_byte_index
);
2484 current_byte_index
+= 4;
2487 ov
= bfd_get_signed_16 (abfd
,
2488 stream
+ current_byte_index
);
2489 current_byte_index
+= 2;
2492 ov
= bfd_get_signed_8 (abfd
,
2493 stream
+ current_byte_index
);
2494 current_byte_index
++;
2502 ov
&= r
->howto
->src_mask
;
2504 if (r
->howto
->pc_relative
2505 && ! r
->howto
->pcrel_offset
)
2508 if (! ieee_write_byte (abfd
,
2509 ieee_function_either_open_b_enum
))
2514 if (r
->sym_ptr_ptr
!= (asymbol
**) NULL
)
2516 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2518 r
->howto
->pc_relative
,
2519 (unsigned) s
->index
))
2524 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2526 r
->howto
->pc_relative
,
2527 (unsigned) s
->index
))
2531 if (number_of_maus_in_address
2532 != bfd_get_reloc_size (r
->howto
))
2534 bfd_vma rsize
= bfd_get_reloc_size (r
->howto
);
2535 if (! ieee_write_int (abfd
, rsize
))
2538 if (! ieee_write_byte (abfd
,
2539 ieee_function_either_close_b_enum
))
2553 /* If there are no relocations in the output section then we can be
2554 clever about how we write. We block items up into a max of 127
2558 do_as_repeat (abfd
, s
)
2564 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2565 || ! ieee_write_byte (abfd
,
2566 (bfd_byte
) (s
->index
2567 + IEEE_SECTION_NUMBER_BASE
))
2568 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
>> 8)
2569 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
& 0xff)
2570 || ! ieee_write_byte (abfd
,
2571 (bfd_byte
) (s
->index
2572 + IEEE_SECTION_NUMBER_BASE
)))
2575 if ((abfd
->flags
& EXEC_P
) != 0)
2577 if (! ieee_write_int (abfd
, s
->lma
))
2582 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2586 if (! ieee_write_byte (abfd
, ieee_repeat_data_enum
)
2587 || ! ieee_write_int (abfd
, s
->size
)
2588 || ! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
)
2589 || ! ieee_write_byte (abfd
, 1)
2590 || ! ieee_write_byte (abfd
, 0))
2598 do_without_relocs (abfd
, s
)
2602 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2604 if (stream
== 0 || ((s
->flags
& SEC_LOAD
) == 0))
2606 if (! do_as_repeat (abfd
, s
))
2613 for (i
= 0; i
< s
->size
; i
++)
2617 if (! do_with_relocs (abfd
, s
))
2622 if (! do_as_repeat (abfd
, s
))
2630 static unsigned char *output_ptr_start
;
2631 static unsigned char *output_ptr
;
2632 static unsigned char *output_ptr_end
;
2633 static unsigned char *input_ptr_start
;
2634 static unsigned char *input_ptr
;
2635 static unsigned char *input_ptr_end
;
2636 static bfd
*input_bfd
;
2637 static bfd
*output_bfd
;
2638 static int output_buffer
;
2641 ieee_mkobject (abfd
)
2646 output_ptr_start
= NULL
;
2648 output_ptr_end
= NULL
;
2649 input_ptr_start
= NULL
;
2651 input_ptr_end
= NULL
;
2655 amt
= sizeof (ieee_data_type
);
2656 abfd
->tdata
.ieee_data
= (ieee_data_type
*) bfd_zalloc (abfd
, amt
);
2657 return abfd
->tdata
.ieee_data
!= NULL
;
2663 bfd_size_type amt
= input_ptr_end
- input_ptr_start
;
2664 /* FIXME: Check return value. I'm not sure whether it needs to read
2665 the entire buffer or not. */
2666 bfd_bread ((PTR
) input_ptr_start
, amt
, input_bfd
);
2667 input_ptr
= input_ptr_start
;
2673 bfd_size_type amt
= output_ptr
- output_ptr_start
;
2675 if (bfd_bwrite ((PTR
) (output_ptr_start
), amt
, output_bfd
) != amt
)
2677 output_ptr
= output_ptr_start
;
2681 #define THIS() ( *input_ptr )
2682 #define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
2683 #define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
2689 if (value
>= 0 && value
<= 127)
2695 unsigned int length
;
2696 /* How many significant bytes ? */
2697 /* FIXME FOR LONGER INTS. */
2698 if (value
& 0xff000000)
2700 else if (value
& 0x00ff0000)
2702 else if (value
& 0x0000ff00)
2707 OUT ((int) ieee_number_repeat_start_enum
+ length
);
2725 int length
= THIS ();
2738 #define VAR(x) ((x | 0x80))
2754 value
= (value
<< 8) | THIS ();
2756 value
= (value
<< 8) | THIS ();
2758 value
= (value
<< 8) | THIS ();
2766 value
= (value
<< 8) | THIS ();
2768 value
= (value
<< 8) | THIS ();
2776 value
= (value
<< 8) | THIS ();
2793 /* Not a number, just bug out with the answer. */
2794 write_int (*(--tos
));
2801 /* PLUS anything. */
2810 ieee_data_type
*ieee
;
2814 section_number
= THIS ();
2817 ieee
= IEEE_DATA (input_bfd
);
2818 s
= ieee
->section_table
[section_number
];
2820 if (s
->output_section
)
2821 value
= s
->output_section
->lma
;
2822 value
+= s
->output_offset
;
2829 write_int (*(--tos
));
2837 /* Drop the int in the buffer, and copy a null into the gap, which we
2838 will overwrite later */
2842 struct output_buffer_struct
*buf
;
2844 if (buf
->buffer
== output_buffer
)
2846 /* Still a chance to output the size. */
2847 int value
= output_ptr
- buf
->ptrp
+ 3;
2848 buf
->ptrp
[0] = value
>> 24;
2849 buf
->ptrp
[1] = value
>> 16;
2850 buf
->ptrp
[2] = value
>> 8;
2851 buf
->ptrp
[3] = value
>> 0;
2857 struct output_buffer_struct
*buf
;
2884 buf
->ptrp
= output_ptr
;
2885 buf
->buffer
= output_buffer
;
2925 #define ID copy_id()
2926 #define INT copy_int()
2927 #define EXP copy_expression()
2928 #define INTn(q) copy_int()
2929 #define EXPn(q) copy_expression()
2969 EXPn (instruction address
);
3003 EXPn (external function
);
3013 INTn (locked
register);
3035 /* Attribute record. */
3105 /* Unique typedefs for module. */
3106 /* GLobal typedefs. */
3107 /* High level module scope beginning. */
3109 struct output_buffer_struct ob
;
3125 /* Global function. */
3127 struct output_buffer_struct ob
;
3142 EXPn (size of block
);
3148 /* File name for source line numbers. */
3150 struct output_buffer_struct ob
;
3171 /* Local function. */
3173 struct output_buffer_struct ob
;
3192 /* Assembler module scope beginning - */
3194 struct output_buffer_struct ob
;
3220 struct output_buffer_struct ob
;
3228 INTn (section index
);
3236 EXPn (Size in Maus
);
3290 /* Moves all the debug information from the source bfd to the output
3291 bfd, and relocates any expressions it finds. */
3294 relocate_debug (output
, input
)
3295 bfd
*output ATTRIBUTE_UNUSED
;
3300 unsigned char input_buffer
[IBS
];
3302 input_ptr_start
= input_ptr
= input_buffer
;
3303 input_ptr_end
= input_buffer
+ IBS
;
3305 /* FIXME: Check return value. I'm not sure whether it needs to read
3306 the entire buffer or not. */
3307 bfd_bread ((PTR
) input_ptr_start
, (bfd_size_type
) IBS
, input
);
3311 /* Gather together all the debug information from each input BFD into
3312 one place, relocating it and emitting it as we go. */
3315 ieee_write_debug_part (abfd
)
3318 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3319 bfd_chain_type
*chain
= ieee
->chain_root
;
3320 unsigned char obuff
[OBS
];
3321 bfd_boolean some_debug
= FALSE
;
3322 file_ptr here
= bfd_tell (abfd
);
3324 output_ptr_start
= output_ptr
= obuff
;
3325 output_ptr_end
= obuff
+ OBS
;
3329 if (chain
== (bfd_chain_type
*) NULL
)
3333 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
3334 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3338 ieee
->w
.r
.debug_information_part
= 0;
3342 ieee
->w
.r
.debug_information_part
= here
;
3343 if (bfd_bwrite (s
->contents
, s
->size
, abfd
) != s
->size
)
3348 while (chain
!= (bfd_chain_type
*) NULL
)
3350 bfd
*entry
= chain
->this;
3351 ieee_data_type
*entry_ieee
= IEEE_DATA (entry
);
3353 if (entry_ieee
->w
.r
.debug_information_part
)
3355 if (bfd_seek (entry
, entry_ieee
->w
.r
.debug_information_part
,
3358 relocate_debug (abfd
, entry
);
3361 chain
= chain
->next
;
3365 ieee
->w
.r
.debug_information_part
= here
;
3367 ieee
->w
.r
.debug_information_part
= 0;
3375 /* Write the data in an ieee way. */
3378 ieee_write_data_part (abfd
)
3383 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3384 ieee
->w
.r
.data_part
= bfd_tell (abfd
);
3386 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3388 /* Skip sections that have no loadable contents (.bss,
3390 if ((s
->flags
& SEC_LOAD
) == 0)
3393 /* Sort the reloc records so we can insert them in the correct
3395 if (s
->reloc_count
!= 0)
3397 if (! do_with_relocs (abfd
, s
))
3402 if (! do_without_relocs (abfd
, s
))
3412 init_for_output (abfd
)
3417 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3419 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3423 bfd_size_type size
= s
->size
;
3424 ieee_per_section (s
)->data
= (bfd_byte
*) (bfd_alloc (abfd
, size
));
3425 if (!ieee_per_section (s
)->data
)
3432 /* Exec and core file sections. */
3434 /* Set section contents is complicated with IEEE since the format is
3435 not a byte image, but a record stream. */
3438 ieee_set_section_contents (abfd
, section
, location
, offset
, count
)
3443 bfd_size_type count
;
3445 if ((section
->flags
& SEC_DEBUGGING
) != 0)
3447 if (section
->contents
== NULL
)
3449 bfd_size_type size
= section
->size
;
3450 section
->contents
= (unsigned char *) bfd_alloc (abfd
, size
);
3451 if (section
->contents
== NULL
)
3454 /* bfd_set_section_contents has already checked that everything
3456 memcpy (section
->contents
+ offset
, location
, (size_t) count
);
3460 if (ieee_per_section (section
)->data
== (bfd_byte
*) NULL
)
3462 if (!init_for_output (abfd
))
3465 memcpy ((PTR
) (ieee_per_section (section
)->data
+ offset
),
3467 (unsigned int) count
);
3471 /* Write the external symbols of a file. IEEE considers two sorts of
3472 external symbols, public, and referenced. It uses to internal
3473 forms to index them as well. When we write them out we turn their
3474 symbol values into indexes from the right base. */
3477 ieee_write_external_part (abfd
)
3481 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3482 unsigned int reference_index
= IEEE_REFERENCE_BASE
;
3483 unsigned int public_index
= IEEE_PUBLIC_BASE
+ 2;
3484 file_ptr here
= bfd_tell (abfd
);
3485 bfd_boolean hadone
= FALSE
;
3487 if (abfd
->outsymbols
!= (asymbol
**) NULL
)
3490 for (q
= abfd
->outsymbols
; *q
!= (asymbol
*) NULL
; q
++)
3494 if (bfd_is_und_section (p
->section
))
3496 /* This must be a symbol reference. */
3497 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3498 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3499 || ! ieee_write_id (abfd
, p
->name
))
3501 p
->value
= reference_index
;
3505 else if (bfd_is_com_section (p
->section
))
3507 /* This is a weak reference. */
3508 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3509 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3510 || ! ieee_write_id (abfd
, p
->name
)
3511 || ! ieee_write_byte (abfd
,
3512 ieee_weak_external_reference_enum
)
3513 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3514 || ! ieee_write_int (abfd
, p
->value
))
3516 p
->value
= reference_index
;
3520 else if (p
->flags
& BSF_GLOBAL
)
3522 /* This must be a symbol definition. */
3523 if (! ieee_write_byte (abfd
, ieee_external_symbol_enum
)
3524 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3525 || ! ieee_write_id (abfd
, p
->name
)
3526 || ! ieee_write_2bytes (abfd
, ieee_attribute_record_enum
)
3527 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3528 || ! ieee_write_byte (abfd
, 15) /* instruction address */
3529 || ! ieee_write_byte (abfd
, 19) /* static symbol */
3530 || ! ieee_write_byte (abfd
, 1)) /* one of them */
3533 /* Write out the value. */
3534 if (! ieee_write_2bytes (abfd
, ieee_value_record_enum
)
3535 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
))
3537 if (! bfd_is_abs_section (p
->section
))
3539 if (abfd
->flags
& EXEC_P
)
3541 /* If fully linked, then output all symbols
3543 if (! (ieee_write_int
3546 + p
->section
->output_offset
3547 + p
->section
->output_section
->vma
))))
3552 if (! (ieee_write_expression
3554 p
->value
+ p
->section
->output_offset
,
3555 p
->section
->output_section
->symbol
,
3562 if (! ieee_write_expression (abfd
,
3564 bfd_abs_section_ptr
->symbol
,
3568 p
->value
= public_index
;
3574 /* This can happen - when there are gaps in the symbols read
3575 from an input ieee file. */
3580 ieee
->w
.r
.external_part
= here
;
3586 static const unsigned char exten
[] =
3589 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3. */
3590 0xf1, 0xce, 0x20, 0x00, 39, 2, /* Keep symbol in original case. */
3591 0xf1, 0xce, 0x20, 0x00, 38 /* Set object type relocatable to x. */
3594 static const unsigned char envi
[] =
3598 /* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
3601 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
3603 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
3604 /* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
3608 ieee_write_me_part (abfd
)
3611 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3612 ieee
->w
.r
.trailer_part
= bfd_tell (abfd
);
3613 if (abfd
->start_address
)
3615 if (! ieee_write_2bytes (abfd
, ieee_value_starting_address_enum
)
3616 || ! ieee_write_byte (abfd
, ieee_function_either_open_b_enum
)
3617 || ! ieee_write_int (abfd
, abfd
->start_address
)
3618 || ! ieee_write_byte (abfd
, ieee_function_either_close_b_enum
))
3621 ieee
->w
.r
.me_record
= bfd_tell (abfd
);
3622 if (! ieee_write_byte (abfd
, ieee_module_end_enum
))
3627 /* Write out the IEEE processor ID. */
3630 ieee_write_processor (abfd
)
3633 const bfd_arch_info_type
*arch
;
3635 arch
= bfd_get_arch_info (abfd
);
3639 if (! ieee_write_id (abfd
, bfd_printable_name (abfd
)))
3644 if (! ieee_write_id (abfd
, "29000"))
3648 case bfd_arch_h8300
:
3649 if (! ieee_write_id (abfd
, "H8/300"))
3653 case bfd_arch_h8500
:
3654 if (! ieee_write_id (abfd
, "H8/500"))
3662 case bfd_mach_i960_core
:
3663 case bfd_mach_i960_ka_sa
:
3664 if (! ieee_write_id (abfd
, "80960KA"))
3668 case bfd_mach_i960_kb_sb
:
3669 if (! ieee_write_id (abfd
, "80960KB"))
3673 case bfd_mach_i960_ca
:
3674 if (! ieee_write_id (abfd
, "80960CA"))
3678 case bfd_mach_i960_mc
:
3679 case bfd_mach_i960_xa
:
3680 if (! ieee_write_id (abfd
, "80960MC"))
3692 default: id
= "68020"; break;
3693 case bfd_mach_m68000
: id
= "68000"; break;
3694 case bfd_mach_m68008
: id
= "68008"; break;
3695 case bfd_mach_m68010
: id
= "68010"; break;
3696 case bfd_mach_m68020
: id
= "68020"; break;
3697 case bfd_mach_m68030
: id
= "68030"; break;
3698 case bfd_mach_m68040
: id
= "68040"; break;
3699 case bfd_mach_m68060
: id
= "68060"; break;
3700 case bfd_mach_cpu32
: id
= "cpu32"; break;
3701 case bfd_mach_mcf5200
:id
= "5200"; break;
3702 case bfd_mach_mcf5206e
:id
= "5206e"; break;
3703 case bfd_mach_mcf5307
:id
= "5307"; break;
3704 case bfd_mach_mcf5407
:id
= "5407"; break;
3705 case bfd_mach_mcf528x
:id
= "5282"; break;
3708 if (! ieee_write_id (abfd
, id
))
3718 ieee_write_object_contents (abfd
)
3721 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3725 /* Fast forward over the header area. */
3726 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
3729 if (! ieee_write_byte (abfd
, ieee_module_beginning_enum
)
3730 || ! ieee_write_processor (abfd
)
3731 || ! ieee_write_id (abfd
, abfd
->filename
))
3734 /* Fast forward over the variable bits. */
3735 if (! ieee_write_byte (abfd
, ieee_address_descriptor_enum
))
3739 if (! ieee_write_byte (abfd
, (bfd_byte
) (bfd_arch_bits_per_byte (abfd
))))
3741 /* MAU's per address. */
3742 if (! ieee_write_byte (abfd
,
3743 (bfd_byte
) (bfd_arch_bits_per_address (abfd
)
3744 / bfd_arch_bits_per_byte (abfd
))))
3747 old
= bfd_tell (abfd
);
3748 if (bfd_seek (abfd
, (file_ptr
) (8 * N_W_VARIABLES
), SEEK_CUR
) != 0)
3751 ieee
->w
.r
.extension_record
= bfd_tell (abfd
);
3752 if (bfd_bwrite ((char *) exten
, (bfd_size_type
) sizeof (exten
), abfd
)
3755 if (abfd
->flags
& EXEC_P
)
3757 if (! ieee_write_byte (abfd
, 0x1)) /* Absolute */
3762 if (! ieee_write_byte (abfd
, 0x2)) /* Relocateable */
3766 ieee
->w
.r
.environmental_record
= bfd_tell (abfd
);
3767 if (bfd_bwrite ((char *) envi
, (bfd_size_type
) sizeof (envi
), abfd
)
3771 /* The HP emulator database requires a timestamp in the file. */
3777 t
= (struct tm
*) localtime (&now
);
3778 if (! ieee_write_2bytes (abfd
, (int) ieee_atn_record_enum
)
3779 || ! ieee_write_byte (abfd
, 0x21)
3780 || ! ieee_write_byte (abfd
, 0)
3781 || ! ieee_write_byte (abfd
, 50)
3782 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_year
+ 1900))
3783 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_mon
+ 1))
3784 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_mday
)
3785 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_hour
)
3786 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_min
)
3787 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_sec
))
3795 if (! ieee_write_section_part (abfd
))
3797 /* First write the symbols. This changes their values into table
3798 indeces so we cant use it after this point. */
3799 if (! ieee_write_external_part (abfd
))
3802 /* Write any debugs we have been told about. */
3803 if (! ieee_write_debug_part (abfd
))
3806 /* Can only write the data once the symbols have been written, since
3807 the data contains relocation information which points to the
3809 if (! ieee_write_data_part (abfd
))
3812 /* At the end we put the end! */
3813 if (! ieee_write_me_part (abfd
))
3816 /* Generate the header. */
3817 if (bfd_seek (abfd
, old
, SEEK_SET
) != 0)
3820 for (i
= 0; i
< N_W_VARIABLES
; i
++)
3822 if (! ieee_write_2bytes (abfd
, ieee_assign_value_to_variable_enum
)
3823 || ! ieee_write_byte (abfd
, (bfd_byte
) i
)
3824 || ! ieee_write_int5_out (abfd
, (bfd_vma
) ieee
->w
.offset
[i
]))
3831 /* Native-level interface to symbols. */
3833 /* We read the symbols into a buffer, which is discarded when this
3834 function exits. We read the strings into a buffer large enough to
3835 hold them all plus all the cached symbol entries. */
3838 ieee_make_empty_symbol (abfd
)
3841 bfd_size_type amt
= sizeof (ieee_symbol_type
);
3842 ieee_symbol_type
*new = (ieee_symbol_type
*) bfd_zalloc (abfd
, amt
);
3846 new->symbol
.the_bfd
= abfd
;
3847 return &new->symbol
;
3851 ieee_openr_next_archived_file (arch
, prev
)
3855 ieee_ar_data_type
*ar
= IEEE_AR_DATA (arch
);
3857 /* Take the next one from the arch state, or reset. */
3858 if (prev
== (bfd
*) NULL
)
3859 /* Reset the index - the first two entries are bogus. */
3860 ar
->element_index
= 2;
3864 ieee_ar_obstack_type
*p
= ar
->elements
+ ar
->element_index
;
3866 ar
->element_index
++;
3867 if (ar
->element_index
<= ar
->element_count
)
3869 if (p
->file_offset
!= (file_ptr
) 0)
3871 if (p
->abfd
== (bfd
*) NULL
)
3873 p
->abfd
= _bfd_create_empty_archive_element_shell (arch
);
3874 p
->abfd
->origin
= p
->file_offset
;
3881 bfd_set_error (bfd_error_no_more_archived_files
);
3882 return (bfd
*) NULL
;
3888 ieee_find_nearest_line (abfd
, section
, symbols
, offset
, filename_ptr
,
3889 functionname_ptr
, line_ptr
)
3890 bfd
*abfd ATTRIBUTE_UNUSED
;
3891 asection
*section ATTRIBUTE_UNUSED
;
3892 asymbol
**symbols ATTRIBUTE_UNUSED
;
3893 bfd_vma offset ATTRIBUTE_UNUSED
;
3894 const char **filename_ptr ATTRIBUTE_UNUSED
;
3895 const char **functionname_ptr ATTRIBUTE_UNUSED
;
3896 unsigned int *line_ptr ATTRIBUTE_UNUSED
;
3902 ieee_generic_stat_arch_elt (abfd
, buf
)
3906 ieee_ar_data_type
*ar
= (ieee_ar_data_type
*) NULL
;
3907 ieee_data_type
*ieee
;
3909 if (abfd
->my_archive
!= NULL
)
3910 ar
= abfd
->my_archive
->tdata
.ieee_ar_data
;
3911 if (ar
== (ieee_ar_data_type
*) NULL
)
3913 bfd_set_error (bfd_error_invalid_operation
);
3917 if (IEEE_DATA (abfd
) == NULL
)
3919 if (ieee_object_p (abfd
) == NULL
)
3921 bfd_set_error (bfd_error_wrong_format
);
3926 ieee
= IEEE_DATA (abfd
);
3928 buf
->st_size
= ieee
->w
.r
.me_record
+ 1;
3929 buf
->st_mode
= 0644;
3934 ieee_sizeof_headers (abfd
, x
)
3935 bfd
*abfd ATTRIBUTE_UNUSED
;
3936 bfd_boolean x ATTRIBUTE_UNUSED
;
3942 /* The debug info routines are never used. */
3946 ieee_bfd_debug_info_start (abfd
)
3953 ieee_bfd_debug_info_end (abfd
)
3960 /* Add this section to the list of sections we have debug info for, to
3961 be ready to output it at close time. */
3963 ieee_bfd_debug_info_accumulate (abfd
, section
)
3967 ieee_data_type
*ieee
= IEEE_DATA (section
->owner
);
3968 ieee_data_type
*output_ieee
= IEEE_DATA (abfd
);
3970 /* Can only accumulate data from other ieee bfds. */
3971 if (section
->owner
->xvec
!= abfd
->xvec
)
3973 /* Only bother once per bfd. */
3974 if (ieee
->done_debug
)
3976 ieee
->done_debug
= TRUE
;
3978 /* Don't bother if there is no debug info. */
3979 if (ieee
->w
.r
.debug_information_part
== 0)
3984 bfd_size_type amt
= sizeof (bfd_chain_type
);
3985 bfd_chain_type
*n
= (bfd_chain_type
*) bfd_alloc (abfd
, amt
);
3988 abort (); /* FIXME */
3989 n
->this = section
->owner
;
3990 n
->next
= (bfd_chain_type
*) NULL
;
3992 if (output_ieee
->chain_head
)
3993 output_ieee
->chain_head
->next
= n
;
3995 output_ieee
->chain_root
= n
;
3997 output_ieee
->chain_head
= n
;
4003 #define ieee_close_and_cleanup _bfd_generic_close_and_cleanup
4004 #define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
4006 #define ieee_slurp_armap bfd_true
4007 #define ieee_slurp_extended_name_table bfd_true
4008 #define ieee_construct_extended_name_table \
4010 PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
4012 #define ieee_truncate_arname bfd_dont_truncate_arname
4013 #define ieee_write_armap \
4015 PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
4017 #define ieee_read_ar_hdr bfd_nullvoidptr
4018 #define ieee_update_armap_timestamp bfd_true
4019 #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
4021 #define ieee_bfd_is_target_special_symbol \
4022 ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
4023 #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
4024 #define ieee_get_lineno _bfd_nosymbols_get_lineno
4025 #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
4026 #define ieee_read_minisymbols _bfd_generic_read_minisymbols
4027 #define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
4029 #define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
4031 #define ieee_set_arch_mach _bfd_generic_set_arch_mach
4033 #define ieee_get_section_contents_in_window \
4034 _bfd_generic_get_section_contents_in_window
4035 #define ieee_bfd_get_relocated_section_contents \
4036 bfd_generic_get_relocated_section_contents
4037 #define ieee_bfd_relax_section bfd_generic_relax_section
4038 #define ieee_bfd_gc_sections bfd_generic_gc_sections
4039 #define ieee_bfd_merge_sections bfd_generic_merge_sections
4040 #define ieee_bfd_is_group_section bfd_generic_is_group_section
4041 #define ieee_bfd_discard_group bfd_generic_discard_group
4042 #define ieee_section_already_linked \
4043 _bfd_generic_section_already_linked
4044 #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
4045 #define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
4046 #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
4047 #define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
4048 #define ieee_bfd_final_link _bfd_generic_final_link
4049 #define ieee_bfd_link_split_section _bfd_generic_link_split_section
4051 const bfd_target ieee_vec
=
4054 bfd_target_ieee_flavour
,
4055 BFD_ENDIAN_UNKNOWN
, /* target byte order */
4056 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
4057 (HAS_RELOC
| EXEC_P
| /* object flags */
4058 HAS_LINENO
| HAS_DEBUG
|
4059 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
4060 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
4061 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
4062 '_', /* leading underscore */
4063 ' ', /* ar_pad_char */
4064 16, /* ar_max_namelen */
4065 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4066 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4067 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
4068 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4069 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4070 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
4073 ieee_object_p
, /* bfd_check_format */
4080 _bfd_generic_mkarchive
,
4085 ieee_write_object_contents
,
4086 _bfd_write_archive_contents
,
4090 /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
4091 ieee_get_section_contents, ieee_get_section_contents_in_window */
4092 BFD_JUMP_TABLE_GENERIC (ieee
),
4094 BFD_JUMP_TABLE_COPY (_bfd_generic
),
4095 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
4097 /* ieee_slurp_armap, ieee_slurp_extended_name_table,
4098 ieee_construct_extended_name_table, ieee_truncate_arname,
4099 ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
4100 ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
4101 ieee_update_armap_timestamp */
4102 BFD_JUMP_TABLE_ARCHIVE (ieee
),
4104 /* ieee_get_symtab_upper_bound, ieee_canonicalize_symtab,
4105 ieee_make_empty_symbol, ieee_print_symbol, ieee_get_symbol_info,
4106 ieee_bfd_is_local_label_name, ieee_get_lineno,
4107 ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
4108 ieee_read_minisymbols, ieee_minisymbol_to_symbol */
4109 BFD_JUMP_TABLE_SYMBOLS (ieee
),
4111 /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
4112 ieee_bfd_reloc_type_lookup */
4113 BFD_JUMP_TABLE_RELOCS (ieee
),
4115 /* ieee_set_arch_mach, ieee_set_section_contents */
4116 BFD_JUMP_TABLE_WRITE (ieee
),
4118 /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
4119 ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
4120 _bfd_generic_link_hash_table_free,
4121 ieee_bfd_link_add_symbols, ieee_bfd_final_link,
4122 ieee_bfd_link_split_section, ieee_bfd_gc_sections,
4123 ieee_bfd_merge_sections */
4124 BFD_JUMP_TABLE_LINK (ieee
),
4126 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),