This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/4] [RX] v2 instructions support
- From: Yoshinori Sato <ysato at users dot sourceforge dot jp>
- To: binutils at sourceware dot org
- Cc: Yoshinori Sato <ysato at users dot sourceforge dot jp>
- Date: Tue, 8 Dec 2015 02:21:11 +0900
- Subject: [PATCH 1/4] [RX] v2 instructions support
- Authentication-results: sourceware.org; auth=none
This is add RX v2 instruction support.
binutils/ChangeLog
* readelf.c(get_machine_flags): Add v2 flag.
gas/ChangeLog
* config/rx-defs.h(rx_cpu_type): Add RXV2 type.
* config/tc-rx.c(cpu_type_list): New type lookup table.
(md_parse_option): Use lookup table for choose cpu.
(md_show_usage): Add rxv2 for mcpu option.
* doc/c-rx.texi: Likewise.
include/elf/ChangeLog
* rx.h(E_FLAG_RX_V2): New RXv2 type.
---
binutils/readelf.c | 2 ++
gas/config/rx-defs.h | 3 ++-
gas/config/tc-rx.c | 48 ++++++++++++++++++++++++++++++++----------------
gas/doc/c-rx.texi | 7 ++++---
include/elf/rx.h | 2 +-
5 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index d5dd46f..c21ce3f 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -3376,6 +3376,8 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
if (e_flags & E_FLAG_RX_SINSNS_SET)
strcat (buf, e_flags & E_FLAG_RX_SINSNS_YES
? ", uses String instructions" : ", bans String instructions");
+ if (e_flags & E_FLAG_RX_V2)
+ strcat (buf, ", V2");
break;
case EM_S390:
diff --git a/gas/config/rx-defs.h b/gas/config/rx-defs.h
index 15c447d..8d075ce 100644
--- a/gas/config/rx-defs.h
+++ b/gas/config/rx-defs.h
@@ -38,7 +38,8 @@ enum rx_cpu_types
RX600,
RX610,
RX200,
- RX100
+ RX100,
+ RXV2
};
extern int rx_pid_register;
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 4697e95..e76095b 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -106,6 +106,20 @@ struct option md_longopts[] =
};
size_t md_longopts_size = sizeof (md_longopts);
+struct cpu_type{
+ char *cpu_name;
+ int type;
+};
+
+struct cpu_type cpu_type_list[] =
+{
+ {"rx100",RX100},
+ {"rx200",RX200},
+ {"rx600",RX600},
+ {"rx610",RX610},
+ {"rxv2",RXV2}
+};
+
int
md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
{
@@ -161,24 +175,26 @@ md_parse_option (int c ATTRIBUTE_UNUSED, char * arg ATTRIBUTE_UNUSED)
return 1;
case OPTION_CPU:
- if (strcasecmp (arg, "rx100") == 0)
- rx_cpu = RX100;
- else if (strcasecmp (arg, "rx200") == 0)
- rx_cpu = RX200;
- else if (strcasecmp (arg, "rx600") == 0)
- rx_cpu = RX600;
- else if (strcasecmp (arg, "rx610") == 0)
- rx_cpu = RX610;
- else
- {
- as_warn (_("unrecognised RX CPU type %s"), arg);
- break;
- }
- return 1;
-
+ {
+ unsigned int i;
+ for (i = 0; i < sizeof(cpu_type_list)/sizeof(struct cpu_type); i++)
+ {
+ if (strcasecmp(arg, cpu_type_list[i].cpu_name) == 0)
+ {
+ rx_cpu = cpu_type_list[i].type;
+ if (rx_cpu == RXV2)
+ elf_flags |= E_FLAG_RX_V2;
+ return 1;
+ }
+ }
+ as_warn (_("unrecognised RX CPU type %s"), arg);
+ break;
+ }
+
case OPTION_DISALLOW_STRING_INSNS:
elf_flags |= E_FLAG_RX_SINSNS_SET | E_FLAG_RX_SINSNS_NO;
return 1;
+
}
return 0;
}
@@ -197,7 +213,7 @@ md_show_usage (FILE * stream)
fprintf (stream, _(" --mrelax\n"));
fprintf (stream, _(" --mpid\n"));
fprintf (stream, _(" --mint-register=<value>\n"));
- fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610>\n"));
+ fprintf (stream, _(" --mcpu=<rx100|rx200|rx600|rx610|rxv2>\n"));
fprintf (stream, _(" --mno-allow-string-insns"));
}
diff --git a/gas/doc/c-rx.texi b/gas/doc/c-rx.texi
index 3fe2dd6..d2861eb 100644
--- a/gas/doc/c-rx.texi
+++ b/gas/doc/c-rx.texi
@@ -108,9 +108,10 @@ alignments. This option is the default.
@cindex @samp{-mcpu=}
@item -mcpu=@var{name}
This option tells the assembler the target CPU type. Currently the
-@code{rx200}, @code{rx600} and @code{rx610} are recognised as valid
-cpu names. Attempting to assemble an instruction not supported by the
-indicated cpu type will result in an error message being generated.
+@code{rx100}, @code{rx200}, @code{rx600}, @code{rx610} and @code{rxv2}
+are recognised as valid cpu names. Attempting to assemble an instruction
+not supported by the indicated cpu type will result in an error message
+being generated.
@cindex @samp{-mno-allow-string-insns}
@item -mno-allow-string-insns
diff --git a/include/elf/rx.h b/include/elf/rx.h
index f945dac..fa2cbdf 100644
--- a/include/elf/rx.h
+++ b/include/elf/rx.h
@@ -119,11 +119,11 @@ END_RELOC_NUMBERS (R_RX_max)
#define E_FLAG_RX_DSP (1 << 1) /* Defined in the RX CPU Object file specification, but not explained. */
#define E_FLAG_RX_PID (1 << 2) /* Unofficial - DJ */
#define E_FLAG_RX_ABI (1 << 3) /* Binary passes stacked arguments using natural alignment. Unofficial - NC. */
-
#define E_FLAG_RX_SINSNS_SET (1 << 6) /* Set if bit-5 is significant. */
#define E_FLAG_RX_SINSNS_YES (1 << 7) /* Set if string instructions are used in the binary. */
#define E_FLAG_RX_SINSNS_NO 0 /* Bit-5 if this binary must not be linked with a string instruction using binary. */
#define E_FLAG_RX_SINSNS_MASK (3 << 6) /* Mask of bits used to determine string instruction use. */
+#define E_FLAG_RX_V2 (1 << 8) /* RX v2 instructions */
/* These define the addend field of R_RX_RH_RELAX relocations. */
#define RX_RELAXA_IMM6 0x00000010 /* Imm8/16/24/32 at bit offset 6. */
--
2.6.1