diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/elf32-rx.c | 72 |
2 files changed, 71 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2e91b69..3a69d7e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +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 Edgar E. Iglesias <edgar.iglesias@gmail.com> * config.bfd: Add microblazeel-*-* diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index 771867f..92c046a 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" |