From 3525236c57a64fdbb534671fd2b16f9f846d36f3 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 9 Apr 2015 12:48:37 +0100 Subject: Add support to the RX toolchain to restrict the use of string instructions. bfd * elf32-rx.c (describe_flags): Report the settings of the string insn using bits. (rx_elf_merge_private_bfd_data): Handle merging of the string insn using bits. bin * readelf.c (get_machine_flags): Report the setting of the string insn using bits. gas * config/tc-rx.c (enum options): Add OPTION_DISALLOW_STRING_INSNS. (md_longopts): Add -mno-allow-string-insns. (md_parse_option): Handle -mno-allow-string-insns. (md_show_usage): Mention -mno-allow-string-insns. (rx_note_string_insn_use): New function. Produces an error message if a string insn is used when it is not allowed. * config/rx-parse.y (SCMPU): Call rx_note_string_insn_use. (SMOVU, SMOVB, SMOVF, SUNTIL, SWHILE, RMPA): Likewise. * config/rx-defs.h (rx_note_string_insn_use): Prototype. * doc/c-rx.texi: Document -mno-allow-string-insns. elf * rx.h (E_FLAG_RX_SINSNS_SET): New bit in e_flags field. (E_FLAG_RX_SINSNS_YES): Likewise. (E_FLAG_RX_SINSNS_MASK): New define. --- bfd/ChangeLog | 7 +++++++ bfd/elf32-rx.c | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c7050af..f2afc93 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2015-04-09 Nick Clifton + + * elf32-rx.c (describe_flags): Report the settings of the string + insn using bits. + (rx_elf_merge_private_bfd_data): Handle merging of the string insn + using bits. + 2015-04-08 H.J. Lu * compress.c (bfd_compress_section_contents): Work around a GCC diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index b8c632e..8d71628 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -3086,6 +3086,9 @@ describe_flags (flagword flags) else strcat (buf, ", GCC ABI"); + if (flags & E_FLAG_RX_SINSNS_SET) + strcat (buf, flags & E_FLAG_RX_SINSNS_YES ? ", uses String instructions" : ", bans String instructions"); + return buf; } @@ -3112,8 +3115,22 @@ rx_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd) { flagword known_flags; + if (old_flags & E_FLAG_RX_SINSNS_SET) + { + if ((new_flags & E_FLAG_RX_SINSNS_SET) == 0) + { + new_flags &= ~ E_FLAG_RX_SINSNS_MASK; + new_flags |= (old_flags & E_FLAG_RX_SINSNS_MASK); + } + } + else if (new_flags & E_FLAG_RX_SINSNS_SET) + { + old_flags &= ~ E_FLAG_RX_SINSNS_MASK; + old_flags |= (new_flags & E_FLAG_RX_SINSNS_MASK); + } + known_flags = E_FLAG_RX_ABI | E_FLAG_RX_64BIT_DOUBLES - | E_FLAG_RX_DSP | E_FLAG_RX_PID; + | E_FLAG_RX_DSP | E_FLAG_RX_PID | E_FLAG_RX_SINSNS_MASK; if ((old_flags ^ new_flags) & known_flags) { -- cgit v1.1