summaryrefslogtreecommitdiff
path: root/bfd/elf32-rx.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2011-06-02 00:51:18 +0000
committerDJ Delorie <dj@delorie.com>2011-06-02 00:51:18 +0000
commit96f8560833d7e10d4c69426300ee041f16252e87 (patch)
tree6f86ad80db4d1b3873069053f055db1befb521ae /bfd/elf32-rx.c
parent58c47702864056295531994b0efd46d4d0cc0e8f (diff)
downloadbinutils-redhat-96f8560833d7e10d4c69426300ee041f16252e87.tar.gz
* 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 7e4bf96f9f..f049f6e339 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"