aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-arm.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-04-01 13:08:06 +0000
committerNick Clifton <nickc@redhat.com>2003-04-01 13:08:06 +0000
commit5a6c681789fe44d0cfb3a3839aeb8a1060842c1f (patch)
tree71caa9c0f02720bfa21b4b77fcee77ef59cbdc22 /bfd/elf32-arm.h
parent49634642a549784aaa0d26c1442a2580b697f49b (diff)
downloadgdb-5a6c681789fe44d0cfb3a3839aeb8a1060842c1f.zip
gdb-5a6c681789fe44d0cfb3a3839aeb8a1060842c1f.tar.gz
gdb-5a6c681789fe44d0cfb3a3839aeb8a1060842c1f.tar.bz2
Fixes for iWMMXt contribution.
Diffstat (limited to 'bfd/elf32-arm.h')
-rw-r--r--bfd/elf32-arm.h102
1 files changed, 14 insertions, 88 deletions
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index 417284b..631b2b9 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -2119,43 +2119,18 @@ static bfd_boolean
elf32_arm_object_p (abfd)
bfd *abfd;
{
- asection * arm_arch_section;
+ unsigned int mach;
+
+ mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
- arm_arch_section = bfd_get_section_by_name (abfd, ARM_NOTE_SECTION);
+ if (mach != bfd_mach_arm_unknown)
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
+
+ else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
- if (arm_arch_section)
- {
- char buffer [4];
- unsigned long arm_mach;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- (*_bfd_error_handler)
- (_("%s: warning: unable to retrieve %s section from %s"),
- ARM_NOTE_SECTION, bfd_get_filename (abfd));
- else
- {
- /* We have to extract the value this way to allow for a
- host whose endian-ness is different from the target. */
- arm_mach = bfd_get_32 (abfd, buffer);
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, arm_mach);
-
- if (bfd_get_arch (abfd) == bfd_arch_arm)
- return TRUE;
-
- /* If the set failed for some reason, do not leave the architecture
- type as 0 (unknown), but issue a warning message and force it to
- be set to bfd_arch_arm. */
- (*_bfd_error_handler)
- (_("%s: warning: unrecognized ARM machine number: %x"),
- bfd_get_filename (abfd), arm_mach);
- }
- }
else
- {
- if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
- bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
- }
+ bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
return TRUE;
}
@@ -2296,24 +2271,10 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
return TRUE;
}
- if (bfd_get_mach (obfd) && bfd_get_mach (obfd) != bfd_get_mach (ibfd))
- {
- /* For now, allow an output file type of 'xscale' if the
- input file type is 'iWMMXt'. This means that we will
- not have to build an entire iWMMXt enabled set of libraries
- just to test a iWMMXt enabled binary. Change the output
- type to iWMMXt though. Similarly allow 'xscale' binaries
- to be linked into a 'iWMMXt' output binary. */
- if ( bfd_get_mach (obfd) == bfd_mach_arm_XScale
- && bfd_get_mach (ibfd) == bfd_mach_arm_iWMMXt)
- bfd_set_arch_mach (obfd, bfd_get_arch (obfd), bfd_mach_arm_iWMMXt);
- else if ( bfd_get_mach (ibfd) != bfd_mach_arm_XScale
- || bfd_get_mach (obfd) != bfd_mach_arm_iWMMXt)
- {
- bfd_set_error (bfd_error_wrong_format);
- return FALSE;
- }
- }
+ /* Determine what should happen if the input ARM architecture
+ does not match the output ARM architecture. */
+ if (! bfd_arm_merge_machines (ibfd, obfd))
+ return FALSE;
/* Identical flags must be compatible. */
if (in_flags == out_flags)
@@ -3733,42 +3694,7 @@ elf32_arm_final_write_processing (abfd, linker)
bfd *abfd;
bfd_boolean linker ATTRIBUTE_UNUSED;
{
- asection * arm_arch_section;
- char buffer [4];
- unsigned long arm_mach;
-
- /* Look for a .note.arm.ident section. If one is present check
- the machine number encoded in it, and set it to the current
- machine number if it is different. This allows XScale and
- iWMMXt binaries to be merged and the resulting output to be set
- to iWMMXt, even if the first input file had an XScale .note. */
-
- arm_arch_section = bfd_get_section_by_name (abfd, ARM_NOTE_SECTION);
-
- if (arm_arch_section == NULL)
- return;
-
- if (! bfd_get_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- /* If the ident section does not exist then just skip this check. */
- return;
-
- /* We have to extract the value this way to allow for a
- host whose endian-ness is different from the target. */
- arm_mach = bfd_get_32 (abfd, buffer);
-
- if (arm_mach == bfd_get_mach (abfd))
- return;
-
- bfd_put_32 (abfd, bfd_get_mach (abfd), buffer);
-
- if (! bfd_set_section_contents (abfd, arm_arch_section, buffer,
- (file_ptr) 0, sizeof buffer))
- (*_bfd_error_handler)
- (_("warning: unable to update contents of %s section in %s"),
- ARM_NOTE_SECTION, bfd_get_filename (abfd));
-
- return;
+ bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
}
#define ELF_ARCH bfd_arch_arm