aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-02-14 16:17:04 +0000
committerNick Clifton <nickc@redhat.com>2005-02-14 16:17:04 +0000
commit5cba516c96c30419af2254897f0459ef4d640084 (patch)
tree4dd636b2d69bc42f25b2aee93e1c111c6bc76d76
parentd60988980f0a8282b0125afe9dbad1ddfdda4c9e (diff)
downloadgdb-5cba516c96c30419af2254897f0459ef4d640084.zip
gdb-5cba516c96c30419af2254897f0459ef4d640084.tar.gz
gdb-5cba516c96c30419af2254897f0459ef4d640084.tar.bz2
(elf_core_file_p): Move the call to elf_backend_object_p to allow the correct
machine to be set before processing the program headers.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elfcore.h23
2 files changed, 18 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5cf3e34..38920f6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-14 Orjan Friberg <orjanf@axis.com>
+
+ * elfcore.h (elf_core_file_p): Move the call to
+ elf_backend_object_p to allow the correct machine to be set before
+ processing the program headers.
+
2005-02-14 Nick Clifton <nickc@redhat.com>
PR binutils/716
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 81c4cff..198c4c6 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -207,12 +207,19 @@ elf_core_file_p (bfd *abfd)
/* Set the machine architecture. Do this before processing the
program headers since we need to know the architecture type
when processing the notes of some systems' core files. */
- if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
- {
+ if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0)
/* It's OK if this fails for the generic target. */
- if (ebd->elf_machine_code != EM_NONE)
- goto fail;
- }
+ && ebd->elf_machine_code != EM_NONE)
+ goto fail;
+
+ /* Let the backend double check the format and override global
+ information. We do this before processing the program headers
+ to allow the correct machine (as opposed to just the default
+ machine) to be set, making it possible for grok_prstatus and
+ grok_psinfo to rely on the mach setting. */
+ if (ebd->elf_backend_object_p != NULL
+ && ! ebd->elf_backend_object_p (abfd))
+ goto wrong;
/* Process each program header. */
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
@@ -222,12 +229,6 @@ elf_core_file_p (bfd *abfd)
/* Save the entry point from the ELF header. */
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
- /* Let the backend double check the format and override global
- information. */
- if (ebd->elf_backend_object_p
- && (! (*ebd->elf_backend_object_p) (abfd)))
- goto wrong;
-
bfd_preserve_finish (abfd, &preserve);
return abfd->xvec;