undefined, in exactly the same way as .equiv.
+2002-07-19 Miroslav Tichy <tichm9am@ss1000.ms.mff.cuni.cz>
+ Nick Clifton <nickc@redhat.com>
+
+ * cond.c (s_ifdef): Treat a referenced but not yet defined
+ symbol as if it were undefined, in exactly the same way as
+ .equiv.
+
+ * doc/as.texinfo: Document that .ifdef, .ifndef and .equiv
+ consider referenced bug not yet defined symbols to be
+ undefined.
+
2002-07-18 Denis Chertykov <denisc@overta.ru>
Frank Ch. Eigler <fche@redhat.com>
Alan Lehotsky <alehotsky@cygnus.com>
static struct conditional_frame *current_cframe = NULL;
+/* Performs the .ifdef (test_defined == 1) and
+ the .ifndef (test_defined == 0) pseudo op. */
+
void
-s_ifdef (arg)
- int arg;
+s_ifdef (test_defined)
+ int test_defined;
{
/* Points to name of symbol. */
- register char *name;
+ char *name;
/* Points to symbol. */
- register symbolS *symbolP;
+ symbolS *symbolP;
struct conditional_frame cframe;
+ char c;
/* Leading whitespace is part of operand. */
SKIP_WHITESPACE ();
as_bad (_("invalid identifier for \".ifdef\""));
obstack_1grow (&cond_obstack, 0);
ignore_rest_of_line ();
+ return;
}
+
+ c = get_symbol_end ();
+ symbolP = symbol_find (name);
+ *input_line_pointer = c;
+
+ initialize_cframe (&cframe);
+
+ if (cframe.dead_tree)
+ cframe.ignoring = 1;
else
{
- char c;
+ int is_defined;
- c = get_symbol_end ();
- symbolP = symbol_find (name);
- *input_line_pointer = c;
+ /* Use the same definition of 'defined' as .equiv so that a symbol
+ which has been referenced but not yet given a value/address is
+ considered to be undefined. */
+ is_defined =
+ symbolP != NULL
+ && S_IS_DEFINED (symbolP)
+ && S_GET_SEGMENT (symbolP) != reg_section;
- initialize_cframe (&cframe);
- cframe.ignoring = cframe.dead_tree || !((symbolP != 0) ^ arg);
- current_cframe = ((struct conditional_frame *)
- obstack_copy (&cond_obstack, &cframe,
- sizeof (cframe)));
+ cframe.ignoring = ! (test_defined ^ is_defined);
+ }
- if (LISTING_SKIP_COND ()
- && cframe.ignoring
- && (cframe.previous_cframe == NULL
- || ! cframe.previous_cframe->ignoring))
- listing_list (2);
+ current_cframe = ((struct conditional_frame *)
+ obstack_copy (&cond_obstack, &cframe,
+ sizeof (cframe)));
+
+ if (LISTING_SKIP_COND ()
+ && cframe.ignoring
+ && (cframe.previous_cframe == NULL
+ || ! cframe.previous_cframe->ignoring))
+ listing_list (2);
- demand_empty_rest_of_line ();
- } /* if a valid identifyer name */
+ demand_empty_rest_of_line ();
}
void
@cindex option summary
@cindex summary of options
Here is a brief summary of how to invoke @command{@value{AS}}. For details,
-@pxref{Invoking,,Comand-Line Options}.
+@pxref{Invoking,,Command-Line Options}.
@c man title AS the portable GNU assembler.
Specifies that the extended IP2022 instructions are allowed.
@item -mip2022
-Restores the default behaviour, which restricts the permited instructions to
+Restores the default behaviour, which restricts the permitted instructions to
just the basic IP2022 ones.
@end table
@kindex --listing-lhs-width2
@cindex Width of continuation lines of disassembly output
Sets the maximum width, in words, of any further lines of the hex byte dump for
-a given inut source line. If this value is not specified, it defaults to being
+a given input source line. If this value is not specified, it defaults to being
the same as the value specified for @samp{--listing-lhs-width}. If neither
switch is used the default is to one.
@section @code{.equiv @var{symbol}, @var{expression}}
@cindex @code{equiv} directive
The @code{.equiv} directive is like @code{.equ} and @code{.set}, except that
-the assembler will signal an error if @var{symbol} is already defined.
+the assembler will signal an error if @var{symbol} is already defined. Note a
+symbol which has been referenced but not actually defined is considered to be
+undefined.
Except for the contents of the error message, this is roughly equivalent to
@smallexample
@cindex @code{ifdef} directive
@item .ifdef @var{symbol}
Assembles the following section of code if the specified @var{symbol}
-has been defined.
+has been defined. Note a symbol which has been referenced but not yet defined
+is considered to be undefined.
@cindex @code{ifc} directive
@item .ifc @var{string1},@var{string2}
@item .ifndef @var{symbol}
@itemx .ifnotdef @var{symbol}
Assembles the following section of code if the specified @var{symbol}
-has not been defined. Both spelling variants are equivalent.
+has not been defined. Both spelling variants are equivalent. Note a symbol
+which has been referenced but not yet defined is considered to be undefined.
@cindex @code{ifne} directive
@item .ifne @var{absolute expression}