From a38cf1db3a1c32ca85b78a1c50001af4714c1066 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sat, 13 May 2000 12:49:55 +0000 Subject: [PATCH] Add x86 gas -q option to quiet some x86 gas warnings. Remove useless -m flag_do_long_jump from x86 gas. If BFD_ASSEMBLER, store --defsym value in a bfd_vma, and use scan_bfd_vma. --- gas/ChangeLog | 16 +++++++ gas/NEWS | 6 +++ gas/as.c | 6 ++- gas/config/tc-i386.c | 103 ++++++++++++++++++++----------------------- 4 files changed, 75 insertions(+), 56 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 742abf87b81..5a028e4df8d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,19 @@ +2000-05-13 Alan Modra + + * NEWS: Mention x86 .arch and -q. + + * config/tc-i386.c (quiet_warnings): New. + (md_assemble): Use quiet_warnings. + (md_parse_option): Set quiet_warnings from -q. + (md_show_usage): Mention -q, delete -m. + (flag_do_long_jump): Delete. + (md_parse_option): Remove -m. + (md_show_usage): Remove -m. + (md_create_long_jump): Remove useless flag_do_long_jump code. + + * as.c (parse_args): In case OPTION_DEFSYM, use a valueT to hold + the symbol value, and use bfd_scan_vma if BFD_ASSEMBLER. + 2000-05-13 Alan Modra Alexander Sokolov diff --git a/gas/NEWS b/gas/NEWS index 48df8446bd1..3ba99a2caf1 100644 --- a/gas/NEWS +++ b/gas/NEWS @@ -4,6 +4,12 @@ Changes in 2.11: Support for IA-64. +x86 gas has a new .arch pseudo op to specify the target CPU architecture. + +x86 gas -q command line option quietens warnings about register size changes +due to suffix, indirect jmp/call without `*', stand-alone prefixes, and +translating various deprecated floating point instructions. + Changes in 2.10: Support for ATMEL AVR. diff --git a/gas/as.c b/gas/as.c index 53a48c089b0..f22120727ea 100644 --- a/gas/as.c +++ b/gas/as.c @@ -546,7 +546,7 @@ the GNU General Public License. This program has absolutely no warranty.\n")); case OPTION_DEFSYM: { char *s; - long i; + valueT i; struct defsym_list *n; for (s = optarg; *s != '\0' && *s != '='; s++) @@ -554,7 +554,11 @@ the GNU General Public License. This program has absolutely no warranty.\n")); if (*s == '\0') as_fatal (_("bad defsym; format is --defsym name=value")); *s++ = '\0'; +#ifdef BFD_ASSEMBLER + i = bfd_scan_vma (s, (const char **) NULL, 0); +#else i = strtol (s, (char **) NULL, 0); +#endif n = (struct defsym_list *) xmalloc (sizeof *n); n->next = defsyms; n->name = optarg; diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2ba676d27da..b131e41abf2 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -219,17 +219,11 @@ static expressionS disp_expressions[2], im_expressions[2]; static int this_operand; /* Current operand we are working on. */ -static int flag_do_long_jump; /* FIXME what does this do? */ - static int flag_16bit_code; /* 1 if we're writing 16-bit code, 0 if 32-bit. */ static int intel_syntax = 0; /* 1 for intel syntax, 0 if att syntax. */ -static const char *cpu_arch_name = NULL; /* cpu name */ - -static unsigned int cpu_arch_flags = 0; /* cpu feature flags */ - static int allow_naked_reg = 0; /* 1 if register prefix % not required */ static char stackop_size = '\0'; /* Used in 16 bit gcc mode to add an l @@ -237,6 +231,12 @@ static char stackop_size = '\0'; /* Used in 16 bit gcc mode to add an l and pop instructions so that gcc has the same stack frame as in 32 bit mode. */ +static int quiet_warnings = 0; /* Non-zero to quieten some warnings. */ + +static const char *cpu_arch_name = NULL; /* cpu name */ + +static unsigned int cpu_arch_flags = 0; /* cpu feature flags */ + /* Interface to relax_segment. There are 2 relax states for 386 jump insns: one for conditional & one for unconditional jumps. This is because these two types of @@ -1566,17 +1566,22 @@ md_assemble (line) return; } - if (!intel_syntax - && (i.types[0] & JumpAbsolute) != (t->operand_types[0] & JumpAbsolute)) + if (!quiet_warnings) { - as_warn (_("indirect %s without `*'"), t->name); - } + if (!intel_syntax + && ((i.types[0] & JumpAbsolute) + != (t->operand_types[0] & JumpAbsolute))) + { + as_warn (_("indirect %s without `*'"), t->name); + } - if ((t->opcode_modifier & (IsPrefix|IgnoreSize)) == (IsPrefix|IgnoreSize)) - { - /* Warn them that a data or address size prefix doesn't affect - assembly of the next line of code. */ - as_warn (_("stand-alone `%s' prefix"), t->name); + if ((t->opcode_modifier & (IsPrefix|IgnoreSize)) + == (IsPrefix|IgnoreSize)) + { + /* Warn them that a data or address size prefix doesn't + affect assembly of the next line of code. */ + as_warn (_("stand-alone `%s' prefix"), t->name); + } } /* Copy the template we found. */ @@ -1692,7 +1697,8 @@ md_assemble (line) ) { #if REGISTER_WARNINGS - if ((i.tm.operand_types[op] & InOutPortReg) == 0) + if (!quiet_warnings + && (i.tm.operand_types[op] & InOutPortReg) == 0) as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), (i.op[op].regs - (i.types[op] & Reg16 ? 8 : 16))->reg_name, i.op[op].regs->reg_name, @@ -1731,7 +1737,8 @@ md_assemble (line) } #if REGISTER_WARNINGS /* Warn if the e prefix on a general reg is missing. */ - else if ((i.types[op] & Reg16) != 0 + else if (!quiet_warnings + && (i.types[op] & Reg16) != 0 && (i.tm.operand_types[op] & (Reg32|Acc)) != 0) { as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), @@ -1758,7 +1765,8 @@ md_assemble (line) } #if REGISTER_WARNINGS /* Warn if the e prefix on a general reg is present. */ - else if ((i.types[op] & Reg32) != 0 + else if (!quiet_warnings + && (i.types[op] & Reg32) != 0 && (i.tm.operand_types[op] & (Reg16|Acc)) != 0) { as_warn (_("using `%%%s' instead of `%%%s' due to `%c' suffix"), @@ -1934,7 +1942,7 @@ md_assemble (line) unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1; /* Register goes in low 3 bits of opcode. */ i.tm.base_opcode |= i.op[op].regs->reg_num; - if ((i.tm.opcode_modifier & Ugh) != 0) + if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0) { /* Warn about some common errors, but press on regardless. The first case can be generated by gcc (<= 2.8.1). */ @@ -2191,7 +2199,7 @@ md_assemble (line) return; } } - else if ((i.tm.opcode_modifier & Ugh) != 0) + else if (!quiet_warnings && (i.tm.opcode_modifier & Ugh) != 0) { /* UnixWare fsub no args is alias for fsubp, fadd -> faddp, etc. */ as_warn (_("translating to `%sp'"), i.tm.name); @@ -3927,25 +3935,14 @@ void md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) char *ptr; addressT from_addr, to_addr; - fragS *frag; - symbolS *to_symbol; + fragS *frag ATTRIBUTE_UNUSED; + symbolS *to_symbol ATTRIBUTE_UNUSED; { offsetT offset; - if (flag_do_long_jump) - { - offset = to_addr - S_GET_VALUE (to_symbol); - md_number_to_chars (ptr, (valueT) 0xe9, 1);/* opcode for long jmp */ - md_number_to_chars (ptr + 1, (valueT) offset, 4); - fix_new (frag, (ptr + 1) - frag->fr_literal, 4, - to_symbol, (offsetT) 0, 0, BFD_RELOC_32); - } - else - { - offset = to_addr - (from_addr + 5); - md_number_to_chars (ptr, (valueT) 0xe9, 1); - md_number_to_chars (ptr + 1, (valueT) offset, 4); - } + offset = to_addr - (from_addr + 5); + md_number_to_chars (ptr, (valueT) 0xe9, 1); + md_number_to_chars (ptr + 1, (valueT) offset, 4); } /* Apply a fixup (fixS) to segment data, once it has been determined @@ -4275,13 +4272,14 @@ md_parse_option (c, arg) { switch (c) { - case 'm': - flag_do_long_jump = 1; + case 'q': + quiet_warnings = 1; break; #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - /* -k: Ignore for FreeBSD compatibility. */ - case 'k': + /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section + should be emitted or not. FIXME: Not implemented. */ + case 'Q': break; /* -V: SVR4 argument to print version ID. */ @@ -4289,20 +4287,14 @@ md_parse_option (c, arg) print_version_id (); break; - /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section - should be emitted or not. FIXME: Not implemented. */ - case 'Q': + /* -k: Ignore for FreeBSD compatibility. */ + case 'k': break; case 's': /* -s: On i386 Solaris, this tells the native assembler to use .stab instead of .stab.excl. We always use .stab anyhow. */ break; - - case 'q': - /* -q: On i386 Solaris, this tells the native assembler to do - fewer checks. */ - break; #endif default: @@ -4315,15 +4307,16 @@ void md_show_usage (stream) FILE *stream; { - fprintf (stream, _("\ - -m do long jump\n")); #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) fprintf (stream, _("\ - -V print assembler version number\n\ - -k ignored\n\ - -Qy, -Qn ignored\n\ - -q ignored\n\ - -s ignored\n")); + -Q ignored\n\ + -V print assembler version number\n\ + -k ignored\n\ + -q quieten some warnings\n\ + -s ignored\n")); +#else + fprintf (stream, _("\ + -q quieten some warnings\n")); #endif } -- 2.30.2