summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Belyashov <sergey.belyashov@gmail.com>2020-03-20 13:53:02 +0000
committerNick Clifton <nickc@redhat.com>2020-03-20 13:53:02 +0000
commit0d832e7f5e8c2e3659a55955c3b419e7cf5c9a34 (patch)
tree021133e1b0eb3b287e174486d197c337edc81930
parentc7da12c72c2eeb4f62e772df5cbb1f50f35a84ee (diff)
downloadbinutils-gdb-0d832e7f5e8c2e3659a55955c3b419e7cf5c9a34.tar.gz
Add support for the xdef and xref pseudo-ops to the Z80 assembler.
PR 25690 * config/tc-z80.c (md_pseudo_table): Add xdef anf xref pseudo ops. * doc/c-z80.texi: Update documentation.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/tc-z80.c2
-rw-r--r--gas/doc/c-z80.texi83
3 files changed, 64 insertions, 27 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 026336220ef..86ed22d19a0 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,11 @@
2020-03-17 Sergey Belyashov <sergey.belyashov@gmail.com>
+ PR 25690
+ * config/tc-z80.c (md_pseudo_table): Add xdef anf xref pseudo ops.
+ * doc/c-z80.texi: Update documentation.
+
+2020-03-17 Sergey Belyashov <sergey.belyashov@gmail.com>
+
PR 25641
PR 25668
PR 25633
diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c
index a3ab13de155..59cda3d03c1 100644
--- a/gas/config/tc-z80.c
+++ b/gas/config/tc-z80.c
@@ -3460,6 +3460,8 @@ const pseudo_typeS md_pseudo_table[] =
{ "dw", z80_cons, 2},
{ "psect", psect, 0}, /* TODO: Translate attributes. */
{ "set", 0, 0}, /* Real instruction on z80. */
+ { "xdef", s_globl, 0}, /* Synonym for .GLOBAL */
+ { "xref", s_ignore, 0}, /* Synonym for .EXTERN */
{ NULL, 0, 0 }
} ;
diff --git a/gas/doc/c-z80.texi b/gas/doc/c-z80.texi
index d2dbac1edd3..2858d6f1e68 100644
--- a/gas/doc/c-z80.texi
+++ b/gas/doc/c-z80.texi
@@ -30,7 +30,7 @@
@c man begin OPTIONS
@table @gcctabopt
-@cindex @samp{-march=} option, Z80
+@cindex @code{-march=} command-line option, Z80
@item -march=@var{CPU}[-@var{EXT}@dots{}][+@var{EXT}@dots{}]
This option specifies the target processor. The assembler will issue
an error message if an attempt is made to assemble an instruction which
@@ -45,9 +45,9 @@ are recognized:
In addition to the basic instruction set, the assembler can be told to
accept some extention mnemonics. For example,
@code{-march=z180+sli+infc} extends @var{z180} with @var{SLI} instructions and
-@var{IN F,(C)}. The following instructions are currently supported:
+@var{IN F,(C)}. The following extentions are currently supported:
@code{full} (all known instructions),
-@code{adl} (ADL CPU mode by default),
+@code{adl} (ADL CPU mode by default, eZ80 only),
@code{sli} (instruction known as @var{SLI}, @var{SLL} or @var{SL1}),
@code{xyhl} (instructions with halves of index registers: @var{IXL}, @var{IXH},
@var{IYL}, @var{IYH}),
@@ -59,6 +59,8 @@ mnemonics starting with @code{-} revoke the respective functionality:
@code{-march=z80-full+xyhl} first removes all default extentions and adds
support for index registers halves only.
+If this option is not specified then @code{-march=z80+xyhl+infc} is assumed.
+
@cindex @code{-local-prefix} command-line option, Z80
@item -local-prefix=@var{prefix}
Mark all labels with specified prefix as local. But such label can be
@@ -67,7 +69,7 @@ local label prefix @code{.L}, it is just adds new one.
@cindex @code{-colonless} command-line option, Z80
@item -colonless
-Accept colonless labels. All names at line begin are treated as labels.
+Accept colonless labels. All symbols at line begin are treated as labels.
@cindex @code{-sdcc} command-line option, Z80
@item -sdcc
@@ -215,59 +217,86 @@ Supported half, single and double precision IEEE754 compatible numbers.
@node Z80 Directives
@section Z80 Assembler Directives
+@cindex Z80-only directives
@command{@value{AS}} for the Z80 supports some additional directives for
compatibility with other assemblers.
-@cindex Z80-only directives
These are the additional directives in @code{@value{AS}} for the Z80:
@table @code
-@item assume @var{ADL}@samp{=}@var{expression}
+@item @code{.assume ADL = @var{expression}}
+@cindex @code{.assume} directive, Z80
Set ADL status for eZ80. Non-zero value enable compilation in ADL mode else
used Z80 mode. ADL and Z80 mode produces incompatible object code. Mixing
both of them within one binary may lead problems with disassembler.
-@item db @var{expression}|@var{string}[,@var{expression}|@var{string}...]
-@itemx defb @var{expression}|@var{string}[,@var{expression}|@var{string}...]
-@itemx defm @var{string}...]
+@item @code{db @var{expression}|@var{string}[,@var{expression}|@var{string}...]}
+@cindex @code{db} directive, Z80
+@itemx @code{defb @var{expression}|@var{string}[,@var{expression}|@var{string}...]}
+@cindex @code{defb} directive, Z80
+@itemx @code{defm @var{string}[,@var{string}...]}
+@cindex @code{defm} directive, Z80
For each @var{string} the characters are copied to the object file, for
each other @var{expression} the value is stored in one byte.
A warning is issued in case of an overflow.
Backslash symbol in the strings is generic symbol, it cannot be used as
-escape character (for this purpose use @code{.ascii} or @code{.asciiz}
-directives).
+escape character (@xref{Ascii,,@code{.ascii}}).
-@item dw @var{expression}[,@var{expression}...]
-@itemx defw @var{expression}[,@var{expression}...]
+@item @code{dw @var{expression}[,@var{expression}...]}
+@cindex @code{dw} directive, Z80
+@itemx @code{defw @var{expression}[,@var{expression}...]}
+@cindex @code{defw} directive, Z80
For each @var{expression} the value is stored in two bytes, ignoring
overflow.
-@item d24 @var{expression}[,@var{expression}...]
-@itemx def24 @var{expression}[,@var{expression}...]
+@item @code{d24 @var{expression}[,@var{expression}...]}
+@cindex @code{d24} directive, Z80
+@itemx @code{def24 @var{expression}[,@var{expression}...]}
+@cindex @code{def24} directive, Z80
For each @var{expression} the value is stored in three bytes, ignoring
overflow.
-@item d32 @var{expression}[,@var{expression}...]
-@itemx def32 @var{expression}[,@var{expression}...]
+@item @code{d32 @var{expression}[,@var{expression}...]}
+@cindex @code{d32} directive, Z80
+@itemx @code{def32 @var{expression}[,@var{expression}...]}
+@cindex @code{def32} directive, Z80
For each @var{expression} the value is stored in four bytes, ignoring
overflow.
-@item ds @var{count}[, @var{value}]
-@itemx defs @var{count}[, @var{value}]
+@item @code{ds @var{count}[, @var{value}]}
+@cindex @code{ds} directive, Z80
+@itemx @code{defs @var{count}[, @var{value}]}
+@cindex @code{defs} directive, Z80
@c Synonyms for @code{ds.b},
@c which should have been described elsewhere
Fill @var{count} bytes in the object file with @var{value}, if
@var{value} is omitted it defaults to zero.
-@item @var{symbol} equ @var{expression}
-@itemx @var{symbol} defl @var{expression}
-These directives set the value of @var{symbol} to @var{expression}. If
-@code{equ} is used, it is an error if @var{symbol} is already defined.
-Symbols defined with @code{equ} are not protected from redefinition.
-
-@item psect @var{name}
-A synonym for @xref{Section}, no second argument should be given.
+@item @code{@var{symbol} defl @var{expression}}
+@cindex @code{defl} directive, Z80
+The @code{defl} directive is like @code{.set} but with different syntax (@xref{Set,,@code{.set}}).
+It set the value of @var{symbol} to @var{expression}. Symbols defined
+with @code{defl} are not protected from redefinition.
+
+@item @code{@var{symbol} equ @var{expression}}
+@cindex @code{equ} directive, Z80
+The @code{equ} directive is like @code{.equiv} but with different syntax (@xref{Equiv,,@code{.equiv}}).
+It set the value of @var{symbol} to @var{expression}. It is an error
+if @var{symbol} is already defined. Symbols defined with @code{equ}
+are not protected from redefinition.
+
+@item @code{psect @var{name}}
+@cindex @code{psect} directive, Z80
+A synonym for @code{.section}, no second argument should be given (@xref{Section,,@code{.section}}).
+
+@item @code{xdef @var{symbol}}
+@cindex @code{xdef} directive, Z80
+A synonym for @code{.global}, make @var{symbol} is visible to linker (@xref{Global,,@code{.global}}).
+
+@item @code{xref @var{name}}
+@cindex @code{xref} directive, Z80
+A synonym for @code{.extern} (@ref{Extern,,@code{.extern}}).
@ignore
The following attributes will possibly be recognized in the future