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
38 struct output_buffer_struct
44 static boolean ieee_write_byte
PARAMS ((bfd
*, int));
45 static boolean ieee_write_2bytes
PARAMS ((bfd
*, int));
46 static boolean ieee_write_int
PARAMS ((bfd
*, bfd_vma
));
47 static boolean ieee_write_id
PARAMS ((bfd
*, const char *));
48 static unsigned short read_2bytes
PARAMS ((common_header_type
*));
49 static void bfd_get_string
PARAMS ((common_header_type
*, char *, size_t));
50 static char *read_id
PARAMS ((common_header_type
*));
51 static boolean ieee_write_expression
52 PARAMS ((bfd
*, bfd_vma
, asymbol
*, boolean
, unsigned int));
53 static void ieee_write_int5
PARAMS ((bfd_byte
*, bfd_vma
));
54 static boolean ieee_write_int5_out
PARAMS ((bfd
*, bfd_vma
));
55 static boolean parse_int
PARAMS ((common_header_type
*, bfd_vma
*));
56 static int parse_i
PARAMS ((common_header_type
*, boolean
*));
57 static bfd_vma must_parse_int
PARAMS ((common_header_type
*));
58 static void parse_expression
59 PARAMS ((ieee_data_type
*, bfd_vma
*, ieee_symbol_index_type
*,
60 boolean
*, unsigned int *, asection
**));
61 static file_ptr ieee_part_after
PARAMS ((ieee_data_type
*, file_ptr
));
62 static ieee_symbol_type
*get_symbol
63 PARAMS ((bfd
*, ieee_data_type
*, ieee_symbol_type
*, unsigned int *,
64 ieee_symbol_type
***, unsigned int *, int));
65 static boolean ieee_slurp_external_symbols
PARAMS ((bfd
*));
66 static boolean ieee_slurp_symbol_table
PARAMS ((bfd
*));
67 static long ieee_get_symtab_upper_bound
PARAMS ((bfd
*));
68 static long ieee_get_symtab
PARAMS ((bfd
*, asymbol
**));
69 static asection
*get_section_entry
70 PARAMS ((bfd
*, ieee_data_type
*i
, unsigned int));
71 static void ieee_slurp_sections
PARAMS ((bfd
*));
72 static boolean ieee_slurp_debug
PARAMS ((bfd
*));
73 const bfd_target
*ieee_archive_p
PARAMS ((bfd
*));
74 const bfd_target
*ieee_object_p
PARAMS ((bfd
*));
75 static void ieee_get_symbol_info
PARAMS ((bfd
*, asymbol
*, symbol_info
*));
76 static void ieee_print_symbol
77 PARAMS ((bfd
*, PTR
, asymbol
*, bfd_print_symbol_type
));
79 PARAMS ((ieee_data_type
*, ieee_per_section_type
*, unsigned char *,
81 static boolean ieee_slurp_section_data
PARAMS ((bfd
*));
82 static boolean ieee_new_section_hook
PARAMS ((bfd
*, asection
*));
83 static long ieee_get_reloc_upper_bound
PARAMS ((bfd
*, sec_ptr
));
84 static boolean ieee_get_section_contents
85 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
86 static long ieee_canonicalize_reloc
87 PARAMS ((bfd
*, sec_ptr
, arelent
**, asymbol
**));
88 static int comp
PARAMS ((const PTR
, const PTR
));
89 static boolean ieee_write_section_part
PARAMS ((bfd
*));
90 static boolean do_with_relocs
PARAMS ((bfd
*, asection
*));
91 static boolean do_as_repeat
PARAMS ((bfd
*, asection
*));
92 static boolean do_without_relocs
PARAMS ((bfd
*, asection
*));
93 static boolean ieee_mkobject
PARAMS ((bfd
*));
94 static void fill
PARAMS ((void));
95 static void flush
PARAMS ((void));
96 static void write_int
PARAMS ((int));
97 static void copy_id
PARAMS ((void));
98 static void copy_expression
PARAMS ((void));
99 static void fill_int
PARAMS ((struct output_buffer_struct
*));
100 static void drop_int
PARAMS ((struct output_buffer_struct
*));
101 static void copy_int
PARAMS ((void));
102 static void f1_record
PARAMS ((void));
103 static void f0_record
PARAMS ((void));
104 static void copy_till_end
PARAMS ((void));
105 static void f2_record
PARAMS ((void));
106 static void f8_record
PARAMS ((void));
107 static void e2_record
PARAMS ((void));
108 static void block
PARAMS ((void));
109 static void relocate_debug
PARAMS ((bfd
*, bfd
*));
110 static boolean ieee_write_debug_part
PARAMS ((bfd
*));
111 static boolean ieee_write_data_part
PARAMS ((bfd
*));
112 static boolean init_for_output
PARAMS ((bfd
*));
113 static boolean ieee_set_section_contents
114 PARAMS ((bfd
*, sec_ptr
, PTR
, file_ptr
, bfd_size_type
));
115 static boolean ieee_write_external_part
PARAMS ((bfd
*));
116 static boolean ieee_write_me_part
PARAMS ((bfd
*));
117 static boolean ieee_write_processor
PARAMS ((bfd
*));
118 static boolean ieee_write_object_contents
PARAMS ((bfd
*));
119 static asymbol
*ieee_make_empty_symbol
PARAMS ((bfd
*));
120 static bfd
*ieee_openr_next_archived_file
PARAMS ((bfd
*, bfd
*));
121 static boolean ieee_find_nearest_line
122 PARAMS ((bfd
*, asection
*, asymbol
**, bfd_vma
, const char **,
123 const char **, unsigned int *));
124 static int ieee_generic_stat_arch_elt
PARAMS ((bfd
*, struct stat
*));
125 static int ieee_sizeof_headers
PARAMS ((bfd
*, boolean
));
127 /* Functions for writing to ieee files in the strange way that the
128 standard requires. */
131 ieee_write_byte (abfd
, barg
)
138 if (bfd_bwrite ((PTR
) &byte
, (bfd_size_type
) 1, abfd
) != 1)
144 ieee_write_2bytes (abfd
, bytes
)
150 buffer
[0] = bytes
>> 8;
151 buffer
[1] = bytes
& 0xff;
152 if (bfd_bwrite ((PTR
) buffer
, (bfd_size_type
) 2, abfd
) != 2)
158 ieee_write_int (abfd
, value
)
164 if (! ieee_write_byte (abfd
, (bfd_byte
) value
))
171 /* How many significant bytes ? */
172 /* FIXME FOR LONGER INTS */
173 if (value
& 0xff000000)
175 else if (value
& 0x00ff0000)
177 else if (value
& 0x0000ff00)
182 if (! ieee_write_byte (abfd
,
183 (bfd_byte
) ((int) ieee_number_repeat_start_enum
189 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 24)))
193 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 16)))
197 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
>> 8)))
201 if (! ieee_write_byte (abfd
, (bfd_byte
) (value
)))
210 ieee_write_id (abfd
, id
)
214 size_t length
= strlen (id
);
218 if (! ieee_write_byte (abfd
, (bfd_byte
) length
))
221 else if (length
< 255)
223 if (! ieee_write_byte (abfd
, ieee_extension_length_1_enum
)
224 || ! ieee_write_byte (abfd
, (bfd_byte
) length
))
227 else if (length
< 65535)
229 if (! ieee_write_byte (abfd
, ieee_extension_length_2_enum
)
230 || ! ieee_write_2bytes (abfd
, (int) length
))
235 (*_bfd_error_handler
)
236 (_("%s: string too long (%d chars, max 65535)"),
237 bfd_get_filename (abfd
), length
);
238 bfd_set_error (bfd_error_invalid_operation
);
242 if (bfd_bwrite ((PTR
) id
, (bfd_size_type
) length
, abfd
) != length
)
247 /***************************************************************************
248 Functions for reading from ieee files in the strange way that the
252 #define this_byte(ieee) *((ieee)->input_p)
253 #define next_byte(ieee) ((ieee)->input_p++)
254 #define this_byte_and_next(ieee) (*((ieee)->input_p++))
256 static unsigned short
258 common_header_type
*ieee
;
260 unsigned char c1
= this_byte_and_next (ieee
);
261 unsigned char c2
= this_byte_and_next (ieee
);
262 return (c1
<< 8) | c2
;
266 bfd_get_string (ieee
, string
, length
)
267 common_header_type
*ieee
;
272 for (i
= 0; i
< length
; i
++)
274 string
[i
] = this_byte_and_next (ieee
);
280 common_header_type
*ieee
;
284 length
= this_byte_and_next (ieee
);
287 /* Simple string of length 0 to 127 */
289 else if (length
== 0xde)
291 /* Length is next byte, allowing 0..255 */
292 length
= this_byte_and_next (ieee
);
294 else if (length
== 0xdf)
296 /* Length is next two bytes, allowing 0..65535 */
297 length
= this_byte_and_next (ieee
);
298 length
= (length
* 256) + this_byte_and_next (ieee
);
300 /* Buy memory and read string */
301 string
= bfd_alloc (ieee
->abfd
, (bfd_size_type
) length
+ 1);
304 bfd_get_string (ieee
, string
, length
);
310 ieee_write_expression (abfd
, value
, symbol
, pcrel
, index
)
317 unsigned int term_count
= 0;
321 if (! ieee_write_int (abfd
, value
))
326 if (bfd_is_com_section (symbol
->section
)
327 || bfd_is_und_section (symbol
->section
))
329 /* Def of a common symbol */
330 if (! ieee_write_byte (abfd
, ieee_variable_X_enum
)
331 || ! ieee_write_int (abfd
, symbol
->value
))
335 else if (! bfd_is_abs_section (symbol
->section
))
337 /* Ref to defined symbol - */
339 if (symbol
->flags
& BSF_GLOBAL
)
341 if (! ieee_write_byte (abfd
, ieee_variable_I_enum
)
342 || ! ieee_write_int (abfd
, symbol
->value
))
346 else if (symbol
->flags
& (BSF_LOCAL
| BSF_SECTION_SYM
))
348 /* This is a reference to a defined local symbol. We can
349 easily do a local as a section+offset. */
350 if (! ieee_write_byte (abfd
, ieee_variable_R_enum
)
351 || ! ieee_write_byte (abfd
,
352 (bfd_byte
) (symbol
->section
->index
353 + IEEE_SECTION_NUMBER_BASE
)))
356 if (symbol
->value
!= 0)
358 if (! ieee_write_int (abfd
, symbol
->value
))
365 (*_bfd_error_handler
)
366 (_("%s: unrecognized symbol `%s' flags 0x%x"),
367 bfd_get_filename (abfd
), bfd_asymbol_name (symbol
),
369 bfd_set_error (bfd_error_invalid_operation
);
376 /* subtract the pc from here by asking for PC of this section*/
377 if (! ieee_write_byte (abfd
, ieee_variable_P_enum
)
378 || ! ieee_write_byte (abfd
,
379 (bfd_byte
) (index
+ IEEE_SECTION_NUMBER_BASE
))
380 || ! ieee_write_byte (abfd
, ieee_function_minus_enum
))
384 /* Handle the degenerate case of a 0 address. */
387 if (! ieee_write_int (abfd
, (bfd_vma
) 0))
391 while (term_count
> 1)
393 if (! ieee_write_byte (abfd
, ieee_function_plus_enum
))
401 /*****************************************************************************/
404 writes any integer into the buffer supplied and always takes 5 bytes
407 ieee_write_int5 (buffer
, value
)
411 buffer
[0] = (bfd_byte
) ieee_number_repeat_4_enum
;
412 buffer
[1] = (value
>> 24) & 0xff;
413 buffer
[2] = (value
>> 16) & 0xff;
414 buffer
[3] = (value
>> 8) & 0xff;
415 buffer
[4] = (value
>> 0) & 0xff;
419 ieee_write_int5_out (abfd
, value
)
425 ieee_write_int5 (b
, value
);
426 if (bfd_bwrite ((PTR
) b
, (bfd_size_type
) 5, abfd
) != 5)
432 parse_int (ieee
, value_ptr
)
433 common_header_type
*ieee
;
436 int value
= this_byte (ieee
);
438 if (value
>= 0 && value
<= 127)
444 else if (value
>= 0x80 && value
<= 0x88)
446 unsigned int count
= value
& 0xf;
451 result
= (result
<< 8) | this_byte_and_next (ieee
);
462 common_header_type
*ieee
;
466 *ok
= parse_int (ieee
, &x
);
471 must_parse_int (ieee
)
472 common_header_type
*ieee
;
475 BFD_ASSERT (parse_int (ieee
, &result
) == true);
483 ieee_symbol_index_type symbol
;
487 #if KEEPMINUSPCININST
489 #define SRC_MASK(arg) arg
490 #define PCREL_OFFSET false
494 #define SRC_MASK(arg) 0
495 #define PCREL_OFFSET true
499 static reloc_howto_type abs32_howto
=
506 complain_overflow_bitfield
,
514 static reloc_howto_type abs16_howto
=
521 complain_overflow_bitfield
,
529 static reloc_howto_type abs8_howto
=
536 complain_overflow_bitfield
,
544 static reloc_howto_type rel32_howto
=
551 complain_overflow_signed
,
555 SRC_MASK (0xffffffff),
559 static reloc_howto_type rel16_howto
=
566 complain_overflow_signed
,
570 SRC_MASK (0x0000ffff),
574 static reloc_howto_type rel8_howto
=
581 complain_overflow_signed
,
585 SRC_MASK (0x000000ff),
589 static ieee_symbol_index_type NOSYMBOL
= {0, 0};
592 parse_expression (ieee
, value
, symbol
, pcrel
, extra
, section
)
593 ieee_data_type
*ieee
;
595 ieee_symbol_index_type
*symbol
;
608 ieee_value_type stack
[10];
610 /* The stack pointer always points to the next unused location */
611 #define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
612 #define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
613 ieee_value_type
*sp
= stack
;
616 while (loop
&& ieee
->h
.input_p
< ieee
->h
.last_byte
)
618 switch (this_byte (&(ieee
->h
)))
620 case ieee_variable_P_enum
:
621 /* P variable, current program counter for section n */
624 next_byte (&(ieee
->h
));
626 section_n
= must_parse_int (&(ieee
->h
));
627 PUSH (NOSYMBOL
, bfd_abs_section_ptr
, 0);
630 case ieee_variable_L_enum
:
631 /* L variable address of section N */
632 next_byte (&(ieee
->h
));
633 PUSH (NOSYMBOL
, ieee
->section_table
[must_parse_int (&(ieee
->h
))], 0);
635 case ieee_variable_R_enum
:
636 /* R variable, logical address of section module */
637 /* FIXME, this should be different to L */
638 next_byte (&(ieee
->h
));
639 PUSH (NOSYMBOL
, ieee
->section_table
[must_parse_int (&(ieee
->h
))], 0);
641 case ieee_variable_S_enum
:
642 /* S variable, size in MAUS of section module */
643 next_byte (&(ieee
->h
));
646 ieee
->section_table
[must_parse_int (&(ieee
->h
))]->_raw_size
);
648 case ieee_variable_I_enum
:
649 /* Push the address of variable n */
651 ieee_symbol_index_type sy
;
652 next_byte (&(ieee
->h
));
653 sy
.index
= (int) must_parse_int (&(ieee
->h
));
656 PUSH (sy
, bfd_abs_section_ptr
, 0);
659 case ieee_variable_X_enum
:
660 /* Push the address of external variable n */
662 ieee_symbol_index_type sy
;
663 next_byte (&(ieee
->h
));
664 sy
.index
= (int) (must_parse_int (&(ieee
->h
)));
667 PUSH (sy
, bfd_und_section_ptr
, 0);
670 case ieee_function_minus_enum
:
672 bfd_vma value1
, value2
;
673 asection
*section1
, *section_dummy
;
674 ieee_symbol_index_type sy
;
675 next_byte (&(ieee
->h
));
677 POP (sy
, section1
, value1
);
678 POP (sy
, section_dummy
, value2
);
679 PUSH (sy
, section1
? section1
: section_dummy
, value2
- value1
);
682 case ieee_function_plus_enum
:
684 bfd_vma value1
, value2
;
687 ieee_symbol_index_type sy1
;
688 ieee_symbol_index_type sy2
;
689 next_byte (&(ieee
->h
));
691 POP (sy1
, section1
, value1
);
692 POP (sy2
, section2
, value2
);
693 PUSH (sy1
.letter
? sy1
: sy2
,
694 bfd_is_abs_section (section1
) ? section2
: section1
,
701 BFD_ASSERT (this_byte (&(ieee
->h
)) < (int) ieee_variable_A_enum
702 || this_byte (&(ieee
->h
)) > (int) ieee_variable_Z_enum
);
703 if (parse_int (&(ieee
->h
), &va
))
705 PUSH (NOSYMBOL
, bfd_abs_section_ptr
, va
);
709 /* Thats all that we can understand. */
716 /* As far as I can see there is a bug in the Microtec IEEE output
717 which I'm using to scan, whereby the comma operator is omitted
718 sometimes in an expression, giving expressions with too many
719 terms. We can tell if that's the case by ensuring that
720 sp == stack here. If not, then we've pushed something too far,
721 so we keep adding. */
723 while (sp
!= stack
+ 1)
726 ieee_symbol_index_type sy1
;
727 POP (sy1
, section1
, *extra
);
730 POP (*symbol
, dummy
, *value
);
736 #define ieee_seek(ieee, offset) \
739 ieee->h.input_p = ieee->h.first_byte + offset; \
740 ieee->h.last_byte = (ieee->h.first_byte \
741 + ieee_part_after (ieee, offset)); \
745 #define ieee_pos(ieee) \
746 (ieee->h.input_p - ieee->h.first_byte)
748 /* Find the first part of the ieee file after HERE. */
751 ieee_part_after (ieee
, here
)
752 ieee_data_type
*ieee
;
756 file_ptr after
= ieee
->w
.r
.me_record
;
758 /* File parts can come in any order, except that module end is
759 guaranteed to be last (and the header first). */
760 for (part
= 0; part
< N_W_VARIABLES
; part
++)
761 if (ieee
->w
.offset
[part
] > here
&& after
> ieee
->w
.offset
[part
])
762 after
= ieee
->w
.offset
[part
];
767 static unsigned int last_index
;
768 static char last_type
; /* is the index for an X or a D */
770 static ieee_symbol_type
*
771 get_symbol (abfd
, ieee
, last_symbol
, symbol_count
, pptr
, max_index
, this_type
)
772 bfd
*abfd ATTRIBUTE_UNUSED
;
773 ieee_data_type
*ieee
;
774 ieee_symbol_type
*last_symbol
;
775 unsigned int *symbol_count
;
776 ieee_symbol_type
***pptr
;
777 unsigned int *max_index
;
780 /* Need a new symbol */
781 unsigned int new_index
= must_parse_int (&(ieee
->h
));
782 if (new_index
!= last_index
|| this_type
!= last_type
)
784 ieee_symbol_type
*new_symbol
;
785 bfd_size_type amt
= sizeof (ieee_symbol_type
);
787 new_symbol
= (ieee_symbol_type
*) bfd_alloc (ieee
->h
.abfd
, amt
);
791 new_symbol
->index
= new_index
;
792 last_index
= new_index
;
795 *pptr
= &new_symbol
->next
;
796 if (new_index
> *max_index
)
798 *max_index
= new_index
;
800 last_type
= this_type
;
801 new_symbol
->symbol
.section
= bfd_abs_section_ptr
;
808 ieee_slurp_external_symbols (abfd
)
811 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
812 file_ptr offset
= ieee
->w
.r
.external_part
;
814 ieee_symbol_type
**prev_symbols_ptr
= &ieee
->external_symbols
;
815 ieee_symbol_type
**prev_reference_ptr
= &ieee
->external_reference
;
816 ieee_symbol_type
*symbol
= (ieee_symbol_type
*) NULL
;
817 unsigned int symbol_count
= 0;
819 last_index
= 0xffffff;
820 ieee
->symbol_table_full
= true;
822 ieee_seek (ieee
, offset
);
826 switch (this_byte (&(ieee
->h
)))
829 next_byte (&(ieee
->h
));
831 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
833 &ieee
->external_symbol_max_index
, 'I');
837 symbol
->symbol
.the_bfd
= abfd
;
838 symbol
->symbol
.name
= read_id (&(ieee
->h
));
839 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
840 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
842 case ieee_external_symbol_enum
:
843 next_byte (&(ieee
->h
));
845 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
847 &ieee
->external_symbol_max_index
, 'D');
851 BFD_ASSERT (symbol
->index
>= ieee
->external_symbol_min_index
);
853 symbol
->symbol
.the_bfd
= abfd
;
854 symbol
->symbol
.name
= read_id (&(ieee
->h
));
855 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
856 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
858 case ieee_attribute_record_enum
>> 8:
860 unsigned int symbol_name_index
;
861 unsigned int symbol_type_index
;
862 unsigned int symbol_attribute_def
;
864 switch (read_2bytes (&ieee
->h
))
866 case ieee_attribute_record_enum
:
867 symbol_name_index
= must_parse_int (&(ieee
->h
));
868 symbol_type_index
= must_parse_int (&(ieee
->h
));
869 symbol_attribute_def
= must_parse_int (&(ieee
->h
));
870 switch (symbol_attribute_def
)
874 parse_int (&ieee
->h
, &value
);
877 (*_bfd_error_handler
)
878 (_("%s: unimplemented ATI record %u for symbol %u"),
879 bfd_get_filename (abfd
), symbol_attribute_def
,
881 bfd_set_error (bfd_error_bad_value
);
886 case ieee_external_reference_info_record_enum
:
887 /* Skip over ATX record. */
888 parse_int (&(ieee
->h
), &value
);
889 parse_int (&(ieee
->h
), &value
);
890 parse_int (&(ieee
->h
), &value
);
891 parse_int (&(ieee
->h
), &value
);
893 case ieee_atn_record_enum
:
894 /* We may get call optimization information here,
895 which we just ignore. The format is
896 {$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs} */
897 parse_int (&ieee
->h
, &value
);
898 parse_int (&ieee
->h
, &value
);
899 parse_int (&ieee
->h
, &value
);
902 (*_bfd_error_handler
)
903 (_("%s: unexpected ATN type %d in external part"),
904 bfd_get_filename (abfd
), (int) value
);
905 bfd_set_error (bfd_error_bad_value
);
908 parse_int (&ieee
->h
, &value
);
909 parse_int (&ieee
->h
, &value
);
916 switch (read_2bytes (&ieee
->h
))
918 case ieee_asn_record_enum
:
919 parse_int (&ieee
->h
, &val1
);
920 parse_int (&ieee
->h
, &val1
);
924 (*_bfd_error_handler
)
925 (_("%s: unexpected type after ATN"),
926 bfd_get_filename (abfd
));
927 bfd_set_error (bfd_error_bad_value
);
934 case ieee_value_record_enum
>> 8:
936 unsigned int symbol_name_index
;
937 ieee_symbol_index_type symbol_ignore
;
938 boolean pcrel_ignore
;
940 next_byte (&(ieee
->h
));
941 next_byte (&(ieee
->h
));
943 symbol_name_index
= must_parse_int (&(ieee
->h
));
944 parse_expression (ieee
,
945 &symbol
->symbol
.value
,
949 &symbol
->symbol
.section
);
951 /* Fully linked IEEE-695 files tend to give every symbol
952 an absolute value. Try to convert that back into a
953 section relative value. FIXME: This won't always to
955 if (bfd_is_abs_section (symbol
->symbol
.section
)
956 && (abfd
->flags
& HAS_RELOC
) == 0)
961 val
= symbol
->symbol
.value
;
962 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
964 if (val
>= s
->vma
&& val
< s
->vma
+ s
->_raw_size
)
966 symbol
->symbol
.section
= s
;
967 symbol
->symbol
.value
-= s
->vma
;
973 symbol
->symbol
.flags
= BSF_GLOBAL
| BSF_EXPORT
;
977 case ieee_weak_external_reference_enum
:
981 next_byte (&(ieee
->h
));
982 /* Throw away the external reference index */
983 (void) must_parse_int (&(ieee
->h
));
984 /* Fetch the default size if not resolved */
985 size
= must_parse_int (&(ieee
->h
));
986 /* Fetch the defautlt value if available */
987 if (parse_int (&(ieee
->h
), &value
) == false)
991 /* This turns into a common */
992 symbol
->symbol
.section
= bfd_com_section_ptr
;
993 symbol
->symbol
.value
= size
;
997 case ieee_external_reference_enum
:
998 next_byte (&(ieee
->h
));
1000 symbol
= get_symbol (abfd
, ieee
, symbol
, &symbol_count
,
1001 &prev_reference_ptr
,
1002 &ieee
->external_reference_max_index
, 'X');
1006 symbol
->symbol
.the_bfd
= abfd
;
1007 symbol
->symbol
.name
= read_id (&(ieee
->h
));
1008 symbol
->symbol
.udata
.p
= (PTR
) NULL
;
1009 symbol
->symbol
.section
= bfd_und_section_ptr
;
1010 symbol
->symbol
.value
= (bfd_vma
) 0;
1011 symbol
->symbol
.flags
= 0;
1013 BFD_ASSERT (symbol
->index
>= ieee
->external_reference_min_index
);
1021 if (ieee
->external_symbol_max_index
!= 0)
1023 ieee
->external_symbol_count
=
1024 ieee
->external_symbol_max_index
-
1025 ieee
->external_symbol_min_index
+ 1;
1029 ieee
->external_symbol_count
= 0;
1032 if (ieee
->external_reference_max_index
!= 0)
1034 ieee
->external_reference_count
=
1035 ieee
->external_reference_max_index
-
1036 ieee
->external_reference_min_index
+ 1;
1040 ieee
->external_reference_count
= 0;
1044 ieee
->external_reference_count
+ ieee
->external_symbol_count
;
1046 if (symbol_count
!= abfd
->symcount
)
1048 /* There are gaps in the table -- */
1049 ieee
->symbol_table_full
= false;
1052 *prev_symbols_ptr
= (ieee_symbol_type
*) NULL
;
1053 *prev_reference_ptr
= (ieee_symbol_type
*) NULL
;
1059 ieee_slurp_symbol_table (abfd
)
1062 if (IEEE_DATA (abfd
)->read_symbols
== false)
1064 if (! ieee_slurp_external_symbols (abfd
))
1066 IEEE_DATA (abfd
)->read_symbols
= true;
1072 ieee_get_symtab_upper_bound (abfd
)
1075 if (! ieee_slurp_symbol_table (abfd
))
1078 return (abfd
->symcount
!= 0) ?
1079 (abfd
->symcount
+ 1) * (sizeof (ieee_symbol_type
*)) : 0;
1083 Move from our internal lists to the canon table, and insert in
1087 extern const bfd_target ieee_vec
;
1090 ieee_get_symtab (abfd
, location
)
1094 ieee_symbol_type
*symp
;
1095 static bfd dummy_bfd
;
1096 static asymbol empty_symbol
=
1104 /* K&R compilers can't initialise unions. */
1111 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1112 dummy_bfd
.xvec
= &ieee_vec
;
1113 if (! ieee_slurp_symbol_table (abfd
))
1116 if (ieee
->symbol_table_full
== false)
1118 /* Arrgh - there are gaps in the table, run through and fill them */
1119 /* up with pointers to a null place */
1121 for (i
= 0; i
< abfd
->symcount
; i
++)
1123 location
[i
] = &empty_symbol
;
1127 ieee
->external_symbol_base_offset
= -ieee
->external_symbol_min_index
;
1128 for (symp
= IEEE_DATA (abfd
)->external_symbols
;
1129 symp
!= (ieee_symbol_type
*) NULL
;
1132 /* Place into table at correct index locations */
1133 location
[symp
->index
+ ieee
->external_symbol_base_offset
] = &symp
->symbol
;
1136 /* The external refs are indexed in a bit */
1137 ieee
->external_reference_base_offset
=
1138 -ieee
->external_reference_min_index
+ ieee
->external_symbol_count
;
1140 for (symp
= IEEE_DATA (abfd
)->external_reference
;
1141 symp
!= (ieee_symbol_type
*) NULL
;
1144 location
[symp
->index
+ ieee
->external_reference_base_offset
] =
1151 location
[abfd
->symcount
] = (asymbol
*) NULL
;
1153 return abfd
->symcount
;
1157 get_section_entry (abfd
, ieee
, index
)
1159 ieee_data_type
*ieee
;
1162 if (index
>= ieee
->section_table_size
)
1168 c
= ieee
->section_table_size
;
1175 amt
*= sizeof (asection
*);
1176 n
= (asection
**) bfd_realloc (ieee
->section_table
, amt
);
1180 for (i
= ieee
->section_table_size
; i
< c
; i
++)
1183 ieee
->section_table
= n
;
1184 ieee
->section_table_size
= c
;
1187 if (ieee
->section_table
[index
] == (asection
*) NULL
)
1189 char *tmp
= bfd_alloc (abfd
, (bfd_size_type
) 11);
1194 sprintf (tmp
, " fsec%4d", index
);
1195 section
= bfd_make_section (abfd
, tmp
);
1196 ieee
->section_table
[index
] = section
;
1197 section
->flags
= SEC_NO_FLAGS
;
1198 section
->target_index
= index
;
1199 ieee
->section_table
[index
] = section
;
1201 return ieee
->section_table
[index
];
1205 ieee_slurp_sections (abfd
)
1208 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1209 file_ptr offset
= ieee
->w
.r
.section_part
;
1214 bfd_byte section_type
[3];
1215 ieee_seek (ieee
, offset
);
1218 switch (this_byte (&(ieee
->h
)))
1220 case ieee_section_type_enum
:
1223 unsigned int section_index
;
1224 next_byte (&(ieee
->h
));
1225 section_index
= must_parse_int (&(ieee
->h
));
1227 section
= get_section_entry (abfd
, ieee
, section_index
);
1229 section_type
[0] = this_byte_and_next (&(ieee
->h
));
1231 /* Set minimal section attributes. Attributes are
1232 extended later, based on section contents. */
1234 switch (section_type
[0])
1237 /* Normal attributes for absolute sections */
1238 section_type
[1] = this_byte (&(ieee
->h
));
1239 section
->flags
= SEC_ALLOC
;
1240 switch (section_type
[1])
1242 case 0xD3: /* AS Absolute section attributes */
1243 next_byte (&(ieee
->h
));
1244 section_type
[2] = this_byte (&(ieee
->h
));
1245 switch (section_type
[2])
1249 next_byte (&(ieee
->h
));
1250 section
->flags
|= SEC_CODE
;
1254 next_byte (&(ieee
->h
));
1255 section
->flags
|= SEC_DATA
;
1258 next_byte (&(ieee
->h
));
1259 /* Normal rom data */
1260 section
->flags
|= SEC_ROM
| SEC_DATA
;
1267 case 0xC3: /* Named relocatable sections (type C) */
1268 section_type
[1] = this_byte (&(ieee
->h
));
1269 section
->flags
= SEC_ALLOC
;
1270 switch (section_type
[1])
1272 case 0xD0: /* Normal code (CP) */
1273 next_byte (&(ieee
->h
));
1274 section
->flags
|= SEC_CODE
;
1276 case 0xC4: /* Normal data (CD) */
1277 next_byte (&(ieee
->h
));
1278 section
->flags
|= SEC_DATA
;
1280 case 0xD2: /* Normal rom data (CR) */
1281 next_byte (&(ieee
->h
));
1282 section
->flags
|= SEC_ROM
| SEC_DATA
;
1289 /* Read section name, use it if non empty. */
1290 name
= read_id (&ieee
->h
);
1292 section
->name
= name
;
1294 /* Skip these fields, which we don't care about */
1296 bfd_vma parent
, brother
, context
;
1297 parse_int (&(ieee
->h
), &parent
);
1298 parse_int (&(ieee
->h
), &brother
);
1299 parse_int (&(ieee
->h
), &context
);
1303 case ieee_section_alignment_enum
:
1305 unsigned int section_index
;
1308 next_byte (&(ieee
->h
));
1309 section_index
= must_parse_int (&ieee
->h
);
1310 section
= get_section_entry (abfd
, ieee
, section_index
);
1311 if (section_index
> ieee
->section_count
)
1313 ieee
->section_count
= section_index
;
1315 section
->alignment_power
=
1316 bfd_log2 (must_parse_int (&ieee
->h
));
1317 (void) parse_int (&(ieee
->h
), &value
);
1320 case ieee_e2_first_byte_enum
:
1323 ieee_record_enum_type t
;
1325 t
= (ieee_record_enum_type
) (read_2bytes (&(ieee
->h
)));
1328 case ieee_section_size_enum
:
1329 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1330 section
->_raw_size
= must_parse_int (&(ieee
->h
));
1332 case ieee_physical_region_size_enum
:
1333 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1334 section
->_raw_size
= must_parse_int (&(ieee
->h
));
1336 case ieee_region_base_address_enum
:
1337 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1338 section
->vma
= must_parse_int (&(ieee
->h
));
1339 section
->lma
= section
->vma
;
1341 case ieee_mau_size_enum
:
1342 must_parse_int (&(ieee
->h
));
1343 must_parse_int (&(ieee
->h
));
1345 case ieee_m_value_enum
:
1346 must_parse_int (&(ieee
->h
));
1347 must_parse_int (&(ieee
->h
));
1349 case ieee_section_base_address_enum
:
1350 section
= ieee
->section_table
[must_parse_int (&(ieee
->h
))];
1351 section
->vma
= must_parse_int (&(ieee
->h
));
1352 section
->lma
= section
->vma
;
1354 case ieee_section_offset_enum
:
1355 (void) must_parse_int (&(ieee
->h
));
1356 (void) must_parse_int (&(ieee
->h
));
1370 /* Make a section for the debugging information, if any. We don't try
1371 to interpret the debugging information; we just point the section
1372 at the area in the file so that program which understand can dig it
1376 ieee_slurp_debug (abfd
)
1379 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
1383 if (ieee
->w
.r
.debug_information_part
== 0)
1386 sec
= bfd_make_section (abfd
, ".debug");
1389 sec
->flags
|= SEC_DEBUGGING
| SEC_HAS_CONTENTS
;
1390 sec
->filepos
= ieee
->w
.r
.debug_information_part
;
1392 debug_end
= ieee_part_after (ieee
, ieee
->w
.r
.debug_information_part
);
1393 sec
->_raw_size
= debug_end
- ieee
->w
.r
.debug_information_part
;
1398 /***********************************************************************
1403 ieee_archive_p (abfd
)
1408 unsigned char buffer
[512];
1409 file_ptr buffer_offset
= 0;
1410 ieee_ar_data_type
*save
= abfd
->tdata
.ieee_ar_data
;
1411 ieee_ar_data_type
*ieee
;
1412 bfd_size_type alc_elts
;
1413 ieee_ar_obstack_type
*elts
= NULL
;
1414 bfd_size_type amt
= sizeof (ieee_ar_data_type
);
1416 abfd
->tdata
.ieee_ar_data
= (ieee_ar_data_type
*) bfd_alloc (abfd
, amt
);
1417 if (!abfd
->tdata
.ieee_ar_data
)
1419 ieee
= IEEE_AR_DATA (abfd
);
1421 /* Ignore the return value here. It doesn't matter if we don't read
1422 the entire buffer. We might have a very small ieee file. */
1423 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1425 ieee
->h
.first_byte
= buffer
;
1426 ieee
->h
.input_p
= buffer
;
1428 ieee
->h
.abfd
= abfd
;
1430 if (this_byte (&(ieee
->h
)) != Module_Beginning
)
1431 goto got_wrong_format_error
;
1433 next_byte (&(ieee
->h
));
1434 library
= read_id (&(ieee
->h
));
1435 if (strcmp (library
, "LIBRARY") != 0)
1436 goto got_wrong_format_error
;
1438 /* Throw away the filename. */
1439 read_id (&(ieee
->h
));
1441 ieee
->element_count
= 0;
1442 ieee
->element_index
= 0;
1444 next_byte (&(ieee
->h
)); /* Drop the ad part. */
1445 must_parse_int (&(ieee
->h
)); /* And the two dummy numbers. */
1446 must_parse_int (&(ieee
->h
));
1449 elts
= (ieee_ar_obstack_type
*) bfd_malloc (alc_elts
* sizeof *elts
);
1453 /* Read the index of the BB table. */
1457 ieee_ar_obstack_type
*t
;
1459 rec
= read_2bytes (&(ieee
->h
));
1460 if (rec
!= (int) ieee_assign_value_to_variable_enum
)
1463 if (ieee
->element_count
>= alc_elts
)
1465 ieee_ar_obstack_type
*n
;
1468 n
= ((ieee_ar_obstack_type
*)
1469 bfd_realloc (elts
, alc_elts
* sizeof *elts
));
1475 t
= &elts
[ieee
->element_count
];
1476 ieee
->element_count
++;
1478 must_parse_int (&(ieee
->h
));
1479 t
->file_offset
= must_parse_int (&(ieee
->h
));
1480 t
->abfd
= (bfd
*) NULL
;
1482 /* Make sure that we don't go over the end of the buffer. */
1483 if ((size_t) ieee_pos (IEEE_DATA (abfd
)) > sizeof (buffer
) / 2)
1485 /* Past half way, reseek and reprime. */
1486 buffer_offset
+= ieee_pos (IEEE_DATA (abfd
));
1487 if (bfd_seek (abfd
, buffer_offset
, SEEK_SET
) != 0)
1490 /* Again ignore return value of bfd_bread. */
1491 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1492 ieee
->h
.first_byte
= buffer
;
1493 ieee
->h
.input_p
= buffer
;
1497 amt
= ieee
->element_count
;
1498 amt
*= sizeof *ieee
->elements
;
1499 ieee
->elements
= (ieee_ar_obstack_type
*) bfd_alloc (abfd
, amt
);
1500 if (ieee
->elements
== NULL
)
1503 memcpy (ieee
->elements
, elts
, (size_t) amt
);
1507 /* Now scan the area again, and replace BB offsets with file offsets. */
1508 for (i
= 2; i
< ieee
->element_count
; i
++)
1510 if (bfd_seek (abfd
, ieee
->elements
[i
].file_offset
, SEEK_SET
) != 0)
1513 /* Again ignore return value of bfd_bread. */
1514 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1515 ieee
->h
.first_byte
= buffer
;
1516 ieee
->h
.input_p
= buffer
;
1518 next_byte (&(ieee
->h
)); /* Drop F8. */
1519 next_byte (&(ieee
->h
)); /* Drop 14. */
1520 must_parse_int (&(ieee
->h
)); /* Drop size of block. */
1522 if (must_parse_int (&(ieee
->h
)) != 0)
1523 /* This object has been deleted. */
1524 ieee
->elements
[i
].file_offset
= 0;
1526 ieee
->elements
[i
].file_offset
= must_parse_int (&(ieee
->h
));
1529 /* abfd->has_armap = ;*/
1533 got_wrong_format_error
:
1534 bfd_release (abfd
, ieee
);
1535 abfd
->tdata
.ieee_ar_data
= save
;
1536 bfd_set_error (bfd_error_wrong_format
);
1546 ieee_object_p (abfd
)
1551 ieee_data_type
*ieee
;
1552 unsigned char buffer
[300];
1553 ieee_data_type
*save
= IEEE_DATA (abfd
);
1556 abfd
->tdata
.ieee_data
= 0;
1557 ieee_mkobject (abfd
);
1559 ieee
= IEEE_DATA (abfd
);
1560 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
1562 /* Read the first few bytes in to see if it makes sense. Ignore
1563 bfd_bread return value; The file might be very small. */
1564 bfd_bread ((PTR
) buffer
, (bfd_size_type
) sizeof (buffer
), abfd
);
1566 ieee
->h
.input_p
= buffer
;
1567 if (this_byte_and_next (&(ieee
->h
)) != Module_Beginning
)
1568 goto got_wrong_format
;
1570 ieee
->read_symbols
= false;
1571 ieee
->read_data
= false;
1572 ieee
->section_count
= 0;
1573 ieee
->external_symbol_max_index
= 0;
1574 ieee
->external_symbol_min_index
= IEEE_PUBLIC_BASE
;
1575 ieee
->external_reference_min_index
= IEEE_REFERENCE_BASE
;
1576 ieee
->external_reference_max_index
= 0;
1577 ieee
->h
.abfd
= abfd
;
1578 ieee
->section_table
= NULL
;
1579 ieee
->section_table_size
= 0;
1581 processor
= ieee
->mb
.processor
= read_id (&(ieee
->h
));
1582 if (strcmp (processor
, "LIBRARY") == 0)
1583 goto got_wrong_format
;
1584 ieee
->mb
.module_name
= read_id (&(ieee
->h
));
1585 if (abfd
->filename
== (const char *) NULL
)
1587 abfd
->filename
= ieee
->mb
.module_name
;
1589 /* Determine the architecture and machine type of the object file.
1592 const bfd_arch_info_type
*arch
;
1595 /* IEEE does not specify the format of the processor identificaton
1596 string, so the compiler is free to put in it whatever it wants.
1597 We try here to recognize different processors belonging to the
1598 m68k family. Code for other processors can be added here. */
1599 if ((processor
[0] == '6') && (processor
[1] == '8'))
1601 if (processor
[2] == '3') /* 683xx integrated processors */
1603 switch (processor
[3])
1605 case '0': /* 68302, 68306, 68307 */
1606 case '2': /* 68322, 68328 */
1607 case '5': /* 68356 */
1608 strcpy (family
, "68000"); /* MC68000-based controllers */
1611 case '3': /* 68330, 68331, 68332, 68333,
1612 68334, 68335, 68336, 68338 */
1613 case '6': /* 68360 */
1614 case '7': /* 68376 */
1615 strcpy (family
, "68332"); /* CPU32 and CPU32+ */
1619 if (processor
[4] == '9') /* 68349 */
1620 strcpy (family
, "68030"); /* CPU030 */
1621 else /* 68340, 68341 */
1622 strcpy (family
, "68332"); /* CPU32 and CPU32+ */
1625 default: /* Does not exist yet */
1626 strcpy (family
, "68332"); /* Guess it will be CPU32 */
1629 else if (toupper (processor
[3]) == 'F') /* 68F333 */
1630 strcpy (family
, "68332"); /* CPU32 */
1631 else if ((toupper (processor
[3]) == 'C') /* Embedded controllers */
1632 && ((toupper (processor
[2]) == 'E')
1633 || (toupper (processor
[2]) == 'H')
1634 || (toupper (processor
[2]) == 'L')))
1636 strcpy (family
, "68");
1637 strncat (family
, processor
+ 4, 7);
1640 else /* "Regular" processors */
1642 strncpy (family
, processor
, 9);
1646 else if ((strncmp (processor
, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
1647 || (strncmp (processor
, "CPU32", 5) == 0))
1648 strcpy (family
, "68332");
1651 strncpy (family
, processor
, 9);
1655 arch
= bfd_scan_arch (family
);
1657 goto got_wrong_format
;
1658 abfd
->arch_info
= arch
;
1661 if (this_byte (&(ieee
->h
)) != (int) ieee_address_descriptor_enum
)
1665 next_byte (&(ieee
->h
));
1667 if (parse_int (&(ieee
->h
), &ieee
->ad
.number_of_bits_mau
) == false)
1671 if (parse_int (&(ieee
->h
), &ieee
->ad
.number_of_maus_in_address
) == false)
1676 /* If there is a byte order info, take it */
1677 if (this_byte (&(ieee
->h
)) == (int) ieee_variable_L_enum
||
1678 this_byte (&(ieee
->h
)) == (int) ieee_variable_M_enum
)
1679 next_byte (&(ieee
->h
));
1681 for (part
= 0; part
< N_W_VARIABLES
; part
++)
1684 if (read_2bytes (&(ieee
->h
)) != (int) ieee_assign_value_to_variable_enum
)
1688 if (this_byte_and_next (&(ieee
->h
)) != part
)
1693 ieee
->w
.offset
[part
] = parse_i (&(ieee
->h
), &ok
);
1701 if (ieee
->w
.r
.external_part
!= 0)
1702 abfd
->flags
= HAS_SYMS
;
1704 /* By now we know that this is a real IEEE file, we're going to read
1705 the whole thing into memory so that we can run up and down it
1706 quickly. We can work out how big the file is from the trailer
1709 amt
= ieee
->w
.r
.me_record
+ 1;
1710 IEEE_DATA (abfd
)->h
.first_byte
=
1711 (unsigned char *) bfd_alloc (ieee
->h
.abfd
, amt
);
1712 if (!IEEE_DATA (abfd
)->h
.first_byte
)
1714 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
1716 /* FIXME: Check return value. I'm not sure whether it needs to read
1717 the entire buffer or not. */
1718 bfd_bread ((PTR
) (IEEE_DATA (abfd
)->h
.first_byte
),
1719 (bfd_size_type
) ieee
->w
.r
.me_record
+ 1, abfd
);
1721 ieee_slurp_sections (abfd
);
1723 if (! ieee_slurp_debug (abfd
))
1726 /* Parse section data to activate file and section flags implied by
1727 section contents. */
1729 if (! ieee_slurp_section_data (abfd
))
1734 bfd_set_error (bfd_error_wrong_format
);
1736 (void) bfd_release (abfd
, ieee
);
1737 abfd
->tdata
.ieee_data
= save
;
1738 return (const bfd_target
*) NULL
;
1742 ieee_get_symbol_info (ignore_abfd
, symbol
, ret
)
1743 bfd
*ignore_abfd ATTRIBUTE_UNUSED
;
1747 bfd_symbol_info (symbol
, ret
);
1748 if (symbol
->name
[0] == ' ')
1749 ret
->name
= "* empty table entry ";
1750 if (!symbol
->section
)
1751 ret
->type
= (symbol
->flags
& BSF_LOCAL
) ? 'a' : 'A';
1755 ieee_print_symbol (abfd
, afile
, symbol
, how
)
1759 bfd_print_symbol_type how
;
1761 FILE *file
= (FILE *) afile
;
1765 case bfd_print_symbol_name
:
1766 fprintf (file
, "%s", symbol
->name
);
1768 case bfd_print_symbol_more
:
1770 fprintf (file
, "%4x %2x", aout_symbol (symbol
)->desc
& 0xffff,
1771 aout_symbol (symbol
)->other
& 0xff);
1775 case bfd_print_symbol_all
:
1777 const char *section_name
=
1778 (symbol
->section
== (asection
*) NULL
1780 : symbol
->section
->name
);
1781 if (symbol
->name
[0] == ' ')
1783 fprintf (file
, "* empty table entry ");
1787 bfd_print_symbol_vandf (abfd
, (PTR
) file
, symbol
);
1789 fprintf (file
, " %-5s %04x %02x %s",
1791 (unsigned) ieee_symbol (symbol
)->index
,
1801 do_one (ieee
, current_map
, location_ptr
, s
, iterations
)
1802 ieee_data_type
*ieee
;
1803 ieee_per_section_type
*current_map
;
1804 unsigned char *location_ptr
;
1808 switch (this_byte (&(ieee
->h
)))
1810 case ieee_load_constant_bytes_enum
:
1812 unsigned int number_of_maus
;
1814 next_byte (&(ieee
->h
));
1815 number_of_maus
= must_parse_int (&(ieee
->h
));
1817 for (i
= 0; i
< number_of_maus
; i
++)
1819 location_ptr
[current_map
->pc
++] = this_byte (&(ieee
->h
));
1820 next_byte (&(ieee
->h
));
1825 case ieee_load_with_relocation_enum
:
1827 boolean loop
= true;
1828 next_byte (&(ieee
->h
));
1831 switch (this_byte (&(ieee
->h
)))
1833 case ieee_variable_R_enum
:
1835 case ieee_function_signed_open_b_enum
:
1836 case ieee_function_unsigned_open_b_enum
:
1837 case ieee_function_either_open_b_enum
:
1839 unsigned int extra
= 4;
1840 boolean pcrel
= false;
1843 bfd_size_type amt
= sizeof (ieee_reloc_type
);
1845 r
= (ieee_reloc_type
*) bfd_alloc (ieee
->h
.abfd
, amt
);
1849 *(current_map
->reloc_tail_ptr
) = r
;
1850 current_map
->reloc_tail_ptr
= &r
->next
;
1851 r
->next
= (ieee_reloc_type
*) NULL
;
1852 next_byte (&(ieee
->h
));
1854 r
->relent
.sym_ptr_ptr
= 0;
1855 parse_expression (ieee
,
1858 &pcrel
, &extra
, §ion
);
1859 r
->relent
.address
= current_map
->pc
;
1860 s
->flags
|= SEC_RELOC
;
1861 s
->owner
->flags
|= HAS_RELOC
;
1863 if (r
->relent
.sym_ptr_ptr
== NULL
&& section
!= NULL
)
1864 r
->relent
.sym_ptr_ptr
= section
->symbol_ptr_ptr
;
1866 if (this_byte (&(ieee
->h
)) == (int) ieee_comma
)
1868 next_byte (&(ieee
->h
));
1869 /* Fetch number of bytes to pad */
1870 extra
= must_parse_int (&(ieee
->h
));
1873 switch (this_byte (&(ieee
->h
)))
1875 case ieee_function_signed_close_b_enum
:
1876 next_byte (&(ieee
->h
));
1878 case ieee_function_unsigned_close_b_enum
:
1879 next_byte (&(ieee
->h
));
1881 case ieee_function_either_close_b_enum
:
1882 next_byte (&(ieee
->h
));
1887 /* Build a relocation entry for this type */
1888 /* If pc rel then stick -ve pc into instruction
1889 and take out of reloc ..
1891 I've changed this. It's all too complicated. I
1892 keep 0 in the instruction now. */
1901 #if KEEPMINUSPCININST
1902 bfd_put_32 (ieee
->h
.abfd
, -current_map
->pc
,
1903 location_ptr
+ current_map
->pc
);
1904 r
->relent
.howto
= &rel32_howto
;
1905 r
->relent
.addend
-= current_map
->pc
;
1907 bfd_put_32 (ieee
->h
.abfd
, (bfd_vma
) 0, location_ptr
+
1909 r
->relent
.howto
= &rel32_howto
;
1914 bfd_put_32 (ieee
->h
.abfd
, (bfd_vma
) 0,
1915 location_ptr
+ current_map
->pc
);
1916 r
->relent
.howto
= &abs32_howto
;
1918 current_map
->pc
+= 4;
1923 #if KEEPMINUSPCININST
1924 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) -current_map
->pc
,
1925 location_ptr
+ current_map
->pc
);
1926 r
->relent
.addend
-= current_map
->pc
;
1927 r
->relent
.howto
= &rel16_howto
;
1930 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) 0,
1931 location_ptr
+ current_map
->pc
);
1932 r
->relent
.howto
= &rel16_howto
;
1938 bfd_put_16 (ieee
->h
.abfd
, (bfd_vma
) 0,
1939 location_ptr
+ current_map
->pc
);
1940 r
->relent
.howto
= &abs16_howto
;
1942 current_map
->pc
+= 2;
1947 #if KEEPMINUSPCININST
1948 bfd_put_8 (ieee
->h
.abfd
, (int) (-current_map
->pc
), location_ptr
+ current_map
->pc
);
1949 r
->relent
.addend
-= current_map
->pc
;
1950 r
->relent
.howto
= &rel8_howto
;
1952 bfd_put_8 (ieee
->h
.abfd
, 0, location_ptr
+ current_map
->pc
);
1953 r
->relent
.howto
= &rel8_howto
;
1958 bfd_put_8 (ieee
->h
.abfd
, 0, location_ptr
+ current_map
->pc
);
1959 r
->relent
.howto
= &abs8_howto
;
1961 current_map
->pc
+= 1;
1973 if (parse_int (&(ieee
->h
), &this_size
) == true)
1976 for (i
= 0; i
< this_size
; i
++)
1978 location_ptr
[current_map
->pc
++] = this_byte (&(ieee
->h
));
1979 next_byte (&(ieee
->h
));
1989 /* Prevent more than the first load-item of an LR record
1990 from being repeated (MRI convention). */
1991 if (iterations
!= 1)
1999 /* Read in all the section data and relocation stuff too */
2001 ieee_slurp_section_data (abfd
)
2004 bfd_byte
*location_ptr
= (bfd_byte
*) NULL
;
2005 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2006 unsigned int section_number
;
2008 ieee_per_section_type
*current_map
= (ieee_per_section_type
*) NULL
;
2010 /* Seek to the start of the data area */
2011 if (ieee
->read_data
== true)
2013 ieee
->read_data
= true;
2014 ieee_seek (ieee
, ieee
->w
.r
.data_part
);
2016 /* Allocate enough space for all the section contents */
2018 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
2020 ieee_per_section_type
*per
= (ieee_per_section_type
*) s
->used_by_bfd
;
2021 if ((s
->flags
& SEC_DEBUGGING
) != 0)
2023 per
->data
= (bfd_byte
*) bfd_alloc (ieee
->h
.abfd
, s
->_raw_size
);
2027 per
->reloc_tail_ptr
=
2028 (ieee_reloc_type
**) & (s
->relocation
);
2033 switch (this_byte (&(ieee
->h
)))
2035 /* IF we see anything strange then quit */
2039 case ieee_set_current_section_enum
:
2040 next_byte (&(ieee
->h
));
2041 section_number
= must_parse_int (&(ieee
->h
));
2042 s
= ieee
->section_table
[section_number
];
2043 s
->flags
|= SEC_LOAD
| SEC_HAS_CONTENTS
;
2044 current_map
= (ieee_per_section_type
*) s
->used_by_bfd
;
2045 location_ptr
= current_map
->data
- s
->vma
;
2046 /* The document I have says that Microtec's compilers reset */
2047 /* this after a sec section, even though the standard says not */
2049 current_map
->pc
= s
->vma
;
2052 case ieee_e2_first_byte_enum
:
2053 next_byte (&(ieee
->h
));
2054 switch (this_byte (&(ieee
->h
)))
2056 case ieee_set_current_pc_enum
& 0xff:
2059 ieee_symbol_index_type symbol
;
2062 next_byte (&(ieee
->h
));
2063 must_parse_int (&(ieee
->h
)); /* Throw away section #*/
2064 parse_expression (ieee
, &value
,
2068 current_map
->pc
= value
;
2069 BFD_ASSERT ((unsigned) (value
- s
->vma
) <= s
->_raw_size
);
2073 case ieee_value_starting_address_enum
& 0xff:
2074 next_byte (&(ieee
->h
));
2075 if (this_byte (&(ieee
->h
)) == ieee_function_either_open_b_enum
)
2076 next_byte (&(ieee
->h
));
2077 abfd
->start_address
= must_parse_int (&(ieee
->h
));
2078 /* We've got to the end of the data now - */
2085 case ieee_repeat_data_enum
:
2087 /* Repeat the following LD or LR n times - we do this by
2088 remembering the stream pointer before running it and
2089 resetting it and running it n times. We special case
2090 the repetition of a repeat_data/load_constant
2093 unsigned int iterations
;
2094 unsigned char *start
;
2095 next_byte (&(ieee
->h
));
2096 iterations
= must_parse_int (&(ieee
->h
));
2097 start
= ieee
->h
.input_p
;
2098 if (start
[0] == (int) ieee_load_constant_bytes_enum
&&
2101 while (iterations
!= 0)
2103 location_ptr
[current_map
->pc
++] = start
[2];
2106 next_byte (&(ieee
->h
));
2107 next_byte (&(ieee
->h
));
2108 next_byte (&(ieee
->h
));
2112 while (iterations
!= 0)
2114 ieee
->h
.input_p
= start
;
2115 if (!do_one (ieee
, current_map
, location_ptr
, s
,
2123 case ieee_load_constant_bytes_enum
:
2124 case ieee_load_with_relocation_enum
:
2126 if (!do_one (ieee
, current_map
, location_ptr
, s
, 1))
2134 ieee_new_section_hook (abfd
, newsect
)
2138 newsect
->used_by_bfd
= (PTR
)
2139 bfd_alloc (abfd
, (bfd_size_type
) sizeof (ieee_per_section_type
));
2140 if (!newsect
->used_by_bfd
)
2142 ieee_per_section (newsect
)->data
= (bfd_byte
*) NULL
;
2143 ieee_per_section (newsect
)->section
= newsect
;
2148 ieee_get_reloc_upper_bound (abfd
, asect
)
2152 if ((asect
->flags
& SEC_DEBUGGING
) != 0)
2154 if (! ieee_slurp_section_data (abfd
))
2156 return (asect
->reloc_count
+ 1) * sizeof (arelent
*);
2160 ieee_get_section_contents (abfd
, section
, location
, offset
, count
)
2165 bfd_size_type count
;
2167 ieee_per_section_type
*p
= (ieee_per_section_type
*) section
->used_by_bfd
;
2168 if ((section
->flags
& SEC_DEBUGGING
) != 0)
2169 return _bfd_generic_get_section_contents (abfd
, section
, location
,
2171 ieee_slurp_section_data (abfd
);
2172 (void) memcpy ((PTR
) location
, (PTR
) (p
->data
+ offset
), (unsigned) count
);
2177 ieee_canonicalize_reloc (abfd
, section
, relptr
, symbols
)
2183 /* ieee_per_section_type *p = (ieee_per_section_type *) section->used_by_bfd;*/
2184 ieee_reloc_type
*src
= (ieee_reloc_type
*) (section
->relocation
);
2185 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2187 if ((section
->flags
& SEC_DEBUGGING
) != 0)
2190 while (src
!= (ieee_reloc_type
*) NULL
)
2192 /* Work out which symbol to attach it this reloc to */
2193 switch (src
->symbol
.letter
)
2196 src
->relent
.sym_ptr_ptr
=
2197 symbols
+ src
->symbol
.index
+ ieee
->external_symbol_base_offset
;
2200 src
->relent
.sym_ptr_ptr
=
2201 symbols
+ src
->symbol
.index
+ ieee
->external_reference_base_offset
;
2204 if (src
->relent
.sym_ptr_ptr
!= NULL
)
2205 src
->relent
.sym_ptr_ptr
=
2206 src
->relent
.sym_ptr_ptr
[0]->section
->symbol_ptr_ptr
;
2212 *relptr
++ = &src
->relent
;
2215 *relptr
= (arelent
*) NULL
;
2216 return section
->reloc_count
;
2224 arelent
*a
= *((arelent
**) ap
);
2225 arelent
*b
= *((arelent
**) bp
);
2226 return a
->address
- b
->address
;
2229 /* Write the section headers. */
2232 ieee_write_section_part (abfd
)
2235 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
2237 ieee
->w
.r
.section_part
= bfd_tell (abfd
);
2238 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
2240 if (! bfd_is_abs_section (s
)
2241 && (s
->flags
& SEC_DEBUGGING
) == 0)
2243 if (! ieee_write_byte (abfd
, ieee_section_type_enum
)
2244 || ! ieee_write_byte (abfd
,
2245 (bfd_byte
) (s
->index
2246 + IEEE_SECTION_NUMBER_BASE
)))
2249 if (abfd
->flags
& EXEC_P
)
2251 /* This image is executable, so output absolute sections */
2252 if (! ieee_write_byte (abfd
, ieee_variable_A_enum
)
2253 || ! ieee_write_byte (abfd
, ieee_variable_S_enum
))
2258 if (! ieee_write_byte (abfd
, ieee_variable_C_enum
))
2262 switch (s
->flags
& (SEC_CODE
| SEC_DATA
| SEC_ROM
))
2264 case SEC_CODE
| SEC_LOAD
:
2266 if (! ieee_write_byte (abfd
, ieee_variable_P_enum
))
2271 if (! ieee_write_byte (abfd
, ieee_variable_D_enum
))
2275 case SEC_ROM
| SEC_DATA
:
2276 case SEC_ROM
| SEC_LOAD
:
2277 case SEC_ROM
| SEC_DATA
| SEC_LOAD
:
2278 if (! ieee_write_byte (abfd
, ieee_variable_R_enum
))
2283 if (! ieee_write_id (abfd
, s
->name
))
2286 ieee_write_int (abfd
, 0); /* Parent */
2287 ieee_write_int (abfd
, 0); /* Brother */
2288 ieee_write_int (abfd
, 0); /* Context */
2291 if (! ieee_write_byte (abfd
, ieee_section_alignment_enum
)
2292 || ! ieee_write_byte (abfd
,
2293 (bfd_byte
) (s
->index
2294 + IEEE_SECTION_NUMBER_BASE
))
2295 || ! ieee_write_int (abfd
, (bfd_vma
) 1 << s
->alignment_power
))
2299 if (! ieee_write_2bytes (abfd
, ieee_section_size_enum
)
2300 || ! ieee_write_byte (abfd
,
2301 (bfd_byte
) (s
->index
2302 + IEEE_SECTION_NUMBER_BASE
))
2303 || ! ieee_write_int (abfd
, s
->_raw_size
))
2305 if (abfd
->flags
& EXEC_P
)
2307 /* Relocateable sections don't have asl records */
2309 if (! ieee_write_2bytes (abfd
, ieee_section_base_address_enum
)
2310 || ! ieee_write_byte (abfd
,
2313 + IEEE_SECTION_NUMBER_BASE
)))
2314 || ! ieee_write_int (abfd
, s
->lma
))
2325 do_with_relocs (abfd
, s
)
2329 unsigned int number_of_maus_in_address
=
2330 bfd_arch_bits_per_address (abfd
) / bfd_arch_bits_per_byte (abfd
);
2331 unsigned int relocs_to_go
= s
->reloc_count
;
2332 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2333 arelent
**p
= s
->orelocation
;
2334 bfd_size_type current_byte_index
= 0;
2336 qsort (s
->orelocation
,
2338 sizeof (arelent
**),
2341 /* Output the section preheader */
2342 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2343 || ! ieee_write_byte (abfd
,
2344 (bfd_byte
) (s
->index
+ IEEE_SECTION_NUMBER_BASE
))
2345 || ! ieee_write_2bytes (abfd
, ieee_set_current_pc_enum
)
2346 || ! ieee_write_byte (abfd
,
2347 (bfd_byte
) (s
->index
+ IEEE_SECTION_NUMBER_BASE
)))
2350 if ((abfd
->flags
& EXEC_P
) != 0 && relocs_to_go
== 0)
2352 if (! ieee_write_int (abfd
, s
->lma
))
2357 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2361 if (relocs_to_go
== 0)
2363 /* If there aren't any relocations then output the load constant
2364 byte opcode rather than the load with relocation opcode */
2366 while (current_byte_index
< s
->_raw_size
)
2369 unsigned int MAXRUN
= 127;
2371 if (run
> s
->_raw_size
- current_byte_index
)
2373 run
= s
->_raw_size
- current_byte_index
;
2378 if (! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
))
2380 /* Output a stream of bytes */
2381 if (! ieee_write_int (abfd
, run
))
2383 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2386 current_byte_index
+= run
;
2392 if (! ieee_write_byte (abfd
, ieee_load_with_relocation_enum
))
2395 /* Output the data stream as the longest sequence of bytes
2396 possible, allowing for the a reasonable packet size and
2397 relocation stuffs. */
2399 if ((PTR
) stream
== (PTR
) NULL
)
2401 /* Outputting a section without data, fill it up */
2402 stream
= (unsigned char *) (bfd_alloc (abfd
, s
->_raw_size
));
2405 memset ((PTR
) stream
, 0, (size_t) s
->_raw_size
);
2407 while (current_byte_index
< s
->_raw_size
)
2410 unsigned int MAXRUN
= 127;
2413 run
= (*p
)->address
- current_byte_index
;
2421 if (run
> s
->_raw_size
- current_byte_index
)
2423 run
= s
->_raw_size
- current_byte_index
;
2428 /* Output a stream of bytes */
2429 if (! ieee_write_int (abfd
, run
))
2431 if (bfd_bwrite ((PTR
) (stream
+ current_byte_index
), run
, abfd
)
2434 current_byte_index
+= run
;
2436 /* Output any relocations here */
2437 if (relocs_to_go
&& (*p
) && (*p
)->address
== current_byte_index
)
2440 && (*p
) && (*p
)->address
== current_byte_index
)
2446 if (r
->howto
->pc_relative
)
2448 r
->addend
+= current_byte_index
;
2452 switch (r
->howto
->size
)
2456 ov
= bfd_get_signed_32 (abfd
,
2457 stream
+ current_byte_index
);
2458 current_byte_index
+= 4;
2461 ov
= bfd_get_signed_16 (abfd
,
2462 stream
+ current_byte_index
);
2463 current_byte_index
+= 2;
2466 ov
= bfd_get_signed_8 (abfd
,
2467 stream
+ current_byte_index
);
2468 current_byte_index
++;
2476 ov
&= r
->howto
->src_mask
;
2478 if (r
->howto
->pc_relative
2479 && ! r
->howto
->pcrel_offset
)
2482 if (! ieee_write_byte (abfd
,
2483 ieee_function_either_open_b_enum
))
2488 if (r
->sym_ptr_ptr
!= (asymbol
**) NULL
)
2490 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2492 r
->howto
->pc_relative
,
2493 (unsigned) s
->index
))
2498 if (! ieee_write_expression (abfd
, r
->addend
+ ov
,
2500 r
->howto
->pc_relative
,
2501 (unsigned) s
->index
))
2505 if (number_of_maus_in_address
2506 != bfd_get_reloc_size (r
->howto
))
2508 bfd_vma rsize
= bfd_get_reloc_size (r
->howto
);
2509 if (! ieee_write_int (abfd
, rsize
))
2512 if (! ieee_write_byte (abfd
,
2513 ieee_function_either_close_b_enum
))
2527 /* If there are no relocations in the output section then we can be
2528 clever about how we write. We block items up into a max of 127
2532 do_as_repeat (abfd
, s
)
2538 if (! ieee_write_byte (abfd
, ieee_set_current_section_enum
)
2539 || ! ieee_write_byte (abfd
,
2540 (bfd_byte
) (s
->index
2541 + IEEE_SECTION_NUMBER_BASE
))
2542 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
>> 8)
2543 || ! ieee_write_byte (abfd
, ieee_set_current_pc_enum
& 0xff)
2544 || ! ieee_write_byte (abfd
,
2545 (bfd_byte
) (s
->index
2546 + IEEE_SECTION_NUMBER_BASE
)))
2549 if ((abfd
->flags
& EXEC_P
) != 0)
2551 if (! ieee_write_int (abfd
, s
->lma
))
2556 if (! ieee_write_expression (abfd
, (bfd_vma
) 0, s
->symbol
, 0, 0))
2560 if (! ieee_write_byte (abfd
, ieee_repeat_data_enum
)
2561 || ! ieee_write_int (abfd
, s
->_raw_size
)
2562 || ! ieee_write_byte (abfd
, ieee_load_constant_bytes_enum
)
2563 || ! ieee_write_byte (abfd
, 1)
2564 || ! ieee_write_byte (abfd
, 0))
2572 do_without_relocs (abfd
, s
)
2576 bfd_byte
*stream
= ieee_per_section (s
)->data
;
2578 if (stream
== 0 || ((s
->flags
& SEC_LOAD
) == 0))
2580 if (! do_as_repeat (abfd
, s
))
2586 for (i
= 0; i
< s
->_raw_size
; i
++)
2590 if (! do_with_relocs (abfd
, s
))
2595 if (! do_as_repeat (abfd
, s
))
2603 static unsigned char *output_ptr_start
;
2604 static unsigned char *output_ptr
;
2605 static unsigned char *output_ptr_end
;
2606 static unsigned char *input_ptr_start
;
2607 static unsigned char *input_ptr
;
2608 static unsigned char *input_ptr_end
;
2609 static bfd
*input_bfd
;
2610 static bfd
*output_bfd
;
2611 static int output_buffer
;
2614 ieee_mkobject (abfd
)
2619 output_ptr_start
= NULL
;
2621 output_ptr_end
= NULL
;
2622 input_ptr_start
= NULL
;
2624 input_ptr_end
= NULL
;
2628 amt
= sizeof (ieee_data_type
);
2629 abfd
->tdata
.ieee_data
= (ieee_data_type
*) bfd_zalloc (abfd
, amt
);
2630 return abfd
->tdata
.ieee_data
? true : false;
2636 bfd_size_type amt
= input_ptr_end
- input_ptr_start
;
2637 /* FIXME: Check return value. I'm not sure whether it needs to read
2638 the entire buffer or not. */
2639 bfd_bread ((PTR
) input_ptr_start
, amt
, input_bfd
);
2640 input_ptr
= input_ptr_start
;
2646 bfd_size_type amt
= output_ptr
- output_ptr_start
;
2647 if (bfd_bwrite ((PTR
) (output_ptr_start
), amt
, output_bfd
) != amt
)
2649 output_ptr
= output_ptr_start
;
2653 #define THIS() ( *input_ptr )
2654 #define NEXT() { input_ptr++; if (input_ptr == input_ptr_end) fill(); }
2655 #define OUT(x) { *output_ptr++ = (x); if(output_ptr == output_ptr_end) flush(); }
2661 if (value
>= 0 && value
<= 127)
2667 unsigned int length
;
2668 /* How many significant bytes ? */
2669 /* FIXME FOR LONGER INTS */
2670 if (value
& 0xff000000)
2674 else if (value
& 0x00ff0000)
2678 else if (value
& 0x0000ff00)
2685 OUT ((int) ieee_number_repeat_start_enum
+ length
);
2704 int length
= THIS ();
2716 #define VAR(x) ((x | 0x80))
2731 value
= (value
<< 8) | THIS ();
2733 value
= (value
<< 8) | THIS ();
2735 value
= (value
<< 8) | THIS ();
2743 value
= (value
<< 8) | THIS ();
2745 value
= (value
<< 8) | THIS ();
2753 value
= (value
<< 8) | THIS ();
2770 /* Not a number, just bug out with the answer */
2771 write_int (*(--tos
));
2787 ieee_data_type
*ieee
;
2790 section_number
= THIS ();
2793 ieee
= IEEE_DATA (input_bfd
);
2794 s
= ieee
->section_table
[section_number
];
2796 if (s
->output_section
)
2797 value
= s
->output_section
->lma
;
2798 value
+= s
->output_offset
;
2805 write_int (*(--tos
));
2813 /* Drop the int in the buffer, and copy a null into the gap, which we
2814 will overwrite later */
2818 struct output_buffer_struct
*buf
;
2820 if (buf
->buffer
== output_buffer
)
2822 /* Still a chance to output the size */
2823 int value
= output_ptr
- buf
->ptrp
+ 3;
2824 buf
->ptrp
[0] = value
>> 24;
2825 buf
->ptrp
[1] = value
>> 16;
2826 buf
->ptrp
[2] = value
>> 8;
2827 buf
->ptrp
[3] = value
>> 0;
2833 struct output_buffer_struct
*buf
;
2859 buf
->ptrp
= output_ptr
;
2860 buf
->buffer
= output_buffer
;
2900 #define ID copy_id()
2901 #define INT copy_int()
2902 #define EXP copy_expression()
2903 #define INTn(q) copy_int()
2904 #define EXPn(q) copy_expression()
2943 EXPn (instruction address
);
2977 EXPn (external function
);
2987 INTn (locked
register);
3010 /* Attribute record */
3079 /* Unique typedefs for module */
3080 /* GLobal typedefs */
3081 /* High level module scope beginning */
3083 struct output_buffer_struct ob
;
3098 /* Global function */
3100 struct output_buffer_struct ob
;
3114 EXPn (size of block
);
3120 /* File name for source line numbers */
3122 struct output_buffer_struct ob
;
3142 /* Local function */
3144 struct output_buffer_struct ob
;
3162 /* Assembler module scope beginning -*/
3164 struct output_buffer_struct ob
;
3190 struct output_buffer_struct ob
;
3197 INTn (section index
);
3205 EXPn (Size in Maus
);
3260 moves all the debug information from the source bfd to the output
3261 bfd, and relocates any expressions it finds
3265 relocate_debug (output
, input
)
3266 bfd
*output ATTRIBUTE_UNUSED
;
3271 unsigned char input_buffer
[IBS
];
3273 input_ptr_start
= input_ptr
= input_buffer
;
3274 input_ptr_end
= input_buffer
+ IBS
;
3276 /* FIXME: Check return value. I'm not sure whether it needs to read
3277 the entire buffer or not. */
3278 bfd_bread ((PTR
) input_ptr_start
, (bfd_size_type
) IBS
, input
);
3282 /* Gather together all the debug information from each input BFD into
3283 one place, relocating it and emitting it as we go. */
3286 ieee_write_debug_part (abfd
)
3289 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3290 bfd_chain_type
*chain
= ieee
->chain_root
;
3291 unsigned char obuff
[OBS
];
3292 boolean some_debug
= false;
3293 file_ptr here
= bfd_tell (abfd
);
3295 output_ptr_start
= output_ptr
= obuff
;
3296 output_ptr_end
= obuff
+ OBS
;
3300 if (chain
== (bfd_chain_type
*) NULL
)
3304 for (s
= abfd
->sections
; s
!= NULL
; s
= s
->next
)
3305 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3309 ieee
->w
.r
.debug_information_part
= 0;
3313 ieee
->w
.r
.debug_information_part
= here
;
3314 if (bfd_bwrite (s
->contents
, s
->_raw_size
, abfd
) != s
->_raw_size
)
3319 while (chain
!= (bfd_chain_type
*) NULL
)
3321 bfd
*entry
= chain
->this;
3322 ieee_data_type
*entry_ieee
= IEEE_DATA (entry
);
3323 if (entry_ieee
->w
.r
.debug_information_part
)
3325 if (bfd_seek (entry
, entry_ieee
->w
.r
.debug_information_part
,
3328 relocate_debug (abfd
, entry
);
3331 chain
= chain
->next
;
3335 ieee
->w
.r
.debug_information_part
= here
;
3339 ieee
->w
.r
.debug_information_part
= 0;
3348 /* Write the data in an ieee way. */
3351 ieee_write_data_part (abfd
)
3355 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3356 ieee
->w
.r
.data_part
= bfd_tell (abfd
);
3357 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3359 /* Skip sections that have no loadable contents (.bss,
3361 if ((s
->flags
& SEC_LOAD
) == 0)
3364 /* Sort the reloc records so we can insert them in the correct
3366 if (s
->reloc_count
!= 0)
3368 if (! do_with_relocs (abfd
, s
))
3373 if (! do_without_relocs (abfd
, s
))
3383 init_for_output (abfd
)
3387 for (s
= abfd
->sections
; s
!= (asection
*) NULL
; s
= s
->next
)
3389 if ((s
->flags
& SEC_DEBUGGING
) != 0)
3391 if (s
->_raw_size
!= 0)
3393 bfd_size_type size
= s
->_raw_size
;
3394 ieee_per_section (s
)->data
= (bfd_byte
*) (bfd_alloc (abfd
, size
));
3395 if (!ieee_per_section (s
)->data
)
3402 /** exec and core file sections */
3404 /* set section contents is complicated with IEEE since the format is
3405 * not a byte image, but a record stream.
3408 ieee_set_section_contents (abfd
, section
, location
, offset
, count
)
3413 bfd_size_type count
;
3415 if ((section
->flags
& SEC_DEBUGGING
) != 0)
3417 if (section
->contents
== NULL
)
3419 bfd_size_type size
= section
->_raw_size
;
3420 section
->contents
= (unsigned char *) bfd_alloc (abfd
, size
);
3421 if (section
->contents
== NULL
)
3424 /* bfd_set_section_contents has already checked that everything
3426 memcpy (section
->contents
+ offset
, location
, (size_t) count
);
3430 if (ieee_per_section (section
)->data
== (bfd_byte
*) NULL
)
3432 if (!init_for_output (abfd
))
3435 memcpy ((PTR
) (ieee_per_section (section
)->data
+ offset
),
3437 (unsigned int) count
);
3441 /* Write the external symbols of a file. IEEE considers two sorts of
3442 external symbols, public, and referenced. It uses to internal
3443 forms to index them as well. When we write them out we turn their
3444 symbol values into indexes from the right base. */
3447 ieee_write_external_part (abfd
)
3451 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3453 unsigned int reference_index
= IEEE_REFERENCE_BASE
;
3454 unsigned int public_index
= IEEE_PUBLIC_BASE
+ 2;
3455 file_ptr here
= bfd_tell (abfd
);
3456 boolean hadone
= false;
3457 if (abfd
->outsymbols
!= (asymbol
**) NULL
)
3460 for (q
= abfd
->outsymbols
; *q
!= (asymbol
*) NULL
; q
++)
3463 if (bfd_is_und_section (p
->section
))
3465 /* This must be a symbol reference .. */
3466 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3467 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3468 || ! ieee_write_id (abfd
, p
->name
))
3470 p
->value
= reference_index
;
3474 else if (bfd_is_com_section (p
->section
))
3476 /* This is a weak reference */
3477 if (! ieee_write_byte (abfd
, ieee_external_reference_enum
)
3478 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3479 || ! ieee_write_id (abfd
, p
->name
)
3480 || ! ieee_write_byte (abfd
,
3481 ieee_weak_external_reference_enum
)
3482 || ! ieee_write_int (abfd
, (bfd_vma
) reference_index
)
3483 || ! ieee_write_int (abfd
, p
->value
))
3485 p
->value
= reference_index
;
3489 else if (p
->flags
& BSF_GLOBAL
)
3491 /* This must be a symbol definition */
3493 if (! ieee_write_byte (abfd
, ieee_external_symbol_enum
)
3494 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3495 || ! ieee_write_id (abfd
, p
->name
)
3496 || ! ieee_write_2bytes (abfd
, ieee_attribute_record_enum
)
3497 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
)
3498 || ! ieee_write_byte (abfd
, 15) /* instruction address */
3499 || ! ieee_write_byte (abfd
, 19) /* static symbol */
3500 || ! ieee_write_byte (abfd
, 1)) /* one of them */
3503 /* Write out the value */
3504 if (! ieee_write_2bytes (abfd
, ieee_value_record_enum
)
3505 || ! ieee_write_int (abfd
, (bfd_vma
) public_index
))
3507 if (! bfd_is_abs_section (p
->section
))
3509 if (abfd
->flags
& EXEC_P
)
3511 /* If fully linked, then output all symbols
3513 if (! (ieee_write_int
3516 + p
->section
->output_offset
3517 + p
->section
->output_section
->vma
))))
3522 if (! (ieee_write_expression
3524 p
->value
+ p
->section
->output_offset
,
3525 p
->section
->output_section
->symbol
,
3532 if (! ieee_write_expression (abfd
,
3534 bfd_abs_section_ptr
->symbol
,
3538 p
->value
= public_index
;
3544 /* This can happen - when there are gaps in the symbols read */
3545 /* from an input ieee file */
3550 ieee
->w
.r
.external_part
= here
;
3556 static const unsigned char exten
[] =
3559 0xf1, 0xce, 0x20, 0x00, 37, 3, 3, /* Set version 3 rev 3 */
3560 0xf1, 0xce, 0x20, 0x00, 39, 2,/* keep symbol in original case */
3561 0xf1, 0xce, 0x20, 0x00, 38 /* set object type relocateable to x */
3564 static const unsigned char envi
[] =
3568 /* 0xf1, 0xce, 0x21, 00, 50, 0x82, 0x07, 0xc7, 0x09, 0x11, 0x11,
3571 0xf1, 0xce, 0x21, 00, 52, 0x00, /* exec ok */
3573 0xf1, 0xce, 0x21, 0, 53, 0x03,/* host unix */
3574 /* 0xf1, 0xce, 0x21, 0, 54, 2,1,1 tool & version # */
3578 ieee_write_me_part (abfd
)
3581 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3582 ieee
->w
.r
.trailer_part
= bfd_tell (abfd
);
3583 if (abfd
->start_address
)
3585 if (! ieee_write_2bytes (abfd
, ieee_value_starting_address_enum
)
3586 || ! ieee_write_byte (abfd
, ieee_function_either_open_b_enum
)
3587 || ! ieee_write_int (abfd
, abfd
->start_address
)
3588 || ! ieee_write_byte (abfd
, ieee_function_either_close_b_enum
))
3591 ieee
->w
.r
.me_record
= bfd_tell (abfd
);
3592 if (! ieee_write_byte (abfd
, ieee_module_end_enum
))
3597 /* Write out the IEEE processor ID. */
3600 ieee_write_processor (abfd
)
3603 const bfd_arch_info_type
*arch
;
3605 arch
= bfd_get_arch_info (abfd
);
3609 if (! ieee_write_id (abfd
, bfd_printable_name (abfd
)))
3614 if (! ieee_write_id (abfd
, "29000"))
3618 case bfd_arch_h8300
:
3619 if (! ieee_write_id (abfd
, "H8/300"))
3623 case bfd_arch_h8500
:
3624 if (! ieee_write_id (abfd
, "H8/500"))
3632 case bfd_mach_i960_core
:
3633 case bfd_mach_i960_ka_sa
:
3634 if (! ieee_write_id (abfd
, "80960KA"))
3638 case bfd_mach_i960_kb_sb
:
3639 if (! ieee_write_id (abfd
, "80960KB"))
3643 case bfd_mach_i960_ca
:
3644 if (! ieee_write_id (abfd
, "80960CA"))
3648 case bfd_mach_i960_mc
:
3649 case bfd_mach_i960_xa
:
3650 if (! ieee_write_id (abfd
, "80960MC"))
3662 default: id
= "68020"; break;
3663 case bfd_mach_m68000
: id
= "68000"; break;
3664 case bfd_mach_m68008
: id
= "68008"; break;
3665 case bfd_mach_m68010
: id
= "68010"; break;
3666 case bfd_mach_m68020
: id
= "68020"; break;
3667 case bfd_mach_m68030
: id
= "68030"; break;
3668 case bfd_mach_m68040
: id
= "68040"; break;
3669 case bfd_mach_m68060
: id
= "68060"; break;
3670 case bfd_mach_cpu32
: id
= "cpu32"; break;
3671 case bfd_mach_mcf5200
:id
= "5200"; break;
3672 case bfd_mach_mcf5206e
:id
= "5206e"; break;
3673 case bfd_mach_mcf5307
:id
= "5307"; break;
3674 case bfd_mach_mcf5407
:id
= "5407"; break;
3677 if (! ieee_write_id (abfd
, id
))
3687 ieee_write_object_contents (abfd
)
3690 ieee_data_type
*ieee
= IEEE_DATA (abfd
);
3694 /* Fast forward over the header area */
3695 if (bfd_seek (abfd
, (file_ptr
) 0, SEEK_SET
) != 0)
3698 if (! ieee_write_byte (abfd
, ieee_module_beginning_enum
)
3699 || ! ieee_write_processor (abfd
)
3700 || ! ieee_write_id (abfd
, abfd
->filename
))
3703 /* Fast forward over the variable bits */
3704 if (! ieee_write_byte (abfd
, ieee_address_descriptor_enum
))
3708 if (! ieee_write_byte (abfd
, (bfd_byte
) (bfd_arch_bits_per_byte (abfd
))))
3710 /* MAU's per address */
3711 if (! ieee_write_byte (abfd
,
3712 (bfd_byte
) (bfd_arch_bits_per_address (abfd
)
3713 / bfd_arch_bits_per_byte (abfd
))))
3716 old
= bfd_tell (abfd
);
3717 if (bfd_seek (abfd
, (file_ptr
) (8 * N_W_VARIABLES
), SEEK_CUR
) != 0)
3720 ieee
->w
.r
.extension_record
= bfd_tell (abfd
);
3721 if (bfd_bwrite ((char *) exten
, (bfd_size_type
) sizeof (exten
), abfd
)
3724 if (abfd
->flags
& EXEC_P
)
3726 if (! ieee_write_byte (abfd
, 0x1)) /* Absolute */
3731 if (! ieee_write_byte (abfd
, 0x2)) /* Relocateable */
3735 ieee
->w
.r
.environmental_record
= bfd_tell (abfd
);
3736 if (bfd_bwrite ((char *) envi
, (bfd_size_type
) sizeof (envi
), abfd
)
3740 /* The HP emulator database requires a timestamp in the file. */
3746 t
= (struct tm
*) localtime (&now
);
3747 if (! ieee_write_2bytes (abfd
, (int) ieee_atn_record_enum
)
3748 || ! ieee_write_byte (abfd
, 0x21)
3749 || ! ieee_write_byte (abfd
, 0)
3750 || ! ieee_write_byte (abfd
, 50)
3751 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_year
+ 1900))
3752 || ! ieee_write_int (abfd
, (bfd_vma
) (t
->tm_mon
+ 1))
3753 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_mday
)
3754 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_hour
)
3755 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_min
)
3756 || ! ieee_write_int (abfd
, (bfd_vma
) t
->tm_sec
))
3764 if (! ieee_write_section_part (abfd
))
3766 /* First write the symbols. This changes their values into table
3767 indeces so we cant use it after this point. */
3768 if (! ieee_write_external_part (abfd
))
3771 /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
3773 /* ieee_write_byte(abfd, ieee_record_seperator_enum);*/
3776 /* Write any debugs we have been told about. */
3777 if (! ieee_write_debug_part (abfd
))
3780 /* Can only write the data once the symbols have been written, since
3781 the data contains relocation information which points to the
3783 if (! ieee_write_data_part (abfd
))
3786 /* At the end we put the end! */
3787 if (! ieee_write_me_part (abfd
))
3790 /* Generate the header */
3791 if (bfd_seek (abfd
, old
, SEEK_SET
) != 0)
3794 for (i
= 0; i
< N_W_VARIABLES
; i
++)
3796 if (! ieee_write_2bytes (abfd
, ieee_assign_value_to_variable_enum
)
3797 || ! ieee_write_byte (abfd
, (bfd_byte
) i
)
3798 || ! ieee_write_int5_out (abfd
, (bfd_vma
) ieee
->w
.offset
[i
]))
3805 /* Native-level interface to symbols. */
3807 /* We read the symbols into a buffer, which is discarded when this
3808 function exits. We read the strings into a buffer large enough to
3809 hold them all plus all the cached symbol entries. */
3812 ieee_make_empty_symbol (abfd
)
3815 bfd_size_type amt
= sizeof (ieee_symbol_type
);
3816 ieee_symbol_type
*new = (ieee_symbol_type
*) bfd_zalloc (abfd
, amt
);
3819 new->symbol
.the_bfd
= abfd
;
3820 return &new->symbol
;
3824 ieee_openr_next_archived_file (arch
, prev
)
3828 ieee_ar_data_type
*ar
= IEEE_AR_DATA (arch
);
3829 /* take the next one from the arch state, or reset */
3830 if (prev
== (bfd
*) NULL
)
3832 /* Reset the index - the first two entries are bogus*/
3833 ar
->element_index
= 2;
3837 ieee_ar_obstack_type
*p
= ar
->elements
+ ar
->element_index
;
3838 ar
->element_index
++;
3839 if (ar
->element_index
<= ar
->element_count
)
3841 if (p
->file_offset
!= (file_ptr
) 0)
3843 if (p
->abfd
== (bfd
*) NULL
)
3845 p
->abfd
= _bfd_create_empty_archive_element_shell (arch
);
3846 p
->abfd
->origin
= p
->file_offset
;
3853 bfd_set_error (bfd_error_no_more_archived_files
);
3854 return (bfd
*) NULL
;
3861 ieee_find_nearest_line (abfd
, section
, symbols
, offset
, filename_ptr
,
3862 functionname_ptr
, line_ptr
)
3863 bfd
*abfd ATTRIBUTE_UNUSED
;
3864 asection
*section ATTRIBUTE_UNUSED
;
3865 asymbol
**symbols ATTRIBUTE_UNUSED
;
3866 bfd_vma offset ATTRIBUTE_UNUSED
;
3867 const char **filename_ptr ATTRIBUTE_UNUSED
;
3868 const char **functionname_ptr ATTRIBUTE_UNUSED
;
3869 unsigned int *line_ptr ATTRIBUTE_UNUSED
;
3875 ieee_generic_stat_arch_elt (abfd
, buf
)
3879 ieee_ar_data_type
*ar
= (ieee_ar_data_type
*) NULL
;
3880 ieee_data_type
*ieee
;
3882 if (abfd
->my_archive
!= NULL
)
3883 ar
= abfd
->my_archive
->tdata
.ieee_ar_data
;
3884 if (ar
== (ieee_ar_data_type
*) NULL
)
3886 bfd_set_error (bfd_error_invalid_operation
);
3890 if (IEEE_DATA (abfd
) == NULL
)
3892 if (ieee_object_p (abfd
) == NULL
)
3894 bfd_set_error (bfd_error_wrong_format
);
3899 ieee
= IEEE_DATA (abfd
);
3901 buf
->st_size
= ieee
->w
.r
.me_record
+ 1;
3902 buf
->st_mode
= 0644;
3907 ieee_sizeof_headers (abfd
, x
)
3908 bfd
*abfd ATTRIBUTE_UNUSED
;
3909 boolean x ATTRIBUTE_UNUSED
;
3915 /* The debug info routines are never used. */
3919 ieee_bfd_debug_info_start (abfd
)
3926 ieee_bfd_debug_info_end (abfd
)
3933 /* Add this section to the list of sections we have debug info for, to
3934 be ready to output it at close time
3937 ieee_bfd_debug_info_accumulate (abfd
, section
)
3941 ieee_data_type
*ieee
= IEEE_DATA (section
->owner
);
3942 ieee_data_type
*output_ieee
= IEEE_DATA (abfd
);
3943 /* can only accumulate data from other ieee bfds */
3944 if (section
->owner
->xvec
!= abfd
->xvec
)
3946 /* Only bother once per bfd */
3947 if (ieee
->done_debug
== true)
3949 ieee
->done_debug
= true;
3951 /* Don't bother if there is no debug info */
3952 if (ieee
->w
.r
.debug_information_part
== 0)
3958 bfd_size_type amt
= sizeof (bfd_chain_type
);
3959 bfd_chain_type
*n
= (bfd_chain_type
*) bfd_alloc (abfd
, amt
);
3961 abort (); /* FIXME */
3962 n
->this = section
->owner
;
3963 n
->next
= (bfd_chain_type
*) NULL
;
3965 if (output_ieee
->chain_head
)
3967 output_ieee
->chain_head
->next
= n
;
3971 output_ieee
->chain_root
= n
;
3974 output_ieee
->chain_head
= n
;
3980 #define ieee_close_and_cleanup _bfd_generic_close_and_cleanup
3981 #define ieee_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
3983 #define ieee_slurp_armap bfd_true
3984 #define ieee_slurp_extended_name_table bfd_true
3985 #define ieee_construct_extended_name_table \
3986 ((boolean (*) PARAMS ((bfd *, char **, bfd_size_type *, const char **))) \
3988 #define ieee_truncate_arname bfd_dont_truncate_arname
3989 #define ieee_write_armap \
3991 PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \
3993 #define ieee_read_ar_hdr bfd_nullvoidptr
3994 #define ieee_update_armap_timestamp bfd_true
3995 #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
3997 #define ieee_bfd_is_local_label_name bfd_generic_is_local_label_name
3998 #define ieee_get_lineno _bfd_nosymbols_get_lineno
3999 #define ieee_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
4000 #define ieee_read_minisymbols _bfd_generic_read_minisymbols
4001 #define ieee_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
4003 #define ieee_bfd_reloc_type_lookup _bfd_norelocs_bfd_reloc_type_lookup
4005 #define ieee_set_arch_mach _bfd_generic_set_arch_mach
4007 #define ieee_get_section_contents_in_window \
4008 _bfd_generic_get_section_contents_in_window
4009 #define ieee_bfd_get_relocated_section_contents \
4010 bfd_generic_get_relocated_section_contents
4011 #define ieee_bfd_relax_section bfd_generic_relax_section
4012 #define ieee_bfd_gc_sections bfd_generic_gc_sections
4013 #define ieee_bfd_merge_sections bfd_generic_merge_sections
4014 #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
4015 #define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
4016 #define ieee_bfd_final_link _bfd_generic_final_link
4017 #define ieee_bfd_link_split_section _bfd_generic_link_split_section
4020 const bfd_target ieee_vec
=
4023 bfd_target_ieee_flavour
,
4024 BFD_ENDIAN_UNKNOWN
, /* target byte order */
4025 BFD_ENDIAN_UNKNOWN
, /* target headers byte order */
4026 (HAS_RELOC
| EXEC_P
| /* object flags */
4027 HAS_LINENO
| HAS_DEBUG
|
4028 HAS_SYMS
| HAS_LOCALS
| WP_TEXT
| D_PAGED
),
4029 (SEC_CODE
| SEC_DATA
| SEC_ROM
| SEC_HAS_CONTENTS
4030 | SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
4031 '_', /* leading underscore */
4032 ' ', /* ar_pad_char */
4033 16, /* ar_max_namelen */
4034 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4035 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4036 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* data */
4037 bfd_getb64
, bfd_getb_signed_64
, bfd_putb64
,
4038 bfd_getb32
, bfd_getb_signed_32
, bfd_putb32
,
4039 bfd_getb16
, bfd_getb_signed_16
, bfd_putb16
, /* hdrs */
4042 ieee_object_p
, /* bfd_check_format */
4049 _bfd_generic_mkarchive
,
4054 ieee_write_object_contents
,
4055 _bfd_write_archive_contents
,
4059 /* ieee_close_and_cleanup, ieee_bfd_free_cached_info, ieee_new_section_hook,
4060 ieee_get_section_contents, ieee_get_section_contents_in_window */
4061 BFD_JUMP_TABLE_GENERIC (ieee
),
4063 BFD_JUMP_TABLE_COPY (_bfd_generic
),
4064 BFD_JUMP_TABLE_CORE (_bfd_nocore
),
4066 /* ieee_slurp_armap, ieee_slurp_extended_name_table,
4067 ieee_construct_extended_name_table, ieee_truncate_arname,
4068 ieee_write_armap, ieee_read_ar_hdr, ieee_openr_next_archived_file,
4069 ieee_get_elt_at_index, ieee_generic_stat_arch_elt,
4070 ieee_update_armap_timestamp */
4071 BFD_JUMP_TABLE_ARCHIVE (ieee
),
4073 /* ieee_get_symtab_upper_bound, ieee_get_symtab, ieee_make_empty_symbol,
4074 ieee_print_symbol, ieee_get_symbol_info, ieee_bfd_is_local_label_name,
4075 ieee_get_lineno, ieee_find_nearest_line, ieee_bfd_make_debug_symbol,
4076 ieee_read_minisymbols, ieee_minisymbol_to_symbol */
4077 BFD_JUMP_TABLE_SYMBOLS (ieee
),
4079 /* ieee_get_reloc_upper_bound, ieee_canonicalize_reloc,
4080 ieee_bfd_reloc_type_lookup */
4081 BFD_JUMP_TABLE_RELOCS (ieee
),
4083 /* ieee_set_arch_mach, ieee_set_section_contents */
4084 BFD_JUMP_TABLE_WRITE (ieee
),
4086 /* ieee_sizeof_headers, ieee_bfd_get_relocated_section_contents,
4087 ieee_bfd_relax_section, ieee_bfd_link_hash_table_create,
4088 ieee_bfd_link_add_symbols, ieee_bfd_final_link,
4089 ieee_bfd_link_split_section, ieee_bfd_gc_sections,
4090 ieee_bfd_merge_sections */
4091 BFD_JUMP_TABLE_LINK (ieee
),
4093 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic
),