/* BFD back-end for MIPS Extended-Coff files.
- Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
Original version by Per Bothner.
case MIPS_MAGIC_BIG:
case MIPS_MAGIC_BIG2:
case MIPS_MAGIC_BIG3:
- return abfd->xvec->byteorder_big_p;
+ return bfd_big_endian (abfd);
case MIPS_MAGIC_LITTLE:
case MIPS_MAGIC_LITTLE2:
case MIPS_MAGIC_LITTLE3:
- return abfd->xvec->byteorder_big_p == false;
+ return bfd_little_endian (abfd);
default:
return false;
const RELOC *ext = (RELOC *) ext_ptr;
intern->r_vaddr = bfd_h_get_32 (abfd, (bfd_byte *) ext->r_vaddr);
- if (abfd->xvec->header_byteorder_big_p != false)
+ if (bfd_header_big_endian (abfd))
{
intern->r_symndx = (((int) ext->r_bits[0]
<< RELOC_BITS0_SYMNDX_SH_LEFT_BIG)
}
bfd_h_put_32 (abfd, intern->r_vaddr, (bfd_byte *) ext->r_vaddr);
- if (abfd->xvec->header_byteorder_big_p != false)
+ if (bfd_header_big_endian (abfd))
{
ext->r_bits[0] = r_symndx >> RELOC_BITS0_SYMNDX_SH_LEFT_BIG;
ext->r_bits[1] = r_symndx >> RELOC_BITS1_SYMNDX_SH_LEFT_BIG;
if (! intern->r_extern
&& (intern->r_type == MIPS_R_GPREL
|| intern->r_type == MIPS_R_LITERAL))
- rptr->addend += ecoff_data (abfd)->gp;
+ rptr->addend += _bfd_get_gp_value (abfd);
/* If the type is MIPS_R_IGNORE, make sure this is a reference to
the absolute section so that the reloc is ignored. */
BFD. If we can't find it, we're stuck. We cache it in the ECOFF
target data. We don't need to adjust the symbol value for an
external symbol if we are producing relocateable output. */
- if (ecoff_data (output_bfd)->gp == 0
+ if (_bfd_get_gp_value (output_bfd) == 0
&& (relocateable == false
|| (symbol->flags & BSF_SECTION_SYM) != 0))
{
if (relocateable != false)
{
/* Make up a value. */
- ecoff_data (output_bfd)->gp =
- symbol->section->output_section->vma + 0x4000;
+ _bfd_set_gp_value (output_bfd,
+ symbol->section->output_section->vma + 0x4000);
}
else
{
name = bfd_asymbol_name (*sym);
if (*name == '_' && strcmp (name, "_gp") == 0)
{
- ecoff_data (output_bfd)->gp = bfd_asymbol_value (*sym);
+ _bfd_set_gp_value (output_bfd,
+ bfd_asymbol_value (*sym));
break;
}
}
if (i >= count)
{
/* Only get the error once. */
- ecoff_data (output_bfd)->gp = 4;
+ _bfd_set_gp_value (output_bfd, 4);
*error_message =
(char *) "GP relative relocation when _gp not defined";
return bfd_reloc_dangerous;
an external symbol. */
if (relocateable == false
|| (symbol->flags & BSF_SECTION_SYM) != 0)
- val += relocation - ecoff_data (output_bfd)->gp;
+ val += relocation - _bfd_get_gp_value (output_bfd);
insn = (insn &~ 0xffff) | (val & 0xffff);
bfd_put_32 (abfd, insn, (bfd_byte *) data + reloc_entry->address);
boolean got_lo;
struct internal_reloc lo_int_rel;
- BFD_ASSERT (input_bfd->xvec->header_byteorder_big_p
- == output_bfd->xvec->header_byteorder_big_p);
+ BFD_ASSERT (input_bfd->xvec->header_byteorder
+ == output_bfd->xvec->header_byteorder);
/* We keep a table mapping the symndx found in an internal reloc to
the appropriate section. This is faster than looking up the
sym_hashes = ecoff_data (input_bfd)->sym_hashes;
- gp = ecoff_data (output_bfd)->gp;
+ gp = _bfd_get_gp_value (output_bfd);
if (gp == 0)
gp_undefined = true;
else
int_rel.r_vaddr - input_section->vma)))
return false;
/* Only give the error once per link. */
- ecoff_data (output_bfd)->gp = gp = 4;
+ gp = 4;
+ _bfd_set_gp_value (output_bfd, gp);
gp_undefined = false;
}
if (! int_rel.r_extern)
continue;
/* Quickly check that this reloc is external PCREL16. */
- if (abfd->xvec->header_byteorder_big_p)
+ if (bfd_header_big_endian (abfd))
{
if ((ext_rel->r_bits[3] & RELOC_BITS3_EXTERN_BIG) == 0
|| (((ext_rel->r_bits[3] & RELOC_BITS3_TYPE_BIG)
if (info->keep_memory)
contents = (bfd_byte *) bfd_alloc (abfd, sec->_raw_size);
else
- contents = (bfd_byte *) malloc ((size_t) sec->_raw_size);
+ contents = (bfd_byte *) bfd_malloc ((size_t) sec->_raw_size);
if (contents == (bfd_byte *) NULL)
- {
- bfd_set_error (bfd_error_no_memory);
- goto error_return;
- }
+ goto error_return;
if (! bfd_get_section_contents (abfd, sec, (PTR) contents,
(file_ptr) 0, sec->_raw_size))
goto error_return;
mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook,
_bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
},
/* Supported architecture. */
bfd_arch_mips,
/* Relocate section contents while linking. */
mips_relocate_section,
/* Do final adjustments to filehdr and aouthdr. */
- NULL
+ NULL,
+ /* Read an element from an archive at a given file position. */
+ _bfd_get_elt_at_filepos
};
/* Looking up a reloc type is MIPS specific. */
{
"ecoff-littlemips", /* name */
bfd_target_ecoff_flavour,
- false, /* data byte order is little */
- false, /* header byte order is little */
+ BFD_ENDIAN_LITTLE, /* data byte order is little */
+ BFD_ENDIAN_LITTLE, /* header byte order is little */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |
{
"ecoff-bigmips", /* name */
bfd_target_ecoff_flavour,
- true, /* data byte order is big */
- true, /* header byte order is big */
+ BFD_ENDIAN_BIG, /* data byte order is big */
+ BFD_ENDIAN_BIG, /* header byte order is big */
(HAS_RELOC | EXEC_P | /* object flags */
HAS_LINENO | HAS_DEBUG |