aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2011-11-22 19:50:36 +0000
committerDJ Delorie <dj@redhat.com>2011-11-22 19:50:36 +0000
commitfc87b9e82571ba0015d5d3802cf714ae7c666ee6 (patch)
tree4072c26d91dfbcd6ef112d7e2ae5ad6a692ba341 /bfd
parentc52bd2321a66a663eb59216abbb2be9ed27f841c (diff)
downloadgdb-fc87b9e82571ba0015d5d3802cf714ae7c666ee6.zip
gdb-fc87b9e82571ba0015d5d3802cf714ae7c666ee6.tar.gz
gdb-fc87b9e82571ba0015d5d3802cf714ae7c666ee6.tar.bz2
* elf32-rx.c (rx_elf_object_p): Add more checks for "scanning" to
avoid using the special non-swapping target when not explicitly requested.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-rx.c11
2 files changed, 17 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index df29378..e27dfc6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2011-11-22 DJ Delorie <dj@redhat.com>
+
+ * elf32-rx.c (rx_elf_object_p): Add more checks for "scanning" to
+ avoid using the special non-swapping target when not explicitly
+ requested.
+
2011-11-22 Daniel Calcoen <Daniel.Calcoen@cern.ch>
* elf32-rx.c (rx_elf_object_p): Correct typo: lma->vma.
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index c21c7b1..0ceed85 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -32,6 +32,7 @@
endian-swap we would otherwise get. We check for this in
rx_elf_object_p(). */
const bfd_target bfd_elf32_rx_be_ns_vec;
+const bfd_target bfd_elf32_rx_be_vec;
#ifdef DEBUG
char * rx_get_reloc (long);
@@ -3028,6 +3029,7 @@ rx_elf_object_p (bfd * abfd)
Elf_Internal_Phdr *phdr = elf_tdata (abfd)->phdr;
int nphdrs = elf_elfheader (abfd)->e_phnum;
sec_ptr bsec;
+ static int saw_be = FALSE;
/* We never want to automatically choose the non-swapping big-endian
target. The user can only get that explicitly, such as with -I
@@ -3036,6 +3038,15 @@ rx_elf_object_p (bfd * abfd)
&& abfd->target_defaulted)
return FALSE;
+ /* BFD->target_defaulted is not set to TRUE when a target is chosen
+ as a fallback, so we check for "scanning" to know when to stop
+ using the non-swapping target. */
+ if (abfd->xvec == &bfd_elf32_rx_be_ns_vec
+ && saw_be)
+ return FALSE;
+ if (abfd->xvec == &bfd_elf32_rx_be_vec)
+ saw_be = TRUE;
+
bfd_default_set_arch_mach (abfd, bfd_arch_rx,
elf32_rx_machine (abfd));