Add and handle new --alternate command line option.
This commit is contained in:
parent
a21de0dadf
commit
caa32fe507
|
@ -1,3 +1,15 @@
|
|||
2004-08-13 Jan Beulich <jbeulich@novell.com>
|
||||
Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* as.c: Add and handle new --alternate command line option.
|
||||
* macro.c (macro_set_alternate): New.
|
||||
* macro.h (macro_set_alternate): Declare.
|
||||
* read.c: Add and handle new .altmacro and .noaltmacro directives.
|
||||
* doc/as.texinfo: Document new command line option and pseudo-ops
|
||||
as well as insert documentation originating from gasp about
|
||||
alternate macro syntax.
|
||||
* NEWS: Mention new command line option and pseudo-ops.
|
||||
|
||||
2004-08-10 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* expr.c (operand): Handle the "~", "-", and "!" operators applied
|
||||
|
|
3
gas/NEWS
3
gas/NEWS
|
@ -12,6 +12,9 @@
|
|||
* Support for ColdFire EMAC instructions added and Motorola syntax for MAC/EMAC
|
||||
instrucitons.
|
||||
|
||||
* New command line option --alternate and pseudo-ops .altmacro and .noaltmacro
|
||||
added to enter (and leave) alternate macro syntax mode.
|
||||
|
||||
Changes in 2.15:
|
||||
|
||||
* The MIPS -membedded-pic option (Embedded-PIC code generation) is
|
||||
|
|
25
gas/as.c
25
gas/as.c
|
@ -123,6 +123,8 @@ static struct itbl_file_list *itbl_files;
|
|||
|
||||
static long start_time;
|
||||
|
||||
static int flag_macro_alternate;
|
||||
|
||||
|
||||
#ifdef USE_EMULATIONS
|
||||
#define EMULATION_ENVIRON "AS_EMULATION"
|
||||
|
@ -244,6 +246,8 @@ Options:\n\
|
|||
s include symbols\n\
|
||||
=FILE list to FILE (must be last sub-option)\n"));
|
||||
|
||||
fprintf (stream, _("\
|
||||
--alternate initially turn on alternate macro syntax\n"));
|
||||
fprintf (stream, _("\
|
||||
-D produce assembler debugging messages\n"));
|
||||
fprintf (stream, _("\
|
||||
|
@ -414,6 +418,7 @@ parse_args (int * pargc, char *** pargv)
|
|||
OPTION_TARGET_HELP,
|
||||
OPTION_EXECSTACK,
|
||||
OPTION_NOEXECSTACK,
|
||||
OPTION_ALTERNATE,
|
||||
OPTION_WARN_FATAL
|
||||
};
|
||||
|
||||
|
@ -457,6 +462,7 @@ parse_args (int * pargc, char *** pargv)
|
|||
{"execstack", no_argument, NULL, OPTION_EXECSTACK},
|
||||
{"noexecstack", no_argument, NULL, OPTION_NOEXECSTACK},
|
||||
#endif
|
||||
{"alternate", no_argument, NULL, OPTION_ALTERNATE},
|
||||
{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
|
||||
/* When you add options here, check that they do not collide with
|
||||
OPTION_MD_BASE. See as.h. */
|
||||
|
@ -731,6 +737,19 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
|
|||
flag_always_generate_output = 1;
|
||||
break;
|
||||
|
||||
case OPTION_ALTERNATE:
|
||||
optarg = old_argv [optind - 1];
|
||||
while (* optarg == '-')
|
||||
optarg ++;
|
||||
|
||||
if (strcmp (optarg, "alternate") == 0)
|
||||
{
|
||||
flag_macro_alternate = 1;
|
||||
break;
|
||||
}
|
||||
optarg ++;
|
||||
/* Fall through. */
|
||||
|
||||
case 'a':
|
||||
if (optarg)
|
||||
{
|
||||
|
@ -981,7 +1000,6 @@ perform_an_assembly_pass (int argc, char ** argv)
|
|||
int
|
||||
main (int argc, char ** argv)
|
||||
{
|
||||
int macro_alternate;
|
||||
int macro_strip_at;
|
||||
int keep_it;
|
||||
|
||||
|
@ -1036,7 +1054,6 @@ main (int argc, char ** argv)
|
|||
if (flag_print_statistics)
|
||||
xatexit (dump_statistics);
|
||||
|
||||
macro_alternate = 0;
|
||||
macro_strip_at = 0;
|
||||
#ifdef TC_I960
|
||||
macro_strip_at = flag_mri;
|
||||
|
@ -1044,11 +1061,11 @@ main (int argc, char ** argv)
|
|||
#ifdef TC_A29K
|
||||
/* For compatibility with the AMD 29K family macro assembler
|
||||
specification. */
|
||||
macro_alternate = 1;
|
||||
flag_macro_alternate = 1;
|
||||
macro_strip_at = 1;
|
||||
#endif
|
||||
|
||||
macro_init (macro_alternate, flag_mri, macro_strip_at, macro_expr);
|
||||
macro_init (flag_macro_alternate, flag_mri, macro_strip_at, macro_expr);
|
||||
|
||||
PROGRESS (1);
|
||||
|
||||
|
|
|
@ -226,9 +226,9 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
|
|||
@c to be limited to one line for the header.
|
||||
@smallexample
|
||||
@c man begin SYNOPSIS
|
||||
@value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{-D}] [@b{--defsym} @var{sym}=@var{val}]
|
||||
[@b{-f}] [@b{--gstabs}] [@b{--gstabs+}] [@b{--gdwarf2}] [@b{--help}]
|
||||
[@b{-I} @var{dir}] [@b{-J}] [@b{-K}] [@b{-L}]
|
||||
@value{AS} [@b{-a}[@b{cdhlns}][=@var{file}]] [@b{--alternate}] [@b{-D}]
|
||||
[@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{--gstabs}] [@b{--gstabs+}]
|
||||
[@b{--gdwarf2}] [@b{--help}] [@b{-I} @var{dir}] [@b{-J}] [@b{-K}] [@b{-L}]
|
||||
[@b{--listing-lhs-width}=@var{NUM}] [@b{--listing-lhs-width2}=@var{NUM}]
|
||||
[@b{--listing-rhs-width}=@var{NUM}] [@b{--listing-cont-lines}=@var{NUM}]
|
||||
[@b{--keep-locals}] [@b{-o} @var{objfile}] [@b{-R}] [@b{--statistics}] [@b{-v}]
|
||||
|
@ -463,6 +463,9 @@ You may combine these options; for example, use @samp{-aln} for assembly
|
|||
listing without forms processing. The @samp{=file} option, if used, must be
|
||||
the last one. By itself, @samp{-a} defaults to @samp{-ahls}.
|
||||
|
||||
@item --alternate
|
||||
Begin in alternate macro mode, see @ref{Altmacro,,@code{.altmacro}}.
|
||||
|
||||
@item -D
|
||||
Ignored. This option is accepted for script compatibility with calls to
|
||||
other assemblers.
|
||||
|
@ -1457,6 +1460,7 @@ assembler.)
|
|||
|
||||
@menu
|
||||
* a:: -a[cdhlns] enable listings
|
||||
* alternate:: --alternate enable alternate macro syntax
|
||||
* D:: -D for compatibility
|
||||
* f:: -f to work faster
|
||||
* I:: -I for .include search path
|
||||
|
@ -1529,6 +1533,12 @@ directives. This is because the listing code buffers input source lines from
|
|||
stdin only after they have been preprocessed by the assembler. This reduces
|
||||
memory usage and makes the code more efficient.
|
||||
|
||||
@node alternate
|
||||
@section @option{--alternate}
|
||||
|
||||
@kindex --alternate
|
||||
Begin in alternate macro mode, see @ref{Altmacro,,@code{.altmacro}}.
|
||||
|
||||
@node D
|
||||
@section @option{-D}
|
||||
|
||||
|
@ -3677,6 +3687,7 @@ Some machine configurations provide additional directives.
|
|||
@end ifset
|
||||
|
||||
* Align:: @code{.align @var{abs-expr} , @var{abs-expr}}
|
||||
* Altmacro:: @code{.altmacro}
|
||||
* Ascii:: @code{.ascii "@var{string}"}@dots{}
|
||||
* Asciz:: @code{.asciz "@var{string}"}@dots{}
|
||||
* Balign:: @code{.balign @var{abs-expr} , @var{abs-expr}}
|
||||
|
@ -3753,6 +3764,7 @@ Some machine configurations provide additional directives.
|
|||
|
||||
* Macro:: @code{.macro @var{name} @var{args}}@dots{}
|
||||
* MRI:: @code{.mri @var{val}}
|
||||
* Noaltmacro:: @code{.noaltmacro}
|
||||
* Nolist:: @code{.nolist}
|
||||
* Octa:: @code{.octa @var{bignums}}
|
||||
* Org:: @code{.org @var{new-lc} , @var{fill}}
|
||||
|
@ -4847,20 +4859,52 @@ Exit early from the current macro definition.
|
|||
executed in this pseudo-variable; you can copy that number to your
|
||||
output with @samp{\@@}, but @emph{only within a macro definition}.
|
||||
|
||||
@ignore
|
||||
@item LOCAL @var{name} [ , @dots{} ]
|
||||
@emph{Warning: @code{LOCAL} is only available if you select ``alternate
|
||||
macro syntax'' with @samp{-a} or @samp{--alternate}.} @xref{Alternate,,
|
||||
Alternate macro syntax}.
|
||||
macro syntax'' with @samp{--alternate} or @code{.altmacro}.}
|
||||
@xref{Altmacro,,@code{.altmacro}}.
|
||||
@end ftable
|
||||
|
||||
Generate a string replacement for each of the @var{name} arguments, and
|
||||
@node Altmacro
|
||||
@section @code{.altmacro}
|
||||
Enable alternate macro mode, enabling:
|
||||
|
||||
@ftable @code
|
||||
@item LOCAL @var{name} [ , @dots{} ]
|
||||
One additional directive, @code{LOCAL}, is available. It is used to
|
||||
generate a string replacement for each of the @var{name} arguments, and
|
||||
replace any instances of @var{name} in each macro expansion. The
|
||||
replacement string is unique in the assembly, and different for each
|
||||
separate macro expansion. @code{LOCAL} allows you to write macros that
|
||||
define symbols, without fear of conflict between separate macro expansions.
|
||||
@end ignore
|
||||
|
||||
@item String delimiters
|
||||
You can write strings delimited in these other ways besides
|
||||
@code{"@var{string}"}:
|
||||
|
||||
@table @code
|
||||
@item '@var{string}'
|
||||
You can delimit strings with single-quote charaters.
|
||||
|
||||
@item <@var{string}>
|
||||
You can delimit strings with matching angle brackets.
|
||||
@end table
|
||||
|
||||
@item single-character string escape
|
||||
To include any single character literally in a string (even if the
|
||||
character would otherwise have some special meaning), you can prefix the
|
||||
character with @samp{!} (an exclamation mark). For example, you can
|
||||
write @samp{<4.3 !> 5.4!!>} to get the literal text @samp{4.3 > 5.4!}.
|
||||
|
||||
@item Expression results as strings
|
||||
You can write @samp{%@var{expr}} to evaluate the expression @var{expr}
|
||||
and use the result as a string.
|
||||
@end ftable
|
||||
|
||||
@node Noaltmacro
|
||||
@section @code{.noaltmacro}
|
||||
Disable alternate macro mode. @ref{Altmacro}
|
||||
|
||||
@node Nolist
|
||||
@section @code{.nolist}
|
||||
|
||||
|
|
|
@ -132,6 +132,15 @@ macro_init (int alternate, int mri, int strip_at,
|
|||
macro_expr = expr;
|
||||
}
|
||||
|
||||
/* Switch in and out of alternate mode on the fly. */
|
||||
|
||||
void
|
||||
macro_set_alternate(alternate)
|
||||
int alternate;
|
||||
{
|
||||
macro_alternate = alternate;
|
||||
}
|
||||
|
||||
/* Switch in and out of MRI mode on the fly. */
|
||||
|
||||
void
|
||||
|
|
|
@ -73,6 +73,7 @@ extern int macro_nest;
|
|||
extern int buffer_and_nest (const char *, const char *, sb *, int (*) (sb *));
|
||||
extern void macro_init
|
||||
(int, int, int, int (*) (const char *, int, sb *, int *));
|
||||
extern void macro_set_alternate (int);
|
||||
extern void macro_mri_mode (int);
|
||||
extern const char *define_macro
|
||||
(int, sb *, sb *, int (*) (sb *), const char **);
|
||||
|
|
12
gas/read.c
12
gas/read.c
|
@ -216,6 +216,7 @@ static int dwarf_file_string;
|
|||
|
||||
static void do_align (int, char *, int, int);
|
||||
static void s_align (int, int);
|
||||
static void s_altmacro (int);
|
||||
static int hex_float (int, char *);
|
||||
static segT get_known_segmented_expression (expressionS * expP);
|
||||
static void pobegin (void);
|
||||
|
@ -251,6 +252,7 @@ static struct hash_control *po_hash;
|
|||
static const pseudo_typeS potable[] = {
|
||||
{"abort", s_abort, 0},
|
||||
{"align", s_align_ptwo, 0},
|
||||
{"altmacro", s_altmacro, 1},
|
||||
{"ascii", stringer, 0},
|
||||
{"asciz", stringer, 1},
|
||||
{"balign", s_align_bytes, 0},
|
||||
|
@ -351,6 +353,7 @@ static const pseudo_typeS potable[] = {
|
|||
{"mri", s_mri, 0},
|
||||
{".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
|
||||
{"name", s_ignore, 0},
|
||||
{"noaltmacro", s_altmacro, 0},
|
||||
{"noformat", s_ignore, 0},
|
||||
{"nolist", listing_list, 0}, /* Turn listing off. */
|
||||
{"nopage", listing_nopage, 0},
|
||||
|
@ -1320,6 +1323,15 @@ s_align_ptwo (int arg)
|
|||
s_align (arg, 0);
|
||||
}
|
||||
|
||||
/* Switch in and out of alternate macro mode. */
|
||||
|
||||
void
|
||||
s_altmacro (int on)
|
||||
{
|
||||
demand_empty_rest_of_line ();
|
||||
macro_set_alternate (on);
|
||||
}
|
||||
|
||||
symbolS *
|
||||
s_comm_internal (int param,
|
||||
symbolS *(*comm_parse_extra) (int, symbolS *, addressT))
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2004-08-13 Jan Beulich <jbeulich@novell.com>
|
||||
|
||||
* gas/all/altmacro.[sd]: New test.
|
||||
* gas/all/gas.exp: Run the new test.
|
||||
|
||||
2004-08-10 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* gas/arm/bignum1.s: New test.
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#as: --alternate
|
||||
#objdump: -s -j .data
|
||||
#name: alternate macro syntax
|
||||
|
||||
# Test the alternate macro syntax.
|
||||
|
||||
.*: .*
|
||||
|
||||
Contents of section .data:
|
||||
0000 01020912 61626331 32332121 3c3e2721 .*
|
||||
0010 3c3e273e 3c21 .*
|
|
@ -0,0 +1,36 @@
|
|||
.macro m1 v1, v2
|
||||
LOCAL l1, l2
|
||||
label&v1:
|
||||
l1: .byte v1
|
||||
label&v2:
|
||||
l2: .byte v2
|
||||
.endm
|
||||
|
||||
.macro m2 v1, v2
|
||||
m1 %v1, %(v2-v1)
|
||||
.endm
|
||||
|
||||
.macro m3 str
|
||||
.ascii &str
|
||||
.endm
|
||||
|
||||
.data
|
||||
|
||||
m2 1, 3
|
||||
m2 9, 27
|
||||
|
||||
m3 "abc"
|
||||
m3 <123>
|
||||
|
||||
.noaltmacro
|
||||
|
||||
.macro m4 str
|
||||
.ascii "&str"
|
||||
.endm
|
||||
|
||||
m4 "!!<>'"
|
||||
|
||||
.altmacro
|
||||
|
||||
m3 "!!<>'"
|
||||
m3 <!>!<!!>
|
|
@ -114,6 +114,8 @@ case $target_triplet in {
|
|||
}
|
||||
}
|
||||
|
||||
run_dump_test altmacro
|
||||
|
||||
# This test is for any COFF target.
|
||||
# We omit m88k COFF because it uses weird pseudo-op names.
|
||||
# We omit the ARM toolchains because they define locals to
|
||||
|
|
Loading…
Reference in New Issue