/* DWARF 2 support.
- Copyright 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
+ Copyright 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
(gavin@cygnus.com).
struct comp_unit* unit;
char *buf;
{
- bfd_vma retval = 0;
-
- if (unit->addr_size == 4)
+ switch (unit->addr_size)
{
- retval = bfd_get_32 (unit->abfd, (bfd_byte *) buf);
- } else {
- retval = bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+ case 8:
+ return bfd_get_64 (unit->abfd, (bfd_byte *) buf);
+ case 4:
+ return bfd_get_32 (unit->abfd, (bfd_byte *) buf);
+ case 2:
+ return bfd_get_16 (unit->abfd, (bfd_byte *) buf);
+ default:
+ abort ();
}
- return retval;
}
return 0;
}
- stash->dwarf_abbrev_size = bfd_get_section_size_before_reloc (msec);
+ stash->dwarf_abbrev_size = msec->_raw_size;
stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
if (! stash->dwarf_abbrev_buffer)
return 0;
return 0;
}
- size = bfd_get_section_size_before_reloc (msec);
+ size = msec->_raw_size;
stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, size);
if (! stash->dwarf_line_buffer)
return 0;
return 0;
}
- if (addr_size != 4 && addr_size != 8)
+ if (addr_size != 2 && addr_size != 4 && addr_size != 8)
{
- (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '4' and '8'.", addr_size );
+ (*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '2', '4' and '8'.", addr_size );
bfd_set_error (bfd_error_bad_value);
return 0;
}
return false;
}
- size = bfd_get_section_size_before_reloc (msec);
+ size = msec->_raw_size;
if (size == 0)
return false;