aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorYoshinori Sato <ysato@users.sourceforge.jp>2015-02-23 17:04:53 +0000
committerNick Clifton <nickc@redhat.com>2015-02-23 17:04:53 +0000
commit5518c738a47f0282d6fcc6768e1cde598e9538e0 (patch)
tree050864a60a9e3980b1041bdcc967cbc847c545cd /gas
parent1f10ba14bc8c53120432ccc7b2ba5605b4cee80e (diff)
downloadbinutils-5518c738a47f0282d6fcc6768e1cde598e9538e0.zip
binutils-5518c738a47f0282d6fcc6768e1cde598e9538e0.tar.gz
binutils-5518c738a47f0282d6fcc6768e1cde598e9538e0.tar.bz2
Add support for the h8300-linux target.
ld * Makefile.am: (ALL_EMULATION_SOURCES): Add new emulations. * Makefile.in: Regenerate. * configure.tgt: Add h8300-*-linux * emulparams/h8300elf_linux.sh: Add new emulation. * emulparams/h8300helf_linux.sh: Likewise. * emulparams/h8300self_linux.sh: Likewise. * emulparams/h8300sxelf_linux.sh: Likewise. bfd * config.bfd: Add h8300-*-linux. * configure.ac: Add h8300_elf32_linux_vec. * configure: Regenerate. * elf32-h8300.c: Likewise. * targets.c(_bfd_target_vector): Likewise. gas * config/tc-h8300.c (line_separater_chars): Add a version for h8300-linux that includes a separator. (default_mach): New variable. (md_main): Use it. (md_longopts): Add '--march' option. (md_parse_option): Parse the new option. * config/tc-h8300.h (TARGET_FORMAT): Add elf32-h8300-linux. * configure.tgt: Add h8300-*-linux * doc/c-h8300.texi: Document --march.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog12
-rw-r--r--gas/config/tc-h8300.c111
-rw-r--r--gas/config/tc-h8300.h4
-rw-r--r--gas/configure.tgt1
-rw-r--r--gas/doc/c-h8300.texi10
5 files changed, 134 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 93dd2dd..ab3efea 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,15 @@
+2015-02-23 Yoshinori Sato <ysato@users.sourceforge.jp>
+
+ * config/tc-h8300.c (line_separater_chars): Add a version for
+ h8300-linux that includes a separator.
+ (default_mach): New variable.
+ (md_main): Use it.
+ (md_longopts): Add '--march' option.
+ (md_parse_option): Parse the new option.
+ * config/tc-h8300.h (TARGET_FORMAT): Add elf32-h8300-linux.
+ * configure.tgt: Add h8300-*-linux
+ * doc/c-h8300.texi: Document --march.
+
2015-02-23 Nick Clifton <nickc@redhat.com>
PR 17940
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 988bf24..2c8a080 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -35,7 +35,11 @@
const char comment_chars[] = ";";
const char line_comment_chars[] = "#";
+#ifdef TE_LINUX
+const char line_separator_chars[] = "!";
+#else
const char line_separator_chars[] = "";
+#endif
static void sbranch (int);
static void h8300hmode (int);
@@ -51,6 +55,8 @@ int Smode;
int Nmode;
int SXmode;
+static int default_mach = bfd_mach_h8300;
+
#define PSIZE (Hmode && !Nmode ? L_32 : L_16)
static int bsize = L_8; /* Default branch displacement. */
@@ -238,7 +244,7 @@ md_begin (void)
char prev_buffer[100];
int idx = 0;
- if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, bfd_mach_h8300))
+ if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, default_mach))
as_warn (_("could not set architecture and machine"));
opcode_hash_control = hash_new ();
@@ -2102,24 +2108,115 @@ md_atof (int type, char *litP, int *sizeP)
}
#define OPTION_H_TICK_HEX (OPTION_MD_BASE)
+#define OPTION_MACH (OPTION_MD_BASE+1)
const char *md_shortopts = "";
-struct option md_longopts[] = {
+struct option md_longopts[] =
+{
{ "h-tick-hex", no_argument, NULL, OPTION_H_TICK_HEX },
+ { "mach", required_argument, NULL, OPTION_MACH },
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
+struct mach_func
+{
+ const char *name;
+ void (*func) (void);
+};
+
+static void
+mach_h8300h (void)
+{
+ Hmode = 1;
+ Smode = 0;
+ Nmode = 0;
+ SXmode = 0;
+ default_mach = bfd_mach_h8300h;
+}
+
+static void
+mach_h8300hn (void)
+{
+ Hmode = 1;
+ Smode = 0;
+ Nmode = 1;
+ SXmode = 0;
+ default_mach = bfd_mach_h8300hn;
+}
+
+static void
+mach_h8300s (void)
+{
+ Hmode = 1;
+ Smode = 1;
+ Nmode = 0;
+ SXmode = 0;
+ default_mach = bfd_mach_h8300s;
+}
+
+static void
+mach_h8300sn (void)
+{
+ Hmode = 1;
+ Smode = 1;
+ Nmode = 1;
+ SXmode = 0;
+ default_mach = bfd_mach_h8300sn;
+}
+
+static void
+mach_h8300sx (void)
+{
+ Hmode = 1;
+ Smode = 1;
+ Nmode = 0;
+ SXmode = 1;
+ default_mach = bfd_mach_h8300sx;
+}
+
+static void
+mach_h8300sxn (void)
+{
+ Hmode = 1;
+ Smode = 1;
+ Nmode = 1;
+ SXmode = 1;
+ default_mach = bfd_mach_h8300sxn;
+}
+
+const struct mach_func mach_table[] =
+{
+ {"h8300h", mach_h8300h},
+ {"h8300hn", mach_h8300hn},
+ {"h8300s", mach_h8300s},
+ {"h8300sn", mach_h8300sn},
+ {"h8300sx", mach_h8300sx},
+ {"h8300sxn", mach_h8300sxn}
+};
+
int
md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
{
+ unsigned int i;
switch (c)
{
case OPTION_H_TICK_HEX:
enable_h_tick_hex = 1;
break;
-
+ case OPTION_MACH:
+ for (i = 0; i < sizeof(mach_table) / sizeof(struct mach_func); i++)
+ {
+ if (strcasecmp (arg, mach_table[i].name) == 0)
+ {
+ mach_table[i].func();
+ break;
+ }
+ }
+ if (i >= sizeof(mach_table) / sizeof(struct mach_func))
+ as_bad (_("Invalid argument to --mach option: %s"), arg);
+ break;
default:
return 0;
}
@@ -2127,8 +2224,14 @@ md_parse_option (int c ATTRIBUTE_UNUSED, char *arg ATTRIBUTE_UNUSED)
}
void
-md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
+md_show_usage (FILE *stream)
{
+ fprintf (stream, _(" H8300-specific assembler options:\n"));
+ fprintf (stream, _("\
+ -mach=<name> Set the H8300 machine type to one of:\n\
+ h8300h, h8300hn, h8300s, h8300sn, h8300sx, h8300sxn\n"));
+ fprintf (stream, _("\
+ -h-tick-hex Support H'00 style hex constants\n"));
}
void tc_aout_fix_to_chars (void);
diff --git a/gas/config/tc-h8300.h b/gas/config/tc-h8300.h
index f79d750..dd1d57f 100644
--- a/gas/config/tc-h8300.h
+++ b/gas/config/tc-h8300.h
@@ -27,7 +27,11 @@
/* Fixup debug sections since we will never relax them. */
#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC)
#ifdef OBJ_ELF
+#ifndef TE_LINUX
#define TARGET_FORMAT "elf32-h8300"
+#else
+#define TARGET_FORMAT "elf32-h8300-linux"
+#endif
#define LOCAL_LABEL_PREFIX '.'
#define LOCAL_LABEL(NAME) (NAME[0] == '.' && NAME[1] == 'L')
#define FAKE_LABEL_NAME ".L0\001"
diff --git a/gas/configure.tgt b/gas/configure.tgt
index ee07266..bfff2d7 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -206,6 +206,7 @@ case ${generic_target} in
hppa-*-hiux*) fmt=som em=hppa ;;
h8300-*-elf | h8300-*-rtems*) fmt=elf ;;
+ h8300-*-linux*) fmt=elf em=linux ;;
i370-*-elf* | i370-*-linux*) fmt=elf ;;
diff --git a/gas/doc/c-h8300.texi b/gas/doc/c-h8300.texi
index 3a1859b..5d14775 100644
--- a/gas/doc/c-h8300.texi
+++ b/gas/doc/c-h8300.texi
@@ -29,6 +29,16 @@ machine-dependent option:
@item -h-tick-hex
Support H'00 style hex constants in addition to 0x00 style.
+@item -mach=@var{name}
+Sets the H8300 machine variant. The following machine names
+are recognised:
+@code{h8300h},
+@code{h8300hn},
+@code{h8300s},
+@code{h8300sn},
+@code{h8300sx} and
+@code{h8300sxn}.
+
@end table
@c man end