3 bfd backend for ieee objects.
7 IEEE 695 format is a stream of records, which we parse using a simple one
8 token (which is one byte in this lexicon) lookahead recursive decent
23 #define obstack_chunk_alloc malloc
24 #define obstack_chunk_free free
25 #define ieee_malloc(abfd,size) \
26 obstack_alloc(&( ieee_data(abfd)->ieee_obstack), (size))
28 typedef void generic_symbol_type
;
31 /***************************************************************************
32 Functions for writing to ieee files in the strange way that the
38 DEFUN(ieee_write_byte
,(abfd
, byte
),
42 bfd_write(&byte
, 1, 1, abfd
);
47 DEFUN(ieee_write_2bytes
,(abfd
, bytes
),
52 buffer
[0] = bytes
>> 8;
53 buffer
[1] = bytes
& 0xff;
55 bfd_write(buffer
, 1, 2, abfd
);
59 DEFUN(ieee_write_int
,(abfd
, value
),
63 if (value
>= 0 && value
<= 127) {
64 ieee_write_byte(abfd
, value
);
68 /* How many significant bytes ? */
69 /* FIXME FOR LONGER INTS */
70 if (value
& 0xff000000) {
73 else if (value
& 0x00ff0000) {
76 else if (value
& 0x0000ff00) {
81 ieee_write_byte(abfd
, ieee_number_repeat_start_enum
+ length
);
84 ieee_write_byte(abfd
, value
>> 24);
86 ieee_write_byte(abfd
, value
>> 16);
88 ieee_write_byte(abfd
, value
>> 8);
90 ieee_write_byte(abfd
, value
);
96 DEFUN(ieee_write_id
,(abfd
, id
),
100 size_t length
= strlen(id
);
101 if (length
>= 0 && length
<= 127) {
102 ieee_write_byte(abfd
, length
);
104 else if (length
< 255) {
105 ieee_write_byte(abfd
, ieee_extension_length_1_enum
);
106 ieee_write_byte(abfd
, length
);
108 else if (length
< 65535) {
109 ieee_write_byte(abfd
, ieee_extension_length_2_enum
);
110 ieee_write_byte(abfd
, length
>> 8);
111 ieee_write_byte(abfd
, length
& 0xff);
116 bfd_write((bfd_byte
*)id
, 1, length
, abfd
);
118 /***************************************************************************
119 Functions for reading from ieee files in the strange way that the
123 #define this_byte(abfd) *(ptr(abfd))
124 #define next_byte(abfd) (ptr(abfd)++)
125 #define this_byte_and_next(abfd) *(ptr(abfd)++)
128 static unsigned short
129 DEFUN(read_2bytes
,(abfd
),
132 unsigned char c1
= this_byte_and_next(abfd
);
133 unsigned char c2
= this_byte_and_next(abfd
);
134 return (c1
<<8 ) | c2
;
139 DEFUN(bfd_get_string
,(abfd
, string
, length
),
145 for (i
= 0; i
< length
; i
++) {
146 string
[i
] = this_byte_and_next(abfd
);
151 DEFUN(read_id
,(abfd
),
156 length
= this_byte_and_next(abfd
);
157 if (length
>= 0x00 && length
<= 0x7f) {
158 /* Simple string of length 0 to 127 */
160 else if (length
== 0xde) {
161 /* Length is next byte, allowing 0..255 */
162 length
= this_byte_and_next(abfd
);
164 else if (length
== 0xdf) {
165 /* Length is next two bytes, allowing 0..65535 */
166 length
= this_byte_and_next(abfd
) ;
167 length
= (length
* 256) + this_byte_and_next(abfd
);
169 /* Buy memory and read string */
170 string
= ieee_malloc(abfd
, length
+1);
171 bfd_get_string(abfd
, string
, length
);
177 DEFUN(ieee_write_expression
,(abfd
, value
, section
, symbol
),
180 asection
*section AND
183 unsigned int plus_count
= 0;
184 ieee_write_int(abfd
, value
);
185 if (section
!= (asection
*)NULL
) {
187 ieee_write_byte(abfd
, ieee_variable_L_enum
);
188 ieee_write_byte(abfd
, section
->index
+IEEE_SECTION_NUMBER_BASE
);
191 if (symbol
!= (asymbol
*)NULL
) {
193 if ((symbol
->flags
& BSF_UNDEFINED
) ||
194 (symbol
->flags
& BSF_FORT_COMM
)) {
195 ieee_write_byte(abfd
, ieee_variable_X_enum
);
196 ieee_write_int(abfd
, symbol
->value
);
198 else if (symbol
->flags
& BSF_GLOBAL
) {
199 ieee_write_byte(abfd
, ieee_variable_I_enum
);
200 ieee_write_int(abfd
, symbol
->value
);
202 else if (symbol
->flags
& BSF_LOCAL
) {
203 /* This is a reference to a defined local symbol,
204 We can easily do a local as a section+offset */
205 if (symbol
->section
!= (asection
*)NULL
) {
206 /* If this symbol is not absolute, add the base of it */
207 ieee_write_byte(abfd
, ieee_variable_L_enum
);
208 ieee_write_byte(abfd
, symbol
->section
->index
+
209 IEEE_SECTION_NUMBER_BASE
);
213 ieee_write_int(abfd
, symbol
->value
);
221 while (plus_count
!= 0) {
222 ieee_write_byte(abfd
, ieee_function_plus_enum
);
236 /*****************************************************************************/
239 writes any integer into the buffer supplied and always takes 5 bytes
242 DEFUN(ieee_write_int5
,(buffer
, value
),
246 buffer
[0] = ieee_number_repeat_4_enum
;
247 buffer
[1] = (value
>> 24 ) & 0xff;
248 buffer
[2] = (value
>> 16 ) & 0xff;
249 buffer
[3] = (value
>> 8 ) & 0xff;
250 buffer
[4] = (value
>> 0 ) & 0xff;
253 DEFUN(ieee_write_int5_out
, (abfd
, value
),
258 ieee_write_int5(b
, value
);
259 bfd_write(b
,1,5,abfd
);
264 DEFUN(parse_int
,(abfd
, value_ptr
),
268 int value
= this_byte(abfd
);
270 if (value
>= 0 && value
<= 127) {
275 else if (value
>= 0x80 && value
<= 0x88) {
276 unsigned int count
= value
& 0xf;
280 result
=(result
<< 8) | this_byte_and_next(abfd
);
289 DEFUN(parse_i
,(abfd
, ok
),
294 *ok
= parse_int(abfd
, &x
);
299 DEFUN(must_parse_int
,(abfd
),
303 BFD_ASSERT(parse_int(abfd
, &result
) == true);
311 ieee_symbol_index_type symbol
;
316 reloc_howto_type abs32_howto
317 = HOWTO(1,0,2,32,0,0,0,true,0,"abs32",false,0xffffffff, 0xffffffff,false);
319 reloc_howto_type abs16_howto
320 = HOWTO(1,0,1,16,0,0,0,true,0,"abs16",false,0x0000ffff, 0x0000ffff,false);
322 static ieee_symbol_index_type NOSYMBOL
= { 0, 0};
326 DEFUN(parse_expression
,(abfd
, value
, section
, symbol
, pcrel
, extra
),
329 asection
**section AND
330 ieee_symbol_index_type
*symbol AND
341 ieee_value_type stack
[10];
343 /* The stack pointer always points to the next unused location */
344 #define PUSH(x,y,z) TOS.symbol=x;TOS.section=y;TOS.value=z;INC;
345 #define POP(x,y,z) DEC;x=TOS.symbol;y=TOS.section;z=TOS.value;
346 ieee_value_type
*sp
= stack
;
349 switch (this_byte(abfd
))
351 case ieee_variable_P_enum
:
352 /* P variable, current program counter for section n */
356 section_n
= must_parse_int(abfd
);
358 TOS
.value
= ieee_data(abfd
)->section_table
[section_n
]->vma
+
359 ieee_per_section(ieee_data(abfd
)->section_table
[section_n
])->pc
);
362 case ieee_variable_L_enum
:
363 /* L variable address of section N */
365 PUSH(NOSYMBOL
,ieee_data(abfd
)->section_table
[must_parse_int(abfd
)],0);
367 case ieee_variable_R_enum
:
368 /* R variable, logical address of section module */
369 /* FIXME, this should be different to L */
371 PUSH(NOSYMBOL
,ieee_data(abfd
)->section_table
[must_parse_int(abfd
)],0);
373 case ieee_variable_S_enum
:
374 /* S variable, size in MAUS of section module */
378 ieee_data(abfd
)->section_table
[must_parse_int(abfd
)]->size
);
381 case ieee_variable_X_enum
:
382 /* Push the address of external variable n */
384 ieee_symbol_index_type sy
;
386 sy
.index
= (int)(must_parse_int(abfd
)) ;
392 case ieee_function_minus_enum
:
394 bfd_vma value1
, value2
;
396 ieee_symbol_index_type sy
;
399 POP(sy
, section
, value1
);
400 POP(sy
, section
, value2
);
401 PUSH(NOSYMBOL
, 0, value1
-value2
);
404 case ieee_function_plus_enum
:
406 bfd_vma value1
, value2
;
409 ieee_symbol_index_type sy1
;
410 ieee_symbol_index_type sy2
;
413 POP(sy1
, section1
, value1
);
414 POP(sy2
, section2
, value2
);
415 PUSH(sy1
.letter
? sy1
: sy2
, section1
? section1
: section2
, value1
+value2
);
421 BFD_ASSERT(this_byte(abfd
) < ieee_variable_A_enum
422 || this_byte(abfd
) > ieee_variable_Z_enum
);
423 if (parse_int(abfd
, &va
))
425 PUSH(NOSYMBOL
,0, va
);
429 Thats all that we can understand. As far as I can see
430 there is a bug in the Microtec IEEE output which I'm
431 using to scan, whereby the comma operator is ommited
432 sometimes in an expression, giving expressions with too
433 many terms. We can tell if that's the case by ensuring
434 that sp == stack here. If not, then we've pushed
438 POP(*symbol
, *section
, *value
);
440 BFD_ASSERT(*section
== 0);
442 /* Get what should be returned */
443 POP(*symbol
, *section
, *value
);
458 #define ieee_seek(abfd, offset) \
459 ieee_data(abfd)->input_p = ieee_data(abfd)->first_byte + offset
462 DEFUN(ieee_slurp_external_symbols
,(abfd
),
465 ieee_data_type
*ieee
= ieee_data(abfd
);
466 file_ptr offset
= ieee
->w
.r
.external_part
;
468 ieee_symbol_type
**prev_symbols_ptr
= &ieee
->external_symbols
;
469 ieee_symbol_type
**prev_reference_ptr
= &ieee
->external_reference
;
470 ieee_symbol_type
*symbol
;
471 unsigned int symbol_count
= 0;
474 ieee
->symbol_table_full
= true;
476 ieee_seek(abfd
, offset
);
479 switch (this_byte(abfd
)) {
480 case ieee_external_symbol_enum
:
482 symbol
= (ieee_symbol_type
*)ieee_malloc(abfd
, sizeof(ieee_symbol_type
));
484 *prev_symbols_ptr
= symbol
;
485 prev_symbols_ptr
= &symbol
->next
;
486 symbol
->index
= must_parse_int(abfd
);
487 if (symbol
->index
> ieee
->external_symbol_max_index
) {
488 ieee
->external_symbol_max_index
= symbol
->index
;
490 BFD_ASSERT (symbol
->index
>= ieee
->external_symbol_min_index
);
492 symbol
->symbol
.the_bfd
= abfd
;
493 symbol
->symbol
.name
= read_id(abfd
);
494 symbol
->symbol
.udata
= (void *)NULL
;
495 symbol
->symbol
.flags
= BSF_NO_FLAGS
;
497 case ieee_attribute_record_enum
>> 8:
499 unsigned int symbol_name_index
;
500 unsigned int symbol_type_index
;
501 unsigned int symbol_attribute_def
;
503 next_byte(abfd
); /* Skip prefix */
505 symbol_name_index
= must_parse_int(abfd
);
506 symbol_type_index
= must_parse_int(abfd
);
507 symbol_attribute_def
= must_parse_int(abfd
);
509 parse_int(abfd
,&value
);
513 case ieee_value_record_enum
>> 8:
515 unsigned int symbol_name_index
;
516 ieee_symbol_index_type symbol_ignore
;
517 boolean pcrel_ignore
;
518 unsigned int extra_ignore
;
522 symbol_name_index
= must_parse_int(abfd
);
523 parse_expression(abfd
,
524 &symbol
->symbol
.value
,
525 &symbol
->symbol
.section
,
529 if (symbol
->symbol
.section
!= (asection
*)NULL
) {
530 symbol
->symbol
.flags
= BSF_GLOBAL
| BSF_EXPORT
;
533 symbol
->symbol
.flags
= BSF_GLOBAL
| BSF_EXPORT
| BSF_ABSOLUTE
;
537 case ieee_weak_external_reference_enum
:
541 /* Throw away the external reference index */
542 (void)must_parse_int(abfd
);
543 /* Fetch the default size if not resolved */
544 size
= must_parse_int(abfd
);
545 /* Fetch the defautlt value if available */
546 if ( parse_int(abfd
, &value
) == false) {
549 /* This turns into a common */
550 symbol
->symbol
.flags
= BSF_FORT_COMM
;
551 symbol
->symbol
.value
= size
;
555 case ieee_external_reference_enum
:
557 symbol
= (ieee_symbol_type
*)ieee_malloc(abfd
, sizeof(ieee_symbol_type
));
559 *prev_reference_ptr
= symbol
;
560 prev_reference_ptr
= &symbol
->next
;
561 symbol
->index
= must_parse_int(abfd
);
562 symbol
->symbol
.the_bfd
= abfd
;
563 symbol
->symbol
.name
= read_id(abfd
);
564 symbol
->symbol
.udata
= (void *)NULL
;
565 symbol
->symbol
.section
= (asection
*)NULL
;
566 symbol
->symbol
.value
= (bfd_vma
)0;
567 symbol
->symbol
.flags
= BSF_UNDEFINED
;
568 if (symbol
->index
> ieee
->external_reference_max_index
) {
569 ieee
->external_reference_max_index
= symbol
->index
;
571 BFD_ASSERT (symbol
->index
>= ieee
->external_reference_min_index
);
579 if (ieee
->external_symbol_max_index
!= 0) {
580 ieee
->external_symbol_count
=
581 ieee
->external_symbol_max_index
-
582 ieee
->external_symbol_min_index
+ 1 ;
585 ieee
->external_symbol_count
= 0;
589 if(ieee
->external_reference_max_index
!= 0) {
590 ieee
->external_reference_count
=
591 ieee
->external_reference_max_index
-
592 ieee
->external_reference_min_index
+ 1;
595 ieee
->external_reference_count
= 0;
599 ieee
->external_reference_count
+ ieee
->external_symbol_count
;
601 if (symbol_count
!= abfd
->symcount
) {
602 /* There are gaps in the table -- */
603 ieee
->symbol_table_full
= false;
605 *prev_symbols_ptr
= (ieee_symbol_type
*)NULL
;
606 *prev_reference_ptr
= (ieee_symbol_type
*)NULL
;
610 DEFUN(ieee_slurp_symbol_table
,(abfd
),
613 if (ieee_data(abfd
)->read_symbols
== false) {
614 ieee_slurp_external_symbols(abfd
);
615 ieee_data(abfd
)->read_symbols
= true;
620 DEFUN(ieee_get_symtab_upper_bound
,(abfd
),
623 ieee_slurp_symbol_table (abfd
);
625 return (abfd
->symcount
!= 0) ?
626 (abfd
->symcount
+1) * (sizeof (ieee_symbol_type
*)) : 0;
630 Move from our internal lists to the canon table, and insert in
634 extern bfd_target ieee_vec
;
637 DEFUN(ieee_get_symtab
,(abfd
, location
),
641 ieee_symbol_type
*symp
;
642 static bfd dummy_bfd
;
643 static asymbol empty_symbol
=
644 { &dummy_bfd
," ieee empty",(symvalue
)0,BSF_DEBUGGING
| BSF_FAKE
};
646 ieee_data_type
*ieee
= ieee_data(abfd
);
647 dummy_bfd
.xvec
= &ieee_vec
;
648 ieee_slurp_symbol_table(abfd
);
650 if (ieee
->symbol_table_full
== false) {
651 /* Arrgh - there are gaps in the table, run through and fill them */
652 /* up with pointers to a null place */
654 for (i
= 0; i
< abfd
->symcount
; i
++) {
655 location
[i
] = &empty_symbol
;
660 ieee
->external_symbol_base_offset
= - ieee
->external_symbol_min_index
;
661 for (symp
= ieee_data(abfd
)->external_symbols
;
662 symp
!= (ieee_symbol_type
*)NULL
;
664 /* Place into table at correct index locations */
665 location
[symp
->index
+ ieee
->external_symbol_base_offset
] = &symp
->symbol
;
669 /* The external refs are indexed in a bit */
670 ieee
->external_reference_base_offset
=
671 - ieee
->external_reference_min_index
+ieee
->external_symbol_count
;
673 for (symp
= ieee_data(abfd
)->external_reference
;
674 symp
!= (ieee_symbol_type
*)NULL
;
676 location
[symp
->index
+ ieee
->external_reference_base_offset
] =
683 location
[abfd
->symcount
] = (asymbol
*)NULL
;
685 return abfd
->symcount
;
690 DEFUN(ieee_slurp_sections
,(abfd
),
693 ieee_data_type
*ieee
= ieee_data(abfd
);
694 file_ptr offset
= ieee
->w
.r
.section_part
;
696 asection
*section
= (asection
*)NULL
;
699 bfd_byte section_type
[3];
700 ieee_seek(abfd
, offset
);
702 switch (this_byte(abfd
)) {
703 case ieee_section_type_enum
:
705 unsigned int section_index
;
707 section_index
= must_parse_int(abfd
);
708 /* Fixme to be nice about a silly number of sections */
709 BFD_ASSERT(section_index
< NSECTIONS
);
711 section
= bfd_make_section(abfd
, " tempname");
712 ieee
->section_table
[section_index
] = section
;
713 section
->flags
= SEC_NO_FLAGS
;
714 section
->target_index
= section_index
;
715 section_type
[0] = this_byte_and_next(abfd
);
716 switch (section_type
[0]) {
718 section_type
[1] = this_byte(abfd
);
719 section
->flags
= SEC_LOAD
;
720 switch (section_type
[1]) {
724 section
->flags
|= SEC_LOAD
| SEC_CODE
;
728 section
->flags
|= SEC_LOAD
| SEC_DATA
;
733 /* Normal rom data */
734 section
->flags
|= SEC_LOAD
| SEC_ROM
| SEC_DATA
;
740 section
->name
= read_id(abfd
);
741 { bfd_vma parent
, brother
, context
;
742 parse_int(abfd
, &parent
);
743 parse_int(abfd
, &brother
);
744 parse_int(abfd
, &context
);
750 case ieee_section_alignment_enum
:
752 unsigned int section_index
;
755 section_index
= must_parse_int(abfd
);
756 if (section_index
> ieee
->section_count
) {
757 ieee
->section_count
= section_index
;
759 ieee
->section_table
[section_index
]->alignment_power
=
760 bfd_log2(must_parse_int(abfd
));
761 (void)parse_int(abfd
, & value
);
764 case ieee_e2_first_byte_enum
:
766 ieee_record_enum_type t
= read_2bytes(abfd
);
768 case ieee_section_size_enum
:
769 section
= ieee
->section_table
[must_parse_int(abfd
)];
770 section
->size
= must_parse_int(abfd
);
772 case ieee_physical_region_size_enum
:
773 section
= ieee
->section_table
[must_parse_int(abfd
)];
774 section
->size
= must_parse_int(abfd
);
776 case ieee_region_base_address_enum
:
777 section
= ieee
->section_table
[must_parse_int(abfd
)];
778 section
->vma
= must_parse_int(abfd
);
780 case ieee_mau_size_enum
:
781 must_parse_int(abfd
);
782 must_parse_int(abfd
);
784 case ieee_m_value_enum
:
785 must_parse_int(abfd
);
786 must_parse_int(abfd
);
788 case ieee_section_base_address_enum
:
789 section
= ieee
->section_table
[must_parse_int(abfd
)];
790 section
->vma
= must_parse_int(abfd
);
792 case ieee_section_offset_enum
:
793 (void) must_parse_int(abfd
);
794 (void) must_parse_int(abfd
);
808 /***********************************************************************
812 DEFUN(ieee_archive_p
,(abfd
),
817 ieee_ar_data_type
*ar
;
819 return 0; /* FIXME */
820 ieee_seek(abfd
, (file_ptr
) 0);
821 if (this_byte(abfd
) != Module_Beginning
) return (bfd_target
*)NULL
;
823 library
= read_id(abfd
);
824 if (strcmp(library
, "LIBRARY") != 0) {
826 return (bfd_target
*)NULL
;
828 /* Throw away the filename */
829 free( read_id(abfd
));
830 /* This must be an IEEE archive, so we'll buy some space to do
832 ar
= (ieee_ar_data_type
*) malloc(sizeof(ieee_ar_data_type
));
833 ieee_ar_data(abfd
) = ar
;
834 ar
->element_count
= 0;
835 ar
->element_index
= 0;
836 obstack_init(&ar
->element_obstack
);
838 next_byte(abfd
); /* Drop the ad part */
839 must_parse_int(abfd
); /* And the two dummy numbers */
840 must_parse_int(abfd
);
843 /* Read the index of the BB table */
845 ieee_ar_obstack_type t
;
846 int rec
=read_2bytes(abfd
);
847 if (rec
==ieee_assign_value_to_variable_enum
) {
848 int record_number
= must_parse_int(abfd
);
849 t
.file_offset
= must_parse_int(abfd
);
850 t
.abfd
= (bfd
*)NULL
;
852 obstack_grow(&ar
->element_obstack
, (PTR
)&t
, sizeof(t
));
856 ar
->elements
= (ieee_ar_obstack_type
*)obstack_base(&ar
->element_obstack
);
858 /* Now scan the area again, and replace BB offsets with file */
862 for (i
= 2; i
< ar
->element_count
; i
++) {
863 ieee_seek(abfd
, ar
->elements
[i
].file_offset
);
864 next_byte(abfd
); /* Drop F8 */
865 next_byte(abfd
); /* Drop 14 */
866 must_parse_int(abfd
); /* Drop size of block */
867 if (must_parse_int(abfd
) != 0) {
868 /* This object has been deleted */
869 ar
->elements
[i
].file_offset
= 0;
872 ar
->elements
[i
].file_offset
= must_parse_int(abfd
);
876 obstack_finish(&ar
->element_obstack
);
881 DEFUN(ieee_mkobject
,(abfd
),
884 struct obstack tmp_obstack
;
885 ieee_data_type
*ieee
;
886 obstack_init(&tmp_obstack
);
887 BFD_ASSERT(ieee_data(abfd
) == 0);
889 (ieee_data_type
*)obstack_alloc(&tmp_obstack
,sizeof(ieee_data_type
));
890 ieee
= ieee_data(abfd
);
891 ieee
->ieee_obstack
= tmp_obstack
;
896 DEFUN(ieee_object_p
,(abfd
),
901 ieee_data_type
*ieee
;
906 ieee
= ieee_data(abfd
);
908 /* Read the first few bytes in to see if it makes sense */
909 bfd_read(buffer
, 1, sizeof(buffer
), abfd
);
912 if (*(ptr(abfd
)++) != Module_Beginning
) goto fail
;
914 ieee
->read_symbols
= false;
915 ieee
->read_data
= false;
916 ieee
->section_count
= 0;
917 ieee
->external_symbol_max_index
= 0;
918 ieee
->external_symbol_min_index
= IEEE_PUBLIC_BASE
;
919 ieee
->external_reference_min_index
=IEEE_REFERENCE_BASE
;
920 ieee
->external_reference_max_index
= 0;
921 memset((PTR
)ieee
->section_table
, 0, sizeof(ieee
->section_table
));
923 processor
= ieee
->mb
.processor
= read_id(abfd
);
924 if (strcmp(processor
,"LIBRARY") == 0) goto fail
;
925 ieee
->mb
.module_name
= read_id(abfd
);
926 if (abfd
->filename
== (char *)NULL
) {
927 abfd
->filename
= ieee
->mb
.module_name
;
929 /* Determine the architecture and machine type of the object file. */
930 bfd_scan_arch_mach(processor
, &abfd
->obj_arch
, &abfd
->obj_machine
);
932 if (this_byte(abfd
) != ieee_address_descriptor_enum
) {
937 if (parse_int(abfd
, &ieee
->ad
.number_of_bits_mau
) == false) {
940 if(parse_int(abfd
, &ieee
->ad
.number_of_maus_in_address
) == false) {
944 /* If there is a byte order info, take it */
945 if (this_byte(abfd
) == ieee_variable_L_enum
||
946 this_byte(abfd
) == ieee_variable_M_enum
)
950 for (part
= 0; part
< N_W_VARIABLES
; part
++) {
952 if (read_2bytes(abfd
) != ieee_assign_value_to_variable_enum
) {
955 if (this_byte_and_next(abfd
) != part
) {
959 ieee
->w
.offset
[part
] = parse_i(abfd
, &ok
);
965 abfd
->flags
= HAS_SYMS
;
967 /* By now we know that this is a real IEEE file, we're going to read
968 the whole thing into memory so that we can run up and down it
969 quickly. We can work out how big the file is from the trailer
972 ieee_data(abfd
)->first_byte
= ieee_malloc(abfd
, ieee
->w
.r
.me_record
974 bfd_seek(abfd
, 0, 0);
975 bfd_read(ieee_data(abfd
)->first_byte
, 1, ieee
->w
.r
.me_record
+50, abfd
);
977 ieee_slurp_sections(abfd
);
980 obstack_finish(&ieee
->ieee_obstack
);
981 return (bfd_target
*)NULL
;
986 DEFUN(ieee_print_symbol
,(ignore_abfd
, file
, symbol
, how
),
990 bfd_print_symbol_enum_type how
)
993 case bfd_print_symbol_name_enum
:
994 fprintf(file
,"%s", symbol
->name
);
996 case bfd_print_symbol_type_enum
:
998 fprintf(file
,"%4x %2x",aout_symbol(symbol
)->desc
& 0xffff,
999 aout_symbol(symbol
)->other
& 0xff);
1003 case bfd_print_symbol_all_enum
:
1005 CONST
char *section_name
= symbol
->section
== (asection
*)NULL
?
1006 "*abs" : symbol
->section
->name
;
1008 bfd_print_symbol_vandf((void *)file
,symbol
);
1010 fprintf(file
," %-5s %04x %02x %s",
1012 (unsigned) ieee_symbol(symbol
)->index
,
1014 aout_symbol(symbol)->desc & 0xffff,
1015 aout_symbol(symbol)->other & 0xff,*/
1024 /* Read in all the section data and relocation stuff too */
1026 DEFUN(ieee_slurp_section_data
,(abfd
),
1029 bfd_byte
*location_ptr
;
1030 ieee_data_type
*ieee
= ieee_data(abfd
);
1031 unsigned int section_number
;
1033 ieee_per_section_type
*current_map
;
1035 /* Seek to the start of the data area */
1036 if (ieee
->read_data
== true) return true;
1037 ieee
->read_data
= true;
1038 ieee_seek(abfd
, ieee
->w
.r
.data_part
);
1040 /* Allocate enough space for all the section contents */
1043 for (s
= abfd
->sections
; s
!= (asection
*)NULL
; s
= s
->next
) {
1044 ieee_per_section_type
*per
= (ieee_per_section_type
*) s
->used_by_bfd
;
1045 per
->data
= (bfd_byte
*) ieee_malloc(abfd
, s
->size
);
1047 per
->reloc_tail_ptr
=
1048 (ieee_reloc_type
**)&(s
->relocation
);
1054 switch (this_byte(abfd
))
1056 /* IF we see anything strange then quit */
1060 case ieee_set_current_section_enum
:
1062 section_number
= must_parse_int(abfd
);
1063 s
= ieee
->section_table
[section_number
];
1064 current_map
= (ieee_per_section_type
*) s
->used_by_bfd
;
1065 location_ptr
= current_map
->data
- s
->vma
;
1066 /* The document I have says that Microtec's compilers reset */
1067 /* this after a sec section, even though the standard says not */
1069 current_map
->pc
=s
->vma
;
1072 case ieee_load_constant_bytes_enum
:
1074 unsigned int number_of_maus
;
1077 number_of_maus
= must_parse_int(abfd
);
1079 for (i
= 0; i
< number_of_maus
; i
++) {
1080 location_ptr
[current_map
->pc
++]= this_byte(abfd
);
1086 case ieee_e2_first_byte_enum
:
1088 switch (this_byte(abfd
))
1090 case ieee_set_current_pc_enum
& 0xff:
1094 ieee_symbol_index_type symbol
;
1098 must_parse_int(abfd
); /* Thow away section #*/
1099 parse_expression(abfd
, &value
, &dsection
, &symbol
, &pcrel
, &extra
);
1100 current_map
->pc
= value
;
1101 BFD_ASSERT((unsigned)(value
- s
->vma
) <= s
->size
);
1105 case ieee_value_starting_address_enum
& 0xff:
1106 /* We've got to the end of the data now - */
1114 case ieee_load_with_relocation_enum
:
1116 boolean loop
= true;
1120 switch (this_byte(abfd
))
1122 case ieee_variable_R_enum
:
1124 case ieee_function_signed_open_b_enum
:
1125 case ieee_function_unsigned_open_b_enum
:
1126 case ieee_function_either_open_b_enum
:
1131 ieee_reloc_type
*r
=
1132 (ieee_reloc_type
*) ieee_malloc(abfd
,
1133 sizeof(ieee_reloc_type
));
1135 *(current_map
->reloc_tail_ptr
) = r
;
1136 current_map
->reloc_tail_ptr
= &r
->next
;
1137 r
->next
= (ieee_reloc_type
*)NULL
;
1139 parse_expression(abfd
,
1145 r
->relent
.address
= current_map
->pc
;
1147 switch (this_byte(abfd
)) {
1148 case ieee_function_signed_close_b_enum
:
1151 case ieee_function_unsigned_close_b_enum
:
1154 case ieee_function_either_close_b_enum
:
1160 /* Build a relocation entry for this type */
1161 if (this_byte(abfd
) == ieee_comma
) {
1164 /* Fetch number of bytes to pad */
1165 extra
= must_parse_int(abfd
);
1171 location_ptr
[current_map
->pc
++] = 0;
1172 location_ptr
[current_map
->pc
++] = 0;
1173 location_ptr
[current_map
->pc
++] = 0;
1174 location_ptr
[current_map
->pc
++] = 0;
1175 r
->relent
.howto
= &abs32_howto
;
1178 location_ptr
[current_map
->pc
++] = 0;
1179 location_ptr
[current_map
->pc
++] = 0;
1180 r
->relent
.howto
= &abs16_howto
;
1192 if (parse_int(abfd
, &this_size
) == true) {
1194 for (i
= 0; i
< this_size
; i
++) {
1195 location_ptr
[current_map
->pc
++] = this_byte(abfd
);
1213 DEFUN(ieee_new_section_hook
,(abfd
, newsect
),
1217 newsect
->used_by_bfd
= (PTR
)
1218 ieee_malloc(abfd
, sizeof(ieee_per_section_type
));
1219 ieee_per_section( newsect
)->data
= (bfd_byte
*)NULL
;
1220 ieee_per_section(newsect
)->section
= newsect
;
1226 DEFUN(ieee_get_reloc_upper_bound
,(abfd
, asect
),
1230 ieee_slurp_section_data(abfd
);
1231 return (asect
->reloc_count
+1) * sizeof(arelent
*);
1235 DEFUN(ieee_get_section_contents
,(abfd
, section
, location
, offset
, count
),
1242 ieee_per_section_type
*p
= (ieee_per_section_type
*) section
->used_by_bfd
;
1243 ieee_slurp_section_data(abfd
);
1244 (void) memcpy(location
, p
->data
+ offset
, count
);
1250 DEFUN(ieee_canonicalize_reloc
,(abfd
, section
, relptr
, symbols
),
1253 arelent
**relptr AND
1256 ieee_per_section_type
*p
= (ieee_per_section_type
*) section
->used_by_bfd
;
1257 ieee_reloc_type
*src
= (ieee_reloc_type
*)(section
->relocation
);
1258 ieee_data_type
*ieee
= ieee_data(abfd
);
1260 while (src
!= (ieee_reloc_type
*)NULL
) {
1261 /* Work out which symbol to attatch it this reloc to */
1262 switch (src
->symbol
.letter
) {
1264 src
->relent
.sym_ptr_ptr
=
1265 symbols
+ src
->symbol
.index
+ ieee
->external_reference_base_offset
;
1268 src
->relent
.sym_ptr_ptr
= (asymbol
**)NULL
;
1274 *relptr
++ = &src
->relent
;
1277 *relptr
= (arelent
*)NULL
;
1278 return section
->reloc_count
;
1282 DEFUN(ieee_set_arch_mach
,(abfd
, arch
, machine
),
1284 enum bfd_architecture arch AND
1285 unsigned long machine
)
1287 abfd
->obj_arch
= arch
;
1288 abfd
->obj_machine
= machine
;
1294 DEFUN(comp
,(ap
, bp
),
1298 arelent
*a
= *((arelent
**)ap
);
1299 arelent
*b
= *((arelent
**)bp
);
1300 return a
->address
- b
->address
;
1304 Write the section headers
1308 DEFUN(ieee_write_section_part
,(abfd
),
1311 ieee_data_type
*ieee
= ieee_data(abfd
);
1313 ieee
->w
.r
.section_part
= bfd_tell(abfd
);
1314 for (s
= abfd
->sections
; s
!= (asection
*)NULL
; s
=s
->next
) {
1315 ieee_write_byte(abfd
, ieee_section_type_enum
);
1316 ieee_write_byte(abfd
, s
->index
+ IEEE_SECTION_NUMBER_BASE
);
1318 switch (s
->flags
& (SEC_LOAD
| SEC_CODE
| SEC_DATA
| SEC_ROM
)) {
1319 case SEC_LOAD
| SEC_CODE
:
1320 /* Normal named section, code */
1321 ieee_write_byte(abfd
, ieee_variable_C_enum
);
1322 ieee_write_byte(abfd
, ieee_variable_P_enum
);
1324 case SEC_LOAD
| SEC_DATA
:
1325 /* Normal named section, data */
1326 ieee_write_byte(abfd
, ieee_variable_C_enum
);
1327 ieee_write_byte(abfd
, ieee_variable_D_enum
);
1329 case SEC_LOAD
| SEC_DATA
| SEC_ROM
:
1330 /* Normal named section, data rom */
1331 ieee_write_byte(abfd
, ieee_variable_C_enum
);
1332 ieee_write_byte(abfd
, ieee_variable_R_enum
);
1335 ieee_write_byte(abfd
, ieee_variable_C_enum
);
1339 ieee_write_id(abfd
, s
->name
);
1340 ieee_write_int(abfd
, 0); /* Parent */
1341 ieee_write_int(abfd
, 0); /* Brother */
1342 ieee_write_int(abfd
, 0); /* Context */
1345 ieee_write_byte(abfd
, ieee_section_alignment_enum
);
1346 ieee_write_byte(abfd
, s
->index
+ IEEE_SECTION_NUMBER_BASE
);
1347 ieee_write_int(abfd
, 1 << s
->alignment_power
);
1350 ieee_write_2bytes(abfd
, ieee_section_size_enum
);
1351 ieee_write_byte(abfd
, s
->index
+ IEEE_SECTION_NUMBER_BASE
);
1352 ieee_write_int(abfd
, s
->size
);
1355 ieee_write_2bytes(abfd
, ieee_region_base_address_enum
);
1356 ieee_write_byte(abfd
, s
->index
+ IEEE_SECTION_NUMBER_BASE
);
1357 ieee_write_int(abfd
, s
->vma
);
1364 /* write the data in an ieee way */
1366 DEFUN(ieee_write_data_part
,(abfd
),
1370 ieee_data_type
*ieee
= ieee_data(abfd
);
1371 ieee
->w
.r
.data_part
= bfd_tell(abfd
);
1372 for (s
= abfd
->sections
; s
!= (asection
*)NULL
; s
= s
->next
)
1374 bfd_byte header
[11];
1375 bfd_byte
*stream
= ieee_per_section(s
)->data
;
1376 arelent
**p
= s
->orelocation
;
1377 unsigned int relocs_to_go
= s
->reloc_count
;
1378 size_t current_byte_index
= 0;
1381 /* Sort the reloc records so we can insert them in the correct
1383 if (s
->reloc_count
!= 0) {
1384 qsort(s
->orelocation
,
1391 /* Output the section preheader */
1392 header
[0] =ieee_set_current_section_enum
;
1393 header
[1] = s
->index
+ IEEE_SECTION_NUMBER_BASE
;
1395 header
[2] = ieee_set_current_pc_enum
>> 8;
1396 header
[3]= ieee_set_current_pc_enum
& 0xff;
1397 header
[4] = s
->index
+ IEEE_SECTION_NUMBER_BASE
;
1398 ieee_write_int5(header
+5, s
->vma
);
1399 header
[10] = ieee_load_with_relocation_enum
;
1400 bfd_write(header
, 1, sizeof(header
), abfd
);
1402 /* Output the data stream as the longest sequence of bytes
1403 possible, allowing for the a reasonable packet size and
1404 relocation stuffs */
1406 if (stream
== (void *)NULL
) {
1407 /* Outputting a section without data, fill it up */
1408 stream
= ieee_malloc(abfd
, s
->size
);
1409 memset(stream
, 0, s
->size
);
1411 while (current_byte_index
< s
->size
) {
1413 unsigned int MAXRUN
= 32;
1415 run
= (*p
)->address
- current_byte_index
;
1420 if (run
> s
->size
- current_byte_index
) {
1421 run
= s
->size
- current_byte_index
;
1425 /* Output a stream of bytes */
1426 ieee_write_int(abfd
, run
);
1427 bfd_write(stream
+ current_byte_index
,
1431 current_byte_index
+= run
;
1433 /* Output any relocations here */
1434 if (relocs_to_go
&& (*p
) && (*p
)->address
== current_byte_index
) {
1435 while (relocs_to_go
&& (*p
) && (*p
)->address
== current_byte_index
) {
1438 ieee_write_byte(abfd
, ieee_function_either_open_b_enum
);
1439 if (r
->sym_ptr_ptr
!= (asymbol
**)NULL
) {
1440 ieee_write_expression(abfd
, r
->addend
,
1445 ieee_write_expression(abfd
, r
->addend
,
1449 ieee_write_byte(abfd
,
1450 ieee_function_either_close_b_enum
);
1454 /* FIXME !! Are all relocations 4 bytes ? */
1455 current_byte_index
+= 4;
1465 DEFUN(init_for_output
,(abfd
),
1469 for (s
= abfd
->sections
; s
!= (asection
*)NULL
; s
= s
->next
) {
1471 ieee_per_section(s
)->data
= (bfd_byte
*)(ieee_malloc(abfd
, s
->size
));
1476 /** exec and core file sections */
1478 /* set section contents is complicated with IEEE since the format is
1479 * not a byte image, but a record stream.
1482 DEFUN(ieee_set_section_contents
,(abfd
, section
, location
, offset
, count
),
1485 unsigned char *location AND
1489 if (ieee_per_section(section
)->data
== (bfd_byte
*)NULL
) {
1490 init_for_output(abfd
);
1492 (void) memcpy(ieee_per_section(section
)->data
+ offset
, location
, count
);
1497 write the external symbols of a file, IEEE considers two sorts of
1498 external symbols, public, and referenced. It uses to internal forms
1499 to index them as well. When we write them out we turn their symbol
1500 values into indexes from the right base.
1503 DEFUN(ieee_write_external_part
,(abfd
),
1507 ieee_data_type
*ieee
= ieee_data(abfd
);
1509 unsigned int reference_index
= IEEE_REFERENCE_BASE
;
1510 unsigned int public_index
= IEEE_PUBLIC_BASE
;
1511 ieee
->w
.r
.external_part
= bfd_tell(abfd
);
1512 if (abfd
->outsymbols
!= (asymbol
**)NULL
) {
1513 for (q
= abfd
->outsymbols
; *q
!= (asymbol
*)NULL
; q
++) {
1515 if (p
->flags
& BSF_UNDEFINED
) {
1516 /* This must be a symbol reference .. */
1517 ieee_write_byte(abfd
, ieee_external_reference_enum
);
1518 ieee_write_int(abfd
, reference_index
);
1519 ieee_write_id(abfd
, p
->name
);
1520 p
->value
= reference_index
;
1523 else if(p
->flags
& BSF_FORT_COMM
) {
1524 /* This is a weak reference */
1525 ieee_write_byte(abfd
, ieee_external_reference_enum
);
1526 ieee_write_int(abfd
, reference_index
);
1527 ieee_write_id(abfd
, p
->name
);
1528 ieee_write_byte(abfd
, ieee_weak_external_reference_enum
);
1529 ieee_write_int(abfd
, reference_index
);
1530 ieee_write_int(abfd
, p
->value
);
1531 ieee_write_int(abfd
, BFD_FORT_COMM_DEFAULT_VALUE
);
1532 p
->value
= reference_index
;
1535 else if(p
->flags
& BSF_GLOBAL
) {
1536 /* This must be a symbol definition */
1538 ieee_write_byte(abfd
, ieee_external_symbol_enum
);
1539 ieee_write_int(abfd
, public_index
);
1540 ieee_write_id(abfd
, p
->name
);
1542 /* Write out the value */
1543 ieee_write_2bytes(abfd
, ieee_value_record_enum
);
1544 ieee_write_int(abfd
, public_index
);
1545 if (p
->section
!= (asection
*)NULL
)
1547 ieee_write_expression(abfd
,
1548 p
->value
+ p
->section
->output_offset
,
1549 p
->section
->output_section
,
1554 ieee_write_expression(abfd
,
1559 p
->value
= public_index
;
1563 /* This can happen - when there are gaps in the symbols read */
1564 /* from an input ieee file */
1573 DEFUN(ieee_write_me_part
,(abfd
),
1576 ieee_data_type
*ieee
= ieee_data(abfd
);
1577 ieee
->w
.r
.me_record
= bfd_tell(abfd
);
1579 ieee_write_2bytes(abfd
, ieee_value_starting_address_enum
);
1580 ieee_write_int(abfd
, abfd
->start_address
);
1581 ieee_write_byte(abfd
, ieee_module_end_enum
);
1585 DEFUN(ieee_write_object_contents
,(abfd
),
1588 ieee_data_type
*ieee
= ieee_data(abfd
);
1591 /* Fast forward over the header area */
1592 bfd_seek(abfd
, 0, 0);
1593 ieee_write_byte(abfd
, ieee_module_beginning_enum
);
1595 ieee_write_id(abfd
, bfd_printable_arch_mach(abfd
->obj_arch
,
1596 abfd
->obj_machine
));
1597 ieee_write_id(abfd
, abfd
->filename
);
1598 ieee_write_byte(abfd
, ieee_address_descriptor_enum
);
1599 ieee_write_byte(abfd
, 8); /* Bits per MAU */
1600 ieee_write_byte(abfd
, 4); /* MAU's per address */
1602 /* Fast forward over the variable bits */
1603 old
= bfd_tell(abfd
);
1604 bfd_seek(abfd
, 8 * N_W_VARIABLES
, 1);
1607 First write the symbols, this changes their values into table
1608 indeces so we cant use it after this point
1610 ieee_write_external_part(abfd
);
1611 ieee_write_byte(abfd
, ieee_record_seperator_enum
);
1613 ieee_write_section_part(abfd
);
1614 ieee_write_byte(abfd
, ieee_record_seperator_enum
);
1616 Can only write the data once the symbols have been written since
1617 the data contains relocation information which points to the
1620 ieee_write_data_part(abfd
);
1621 ieee_write_byte(abfd
, ieee_record_seperator_enum
);
1624 At the end we put the end !
1626 ieee_write_me_part(abfd
);
1629 /* Generate the header */
1630 bfd_seek(abfd
, old
, false);
1632 for (i
= 0; i
< N_W_VARIABLES
; i
++) {
1633 ieee_write_2bytes(abfd
,ieee_assign_value_to_variable_enum
);
1634 ieee_write_byte(abfd
, i
);
1635 ieee_write_int5_out(abfd
, ieee
->w
.offset
[i
]);
1643 /* Native-level interface to symbols. */
1645 /* We read the symbols into a buffer, which is discarded when this
1646 function exits. We read the strings into a buffer large enough to
1647 hold them all plus all the cached symbol entries. */
1650 DEFUN(ieee_make_empty_symbol
,(abfd
),
1654 ieee_symbol_type
*new =
1655 (ieee_symbol_type
*)zalloc (sizeof (ieee_symbol_type
));
1656 new->symbol
.the_bfd
= abfd
;
1657 return &new->symbol
;
1662 DEFUN(ieee_reclaim_symbol_table
, (abfd
),
1668 if (!bfd_get_symcount (abfd
)) return;
1670 for (section
= abfd
->sections
; section
!= NULL
; section
= section
->next
)
1671 if (section
->relocation
) {
1672 free ((void *)section
->relocation
);
1673 section
->relocation
= NULL
;
1674 section
->reloc_count
= 0;
1677 bfd_get_symcount (abfd
) = 0;
1678 free ((void *)obj_aout_symbols (abfd
));
1679 obj_aout_symbols (abfd
) = (aout_symbol_type
*)NULL
;
1686 /* Obsolete procedural interface; better to look at the cache directly */
1688 /* User should have checked the file flags; perhaps we should return
1689 BFD_NO_MORE_SYMBOLS if there are none? */
1692 DEFUN(ieee_get_symcount_upper_bound
,(abfd
),
1696 /* In case we're doing an output file or something...? */
1697 if (bfd_get_symcount (abfd
)) return bfd_get_symcount (abfd
);
1699 return (exec_hdr (abfd
)->a_syms
) / (sizeof (struct nlist
));
1705 DEFUN(ieee_get_first_symbol
,(ignore_abfd
),
1712 DEFUN(ieee_get_next_symbol
,(abfd
, oidx
),
1717 if (oidx
== BFD_NO_MORE_SYMBOLS
) return BFD_NO_MORE_SYMBOLS
;
1718 return ++oidx
>= bfd_get_symcount (abfd
) ? BFD_NO_MORE_SYMBOLS
:
1725 ieee_symbol_name (abfd
, idx
)
1730 return (obj_aout_symbols (abfd
) + idx
)->symbol
.name
;
1736 ieee_symbol_value (abfd
, idx
)
1741 return (obj_aout_symbols (abfd
) + idx
)->symbol
.value
;
1747 ieee_classify_symbol (abfd
, idx
)
1752 aout_symbol_type
*sym
= obj_aout_symbols (abfd
) + idx
;
1754 if ((sym
->symbol
.flags
& BSF_FORT_COMM
) != 0) return bfd_symclass_fcommon
;
1755 if ((sym
->symbol
.flags
& BSF_GLOBAL
) != 0) return bfd_symclass_global
;
1756 if ((sym
->symbol
.flags
& BSF_DEBUGGING
) != 0) return bfd_symclass_debugger
;
1757 if ((sym
->symbol
.flags
& BSF_UNDEFINED
) != 0) return bfd_symclass_undefined
;
1759 return bfd_symclass_unknown
;
1763 ieee_symbol_hasclass (abfd
, idx
, class)
1769 aout_symbol_type
*sym
= obj_aout_symbols (abfd
) + idx
;
1771 case bfd_symclass_fcommon
:
1772 return (sym
->symbol
.flags
& BSF_FORT_COMM
) ? true :false;
1773 case bfd_symclass_global
:
1774 return (sym
->symbol
.flags
& BSF_GLOBAL
) ? true:false;
1775 case bfd_symclass_debugger
:
1776 return (sym
->symbol
.flags
& BSF_DEBUGGING
) ? true:false;;
1777 case bfd_symclass_undefined
:
1778 return (sym
->symbol
.flags
& BSF_UNDEFINED
) ? true:false;;
1779 default: return false;
1787 ieee_reclaim_reloc (ignore_abfd
, section
)
1792 if (section
->relocation
) {
1793 free (section
->relocation
);
1794 section
->relocation
= NULL
;
1795 section
->reloc_count
= 0;
1801 ieee_close_and_cleanup (abfd
)
1804 if (bfd_read_p (abfd
) == false)
1805 switch (abfd
->format
) {
1807 if (!_bfd_write_archive_contents (abfd
)) {
1812 if (!ieee_write_object_contents (abfd
)) {
1817 bfd_error
= invalid_operation
;
1822 if (ieee_data(abfd
) != (ieee_data_type
*)NULL
) {
1823 /* FIXME MORE LEAKS */
1831 ieee_openr_next_archived_file(arch
, prev
)
1835 ieee_ar_data_type
*ar
= ieee_ar_data(arch
);
1836 /* take the next one from the arch state, or reset */
1837 if (prev
== (bfd
*)NULL
) {
1838 /* Reset the index - the first two entries are bogus*/
1839 ar
->element_index
= 2;
1842 ieee_ar_obstack_type
*p
= ar
->elements
+ ar
->element_index
;
1843 ar
->element_index
++;
1844 if (ar
->element_index
<= ar
->element_count
) {
1845 if (p
->file_offset
!= (file_ptr
)0) {
1846 if (p
->abfd
== (bfd
*)NULL
) {
1847 p
->abfd
= _bfd_create_empty_archive_element_shell(arch
);
1848 p
->abfd
->origin
= p
->file_offset
;
1861 ieee_find_nearest_line(abfd
,
1872 char **filename_ptr
;
1873 char **functionname_ptr
;
1874 unsigned int *line_ptr
;
1882 ieee_generic_stat_arch_elt(abfd
, buf
)
1886 ieee_ar_data_type
*ar
= ieee_ar_data(abfd
);
1887 if (ar
== (ieee_ar_data_type
*)NULL
) {
1888 bfd_error
= invalid_operation
;
1893 buf
->st_mode
= 0666;
1898 DEFUN(ieee_sizeof_headers
,(abfd
),
1904 #define ieee_core_file_failing_command bfd_false
1905 #define ieee_core_file_failing_signal bfd_false
1906 #define ieee_core_file_matches_executable_p bfd_false
1907 #define ieee_slurp_armap bfd_true
1908 #define ieee_slurp_extended_name_table bfd_true
1909 #define ieee_truncate_arname bfd_false
1910 #define ieee_write_armap bfd_false
1911 #define ieee_get_lineno bfd_false
1915 bfd_target ieee_vec
=
1918 bfd_target_ieee_flavour_enum
,
1919 true, /* target byte order */
1920 true, /* target headers byte order */
1921 (HAS_RELOC
| EXEC_P
| /* object flags */
1922 HAS_LINENO
| HAS_DEBUG
|
1923 HAS_SYMS
| HAS_LOCALS
| DYNAMIC
| WP_TEXT
| D_PAGED
),
1924 (SEC_CODE
|SEC_DATA
|SEC_ROM
|SEC_HAS_CONTENTS
1925 |SEC_ALLOC
| SEC_LOAD
| SEC_RELOC
), /* section flags */
1926 ' ', /* ar_pad_char */
1927 16, /* ar_max_namelen */
1929 _do_getblong
, _do_putblong
, _do_getbshort
, _do_putbshort
, /* data */
1930 _do_getblong
, _do_putblong
, _do_getbshort
, _do_putbshort
, /* hdrs */
1933 ieee_object_p
, /* bfd_check_format */
1940 _bfd_generic_mkarchive
,