aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-rx.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2011-06-02 00:51:19 +0000
committerDJ Delorie <dj@redhat.com>2011-06-02 00:51:19 +0000
commit4c422395e61397529b6bbafc7fa5c0e28b4c56dc (patch)
tree22e3d308a280922a00d999514a3f6eccc88d2f74 /bfd/elf32-rx.c
parenta39ef331205f8654a8f97447423065312db3000a (diff)
downloadgdb-4c422395e61397529b6bbafc7fa5c0e28b4c56dc.zip
gdb-4c422395e61397529b6bbafc7fa5c0e28b4c56dc.tar.gz
gdb-4c422395e61397529b6bbafc7fa5c0e28b4c56dc.tar.bz2
* config.bfd: Add bfd_elf32_rx_be_ns_vec.
* target.c: Likewise. * configure.in: Likewise. * configure.in: Regenerate. * elf32-rx.c: Add elf32-rx-be-ns target. (rx_elf_object_p): Never allow the be-ns target by default, only allow it if the user requests it.
Diffstat (limited to 'bfd/elf32-rx.c')
-rw-r--r--bfd/elf32-rx.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 7e4bf96..f049f6e 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -28,6 +28,11 @@
#define RX_OPCODE_BIG_ENDIAN 0
+/* This is a meta-target that's used only with objcopy, to avoid the
+ endian-swap we would otherwise get. We check for this in
+ rx_elf_object_p(). */
+const bfd_target bfd_elf32_rx_be_ns_vec;
+
#ifdef DEBUG
char * rx_get_reloc (long);
void rx_dump_symtab (bfd *, void *, void *);
@@ -2960,6 +2965,13 @@ rx_elf_object_p (bfd * abfd)
int nphdrs = elf_elfheader (abfd)->e_phnum;
sec_ptr bsec;
+ /* We never want to automatically choose the non-swapping big-endian
+ target. The user can only get that explicitly, such as with -I
+ and objcopy. */
+ if (abfd->xvec == &bfd_elf32_rx_be_ns_vec
+ && abfd->target_defaulted)
+ return FALSE;
+
bfd_default_set_arch_mach (abfd, bfd_arch_rx,
elf32_rx_machine (abfd));
@@ -3436,3 +3448,21 @@ elf32_rx_modify_program_headers (bfd * abfd ATTRIBUTE_UNUSED,
#define bfd_elf32_bfd_relax_section elf32_rx_relax_section_wrapper
#include "elf32-target.h"
+
+/* We define a second big-endian target that doesn't have the custom
+ section get/set hooks, for times when we want to preserve the
+ pre-swapped .text sections (like objcopy). */
+
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_rx_be_ns_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-rx-be-ns"
+#undef TARGET_LITTLE_SYM
+
+#undef bfd_elf32_get_section_contents
+#undef bfd_elf32_set_section_contents
+
+#undef elf32_bed
+#define elf32_bed elf32_rx_be_ns_bed
+
+#include "elf32-target.h"