/* BFD support for the ARM processor
- Copyright 1994, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
/* Support functions used by both the COFF and ELF versions of the ARM port. */
-/* Handle the mergeing of the 'machine' settings of input file IBFD
+/* Handle the merging of the 'machine' settings of input file IBFD
and an output file OBFD. These values actually represent the
different possible ARM architecture variants.
Returns TRUE if they were merged successfully or FALSE otherwise. */
if (out == bfd_mach_arm_unknown)
bfd_set_arch_mach (obfd, bfd_arch_arm, in);
- /* If the input architecure is unknown,
+ /* If the input architecture is unknown,
then so must be the output architecture. */
else if (in == bfd_mach_arm_unknown)
/* FIXME: We ought to have some way to
;
/* Otherwise the general principle that a earlier architecture can be
- linked with a later architecure to produce a binary that will execute
+ linked with a later architecture to produce a binary that will execute
on the later architecture.
We fail however if we attempt to link a Cirrus EP9312 binary with an
&& (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt))
{
_bfd_error_handler (_("\
-ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
- bfd_archive_filename (ibfd),
- bfd_get_filename (obfd));
+ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
+ ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
&& (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt))
{
_bfd_error_handler (_("\
-ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"),
- bfd_archive_filename (obfd),
- bfd_get_filename (ibfd));
+ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"),
+ obfd, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
}
{
asection * arm_arch_section;
bfd_size_type buffer_size;
- char * buffer;
+ bfd_byte * buffer;
char * arch_string;
char * expected;
if (arm_arch_section == NULL)
return TRUE;
- buffer_size = arm_arch_section->_raw_size;
+ buffer_size = arm_arch_section->size;
if (buffer_size == 0)
return FALSE;
- buffer = bfd_malloc (buffer_size);
- if (buffer == NULL)
- return FALSE;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, buffer_size))
+ if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
/* Parse the note. */
return TRUE;
FAIL:
- free (buffer);
+ if (buffer != NULL)
+ free (buffer);
return FALSE;
}
{
asection * arm_arch_section;
bfd_size_type buffer_size;
- char * buffer;
+ bfd_byte * buffer;
char * arch_string;
int i;
if (arm_arch_section == NULL)
return bfd_mach_arm_unknown;
- buffer_size = arm_arch_section->_raw_size;
+ buffer_size = arm_arch_section->size;
if (buffer_size == 0)
return bfd_mach_arm_unknown;
- buffer = bfd_malloc (buffer_size);
- if (buffer == NULL)
- return bfd_mach_arm_unknown;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, buffer_size))
+ if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
/* Parse the note. */
}
FAIL:
- free (buffer);
+ if (buffer != NULL)
+ free (buffer);
return bfd_mach_arm_unknown;
}