-
-/* bfd back-end for ieee-695 objects.
- Copyright (C) 1990-1992 Free Software Foundation, Inc.
+/* BFD back-end for ieee-695 objects.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#define KEEPMINUSPCININST 1
+#define KEEPMINUSPCININST 0
/* IEEE 695 format is a stream of records, which we parse using a simple one-
token (which is one byte in this lexicon) lookahead recursive decent
#define ieee_pos(abfd) IEEE_DATA(abfd)->h.input_p -IEEE_DATA(abfd)->h.first_byte
static unsigned int last_index;
-
+static char last_type; /* is the index for an X or a D */
static ieee_symbol_type *
DEFUN(get_symbol,(abfd,
ieee,
last_symbol,
symbol_count,
-pptr,
-max_index
+ pptr,
+ max_index,
+ this_type
),
bfd *abfd AND
ieee_data_type *ieee AND
ieee_symbol_type *last_symbol AND
unsigned int *symbol_count AND
ieee_symbol_type *** pptr AND
- unsigned int *max_index
+ unsigned int *max_index AND
+ char this_type
)
{
/* Need a new symbol */
unsigned int new_index = must_parse_int(&(ieee->h));
- if (new_index != last_index) {
+ if (new_index != last_index || this_type != last_type) {
ieee_symbol_type * new_symbol = (ieee_symbol_type *)bfd_alloc(ieee->h.abfd,
sizeof(ieee_symbol_type));
if (new_index > *max_index) {
*max_index = new_index;
}
+ last_type = this_type;
return new_symbol;
}
return last_symbol;
switch (this_byte(&(ieee->h))) {
case ieee_nn_record:
next_byte(&(ieee->h));
+
symbol = get_symbol(abfd, ieee, symbol, &symbol_count,
&prev_symbols_ptr,
- &ieee->external_symbol_max_index);
+ &ieee->external_symbol_max_index,'D');
+
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id(&(ieee->h));
symbol = get_symbol(abfd, ieee, symbol, &symbol_count,
&prev_symbols_ptr,
- &ieee->external_symbol_max_index);
+ &ieee->external_symbol_max_index,'D');
BFD_ASSERT (symbol->index >= ieee->external_symbol_min_index);
symbol = get_symbol(abfd, ieee, symbol, &symbol_count,
&prev_reference_ptr,
- &ieee->external_reference_max_index);
+ &ieee->external_reference_max_index,'X');
symbol->symbol.the_bfd = abfd;
}
- location[abfd->symcount] = (asymbol *)NULL;
+ if (abfd->symcount) {
+ location[abfd->symcount] = (asymbol *)NULL;
+ }
return abfd->symcount;
}
static asection *
unsigned int index)
{
if (ieee->section_table[index] == (asection *)NULL) {
- asection *section = bfd_make_section(abfd, " tempname");
+ char *tmp = bfd_alloc(abfd,11);
+ asection *section;
+ sprintf(tmp," fsec%4d", index);
+ section = bfd_make_section(abfd, tmp);
ieee->section_table[index] = section;
section->flags = SEC_NO_FLAGS;
section->target_index = index;
break;
}
}
- section->name = read_id(&(ieee->h));
+ memcpy(section->name, read_id(&(ieee->h)),8);
+ /* Truncate sections to 8 chars */
+ if (strlen(section->name) > 8)
+ {
+ section->name[8] = 0;
+ }
{ bfd_vma parent, brother, context;
parse_int(&(ieee->h), &parent);
parse_int(&(ieee->h), &brother);
return (bfd_target *)NULL;
}
/* Throw away the filename */
- free( read_id(&(ieee->h)));
+ read_id(&(ieee->h));
/* This must be an IEEE archive, so we'll buy some space to do
things */
}
}
+/* abfd->has_armap = ;*/
return abfd->xvec;
}
r->next = (ieee_reloc_type *)NULL;
next_byte(&(ieee->h));
/* abort();*/
-
+ r->relent.sym_ptr_ptr = 0;
parse_expression(ieee,
&r->relent.addend,
&r->symbol,
symbols + src->symbol.index + ieee->external_reference_base_offset;
break;
case 0:
- src->relent.sym_ptr_ptr = bfd_abs_section.symbol_ptr_ptr;
+ src->relent.sym_ptr_ptr =
+ src->relent.sym_ptr_ptr[0]->section->symbol_ptr_ptr;
break;
default:
BFD_FAIL();
}
ieee_write_byte(abfd, ieee_function_either_open_b_enum);
- abort();
+/* abort();*/
if (r->sym_ptr_ptr != (asymbol **)NULL) {
ieee_write_expression(abfd, r->addend + ov,
bfd *abfd AND
asection *s)
{
- ieee_write_byte(abfd, ieee_set_current_section_enum);
- ieee_write_byte(abfd, s->index + IEEE_SECTION_NUMBER_BASE);
- ieee_write_byte(abfd, ieee_set_current_pc_enum >> 8);
- ieee_write_byte(abfd, ieee_set_current_pc_enum & 0xff);
- ieee_write_byte(abfd, s->index + IEEE_SECTION_NUMBER_BASE);
- ieee_write_int(abfd, s->vma );
-
- ieee_write_byte(abfd,ieee_repeat_data_enum);
- ieee_write_int(abfd, s->_raw_size);
- ieee_write_byte(abfd, ieee_load_constant_bytes_enum);
- ieee_write_byte(abfd, 1);
- ieee_write_byte(abfd, 0);
+ if (s->_raw_size) {
+ ieee_write_byte(abfd, ieee_set_current_section_enum);
+ ieee_write_byte(abfd, s->index + IEEE_SECTION_NUMBER_BASE);
+ ieee_write_byte(abfd, ieee_set_current_pc_enum >> 8);
+ ieee_write_byte(abfd, ieee_set_current_pc_enum & 0xff);
+ ieee_write_byte(abfd, s->index + IEEE_SECTION_NUMBER_BASE);
+ ieee_write_int(abfd, s->vma );
+
+ ieee_write_byte(abfd,ieee_repeat_data_enum);
+ ieee_write_int(abfd, s->_raw_size);
+ ieee_write_byte(abfd, ieee_load_constant_bytes_enum);
+ ieee_write_byte(abfd, 1);
+ ieee_write_byte(abfd, 0);
+ }
}
static void
},
JUMP_TABLE(ieee)
};
+