summaryrefslogtreecommitdiff
path: root/bfd/elf32-rx.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2012-11-09 17:00:39 +0000
committerNick Clifton <nickc@redhat.com>2012-11-09 17:00:39 +0000
commit2f531e6be1e97d868ef473752be670bac26e966f (patch)
treef7736b1234f2f00c6afb149eef04bc68da2ed0f5 /bfd/elf32-rx.c
parenteb7b10e71f9569f0b90e0c6c128121ecf14c2e8e (diff)
downloadbinutils-redhat-2f531e6be1e97d868ef473752be670bac26e966f.tar.gz
2012-11-09 Nick Clifton <nickc@redhat.com>
* elf32-rx.c (describe_flags): New function. Returns a buffer containing a description of the E_FLAG_RX_... values set. (rx_elf_merge_private_bfd_data): Use it. (rx_elf_print_private_bfd_data): Likewise. (elf32_rx_machine): Skip EF_RX_CPU_RX check. (elf32_rx_special_sections): Define. (elf_backend_special_sections): Define. 2012-11-09 Nick Clifton <nickc@redhat.com> * readelf.c (get_machine_flags): Add support for E_FLAG_RX_ABI. 2012-11-09 Nick Clifton <nickc@redhat.com> * config/obj-elf.c (obj_elf_change_section): Allow init array sections to have the SHF_EXECINSTR attribute for the RX target. * config/tc-rx.c (elf_flags): Initialise with E_FLAG_RX_ABI. (enum options): Add OPTION_USES_GCC_ABI and OPTION_USES_RX_ABI. (md_longopts): Add -mgcc-abi and -mrx-abi. (md_parse_option): Add support for OPTION_USES_GCC_ABI and OPTION_USES_RX_ABI. * doc/as.texinfo (RX Options): Add mention of remaining RX options. * doc/c-rx.texi: Document -mgcc-abi and -mrx-abi. 2012-11-09 Nick Clifton <nickc@redhat.com> * rx.h (EF_RX_CPU_RX): Add comment. (E_FLAG_RX_ABI): Define. 2012-11-09 Nick Clifton <nickc@redhat.com> * emultempl/rxelf.em (no_flag_mismatch_warnings): Initialise to true. (PARSE_AND_LIST_LONGOPTS): Add flag-mismatch-warnings. (PARSE_AND_LIST_ARG_CASES): Add support for --flag-mismatch-warnings.
Diffstat (limited to 'bfd/elf32-rx.c')
-rw-r--r--bfd/elf32-rx.c72
1 files changed, 61 insertions, 11 deletions
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index 771867f631..92c046abfa 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -2937,6 +2937,39 @@ bfd_elf32_rx_set_target_flags (bfd_boolean user_no_warn_mismatch,
ignore_lma = user_ignore_lma;
}
+/* Converts FLAGS into a descriptive string.
+ Returns a static pointer. */
+
+static const char *
+describe_flags (flagword flags)
+{
+ static char buf [128];
+
+ buf[0] = 0;
+
+ if (flags & E_FLAG_RX_64BIT_DOUBLES)
+ strcat (buf, "64-bit doubles");
+ else
+ strcat (buf, "32-bit doubles");
+
+ if (flags & E_FLAG_RX_DSP)
+ strcat (buf, ", dsp");
+ else
+ strcat (buf, ", no dsp");
+
+ if (flags & E_FLAG_RX_PID)
+ strcat (buf, ", pid");
+ else
+ strcat (buf, ", no pid");
+
+ if (flags & E_FLAG_RX_ABI)
+ strcat (buf, ", RX ABI");
+ else
+ strcat (buf, ", GCC ABI");
+
+ return buf;
+}
+
/* Merge backend specific data from an object file to the output
object file when linking. */
@@ -2958,7 +2991,10 @@ rx_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
}
else if (old_flags != new_flags)
{
- flagword known_flags = E_FLAG_RX_64BIT_DOUBLES | E_FLAG_RX_DSP | E_FLAG_RX_PID;
+ flagword known_flags;
+
+ known_flags = E_FLAG_RX_ABI | E_FLAG_RX_64BIT_DOUBLES
+ | E_FLAG_RX_DSP | E_FLAG_RX_PID;
if ((old_flags ^ new_flags) & known_flags)
{
@@ -2971,9 +3007,12 @@ rx_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
}
else
{
- (*_bfd_error_handler)
- ("ELF header flags mismatch: old_flags = 0x%.8lx, new_flags = 0x%.8lx, filename = %s",
- old_flags, new_flags, bfd_get_filename (ibfd));
+ _bfd_error_handler ("There is a conflict merging the ELF header flags from %s",
+ bfd_get_filename (ibfd));
+ _bfd_error_handler (" the input file's flags: %s",
+ describe_flags (new_flags));
+ _bfd_error_handler (" the output file's flags: %s",
+ describe_flags (old_flags));
error = TRUE;
}
}
@@ -3001,21 +3040,20 @@ rx_elf_print_private_bfd_data (bfd * abfd, void * ptr)
flags = elf_elfheader (abfd)->e_flags;
fprintf (file, _("private flags = 0x%lx:"), (long) flags);
- if (flags & E_FLAG_RX_64BIT_DOUBLES)
- fprintf (file, _(" [64-bit doubles]"));
- if (flags & E_FLAG_RX_DSP)
- fprintf (file, _(" [dsp]"));
-
- fputc ('\n', file);
+ fprintf (file, describe_flags (flags));
return TRUE;
}
/* Return the MACH for an e_flags value. */
static int
-elf32_rx_machine (bfd * abfd)
+elf32_rx_machine (bfd * abfd ATTRIBUTE_UNUSED)
{
+#if 0 /* FIXME: EF_RX_CPU_MASK collides with E_FLAG_RX_...
+ Need to sort out how these flag bits are used.
+ For now we assume that the flags are OK. */
if ((elf_elfheader (abfd)->e_flags & EF_RX_CPU_MASK) == EF_RX_CPU_RX)
+#endif
return bfd_mach_rx;
return 0;
@@ -3495,6 +3533,17 @@ elf32_rx_modify_program_headers (bfd * abfd ATTRIBUTE_UNUSED,
return TRUE;
}
+
+/* The default literal sections should always be marked as "code" (i.e.,
+ SHF_EXECINSTR). This is particularly important for big-endian mode
+ when we do not want their contents byte reversed. */
+static const struct bfd_elf_special_section elf32_rx_special_sections[] =
+{
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_EXECINSTR },
+ { NULL, 0, 0, 0, 0 }
+};
#define ELF_ARCH bfd_arch_rx
#define ELF_MACHINE_CODE EM_RX
@@ -3523,6 +3572,7 @@ elf32_rx_modify_program_headers (bfd * abfd ATTRIBUTE_UNUSED,
#define bfd_elf32_set_section_contents rx_set_section_contents
#define bfd_elf32_bfd_final_link rx_final_link
#define bfd_elf32_bfd_relax_section elf32_rx_relax_section_wrapper
+#define elf_backend_special_sections elf32_rx_special_sections
#include "elf32-target.h"