aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>1997-10-20 17:23:10 +0000
committerDoug Evans <dje@google.com>1997-10-20 17:23:10 +0000
commit595da85d72d82bf368f025175485f9c8471f53e3 (patch)
tree46c395c1b9c445efe702d61c9ac2d96f3b0b249c /gas
parent5efcd359258f3a10222cc9caa0addbaa6a85b724 (diff)
downloadgdb-595da85d72d82bf368f025175485f9c8471f53e3.zip
gdb-595da85d72d82bf368f025175485f9c8471f53e3.tar.gz
gdb-595da85d72d82bf368f025175485f9c8471f53e3.tar.bz2
* tc-sparc.c (default_arch_size): New static local.
(struct sparc_arch): Rename arch_size to default_arch_size. New member user_option_p. (sparc_arch_table): Always include v9, v9a. New entry v9-64. (init_default_arch): Check whether default arch is valid. Set default_arch_size in addition to sparc_arch_size. (OPTION_32,OPTION_64): Define. (md_longopts): New entries for -32, -64. (md_parse_option): Handle them. (md_show_usage): Print them. Ensure init_default_arch called.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog13
-rw-r--r--gas/config/tc-sparc.c99
2 files changed, 91 insertions, 21 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3f8a191..bf4bc6a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,16 @@
+Mon Oct 20 10:13:32 1997 Doug Evans <devans@canuck.cygnus.com>
+
+ * tc-sparc.c (default_arch_size): New static local.
+ (struct sparc_arch): Rename arch_size to default_arch_size.
+ New member user_option_p.
+ (sparc_arch_table): Always include v9, v9a. New entry v9-64.
+ (init_default_arch): Check whether default arch is valid.
+ Set default_arch_size in addition to sparc_arch_size.
+ (OPTION_32,OPTION_64): Define.
+ (md_longopts): New entries for -32, -64.
+ (md_parse_option): Handle them.
+ (md_show_usage): Print them. Ensure init_default_arch called.
+
Sun Oct 19 13:50:50 1997 Ian Lance Taylor <ian@cygnus.com>
* write.c (subsegs_finish): New function, broken out of
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index beb0e9d..a5f8cf3 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -64,6 +64,9 @@ static enum sparc_opcode_arch_val max_architecture;
/* Either 32 or 64, selects file format. */
static int sparc_arch_size;
+/* Initial (default) value, recorded separately in case a user option
+ changes the value before md_show_usage is called. */
+static int default_arch_size;
static int architecture_requested;
static int warn_on_bump;
@@ -183,19 +186,24 @@ static void output_insn
static struct sparc_arch {
char *name;
char *opcode_arch;
- int arch_size;
+ /* Default word size, as specified during configuration.
+ A value of zero means can't be used to specify default architecture. */
+ int default_arch_size;
+ /* Allowable arg to -A? */
+ int user_option_p;
} sparc_arch_table[] = {
- { "v6", "v6", 32 },
- { "v7", "v7", 32 },
- { "v8", "v8", 32 },
- { "sparclet", "sparclet", 32 },
- { "sparclite", "sparclite", 32 },
- { "v8plus", "v9", 32 },
- { "v8plusa", "v9a", 32 },
-#ifdef BFD64
- { "v9", "v9", 64 },
- { "v9a", "v9a", 64 },
-#endif
+ { "v6", "v6", 0, 1 },
+ { "v7", "v7", 0, 1 },
+ { "v8", "v8", 32, 1 },
+ { "sparclet", "sparclet", 32, 1 },
+ { "sparclite", "sparclite", 32, 1 },
+ { "v8plus", "v9", 0, 1 },
+ { "v8plusa", "v9a", 0, 1 },
+ { "v9", "v9", 0, 1 },
+ { "v9a", "v9a", 0, 1 },
+ /* This exists to allow configure.in/Makefile.in to pass one
+ value to specify both the default machine and default word size. */
+ { "v9-64", "v9", 64, 0 },
{ NULL, NULL, 0 }
};
@@ -221,13 +229,14 @@ init_default_arch ()
{
struct sparc_arch *sa = lookup_arch (default_arch);
- if (sa == NULL)
+ if (sa == NULL
+ || sa->default_arch_size == 0)
as_fatal ("Invalid default architecture, broken assembler.");
max_architecture = sparc_opcode_lookup_arch (sa->opcode_arch);
if (max_architecture == SPARC_OPCODE_ARCH_BAD)
as_fatal ("Bad opcode table, broken assembler.");
- sparc_arch_size = sa->arch_size;
+ default_arch_size = sparc_arch_size = sa->default_arch_size;
default_init_p = 1;
}
@@ -285,7 +294,11 @@ sparc_target_format ()
* -Av8plus, -Av8plusa
* Sparc64 in a 32 bit world.
* -Av9, -Av9a
- * Sparc64 in a 64 bit world.
+ * Sparc64 in either a 32 or 64 bit world (-32/-64 says which).
+ * This used to only mean 64 bits, but properly specifying it
+ * complicated gcc's ASM_SPECs, so now opcode selection is
+ * specified orthogonally to word size (except when specifying
+ * the default, but that is an internal implementation detail).
* -xarch=v8plus, -xarch=v8plusa
* Same as -Av8plus{,a}, for compatibility with Sun's assembler.
*
@@ -335,13 +348,19 @@ struct option md_longopts[] = {
{"sparc", no_argument, NULL, OPTION_SPARC},
#define OPTION_XARCH (OPTION_MD_BASE + 2)
{"xarch", required_argument, NULL, OPTION_XARCH},
+#ifdef OBJ_ELF
+#define OPTION_32 (OPTION_MD_BASE + 3)
+ {"32", no_argument, NULL, OPTION_32},
+#define OPTION_64 (OPTION_MD_BASE + 4)
+ {"64", no_argument, NULL, OPTION_64},
+#endif
#ifdef SPARC_BIENDIAN
-#define OPTION_LITTLE_ENDIAN (OPTION_MD_BASE + 3)
+#define OPTION_LITTLE_ENDIAN (OPTION_MD_BASE + 5)
{"EL", no_argument, NULL, OPTION_LITTLE_ENDIAN},
-#define OPTION_BIG_ENDIAN (OPTION_MD_BASE + 4)
+#define OPTION_BIG_ENDIAN (OPTION_MD_BASE + 6)
{"EB", no_argument, NULL, OPTION_BIG_ENDIAN},
#endif
-#define OPTION_ENFORCE_ALIGNED_DATA (OPTION_MD_BASE + 5)
+#define OPTION_ENFORCE_ALIGNED_DATA (OPTION_MD_BASE + 7)
{"enforce-aligned-data", no_argument, NULL, OPTION_ENFORCE_ALIGNED_DATA},
{NULL, no_argument, NULL, 0}
};
@@ -381,7 +400,8 @@ md_parse_option (c, arg)
enum sparc_opcode_arch_val opcode_arch;
sa = lookup_arch (arg);
- if (sa == NULL)
+ if (sa == NULL
+ || ! sa->user_option_p)
{
as_bad ("invalid architecture -A%s", arg);
return 0;
@@ -392,7 +412,6 @@ md_parse_option (c, arg)
as_fatal ("Bad opcode table, broken assembler.");
max_architecture = opcode_arch;
- sparc_arch_size = sa->arch_size;
architecture_requested = 1;
}
break;
@@ -421,6 +440,33 @@ md_parse_option (c, arg)
#endif
#ifdef OBJ_ELF
+ case OPTION_32:
+ case OPTION_64:
+ {
+ const char **list, **l;
+
+ sparc_arch_size = c == OPTION_32 ? 32 : 64;
+ list = bfd_target_list ();
+ for (l = list; *l != NULL; l++)
+ {
+ if (sparc_arch_size == 32)
+ {
+ if (strcmp (*l, "elf32-sparc") == 0)
+ break;
+ }
+ else
+ {
+ if (strcmp (*l, "elf64-sparc") == 0)
+ break;
+ }
+ }
+ if (*l == NULL)
+ as_fatal ("No compiled in support for %d bit object file format",
+ sparc_arch_size);
+ free (list);
+ }
+ break;
+
case 'V':
print_version_id ();
break;
@@ -459,12 +505,18 @@ md_show_usage (stream)
{
const struct sparc_arch *arch;
+ /* We don't get a chance to initialize anything before we're called,
+ so handle that now. */
+ if (! default_init_p)
+ init_default_arch ();
+
fprintf(stream, "SPARC options:\n");
for (arch = &sparc_arch_table[0]; arch->name; arch++)
{
if (arch != &sparc_arch_table[0])
fprintf (stream, " | ");
- fprintf (stream, "-A%s", arch->name);
+ if (arch->user_option_p)
+ fprintf (stream, "-A%s", arch->name);
}
fprintf (stream, "\n-xarch=v8plus | -xarch=v8plusa\n");
fprintf (stream, "\
@@ -478,6 +530,11 @@ md_show_usage (stream)
#endif
#ifdef OBJ_ELF
fprintf (stream, "\
+-32 create 32 bit object file\n\
+-64 create 64 bit object file\n");
+ fprintf (stream, "\
+ [default is %d]\n", default_arch_size);
+ fprintf (stream, "\
-KPIC generate PIC\n\
-V print assembler version number\n\
-q ignored\n\