blob: 9ebfda007101df6b269c0b67591039c776fafd02 [file] [log] [blame]
\input texinfo @c -*-Texinfo-*-
@c Copyright (C) 1991-2016 Free Software Foundation, Inc.
@c UPDATE!! On future updates--
@c (1) check for new machine-dep cmdline options in
@c md_parse_option definitions in config/tc-*.c
@c (2) for platform-specific directives, examine md_pseudo_op
@c in config/tc-*.c
@c (3) for object-format specific directives, examine obj_pseudo_op
@c in config/obj-*.c
@c (4) portable directives in potable[] in read.c
@c %**start of header
@setfilename as.info
@c ---config---
@macro gcctabopt{body}
@code{\body\}
@end macro
@c defaults, config file may override:
@set have-stabs
@c ---
@c man begin NAME
@c ---
@include asconfig.texi
@include bfdver.texi
@c ---
@c man end
@c ---
@c common OR combinations of conditions
@ifset COFF
@set COFF-ELF
@end ifset
@ifset ELF
@set COFF-ELF
@end ifset
@ifset AOUT
@set aout-bout
@end ifset
@ifset ARM/Thumb
@set ARM
@end ifset
@ifset Blackfin
@set Blackfin
@end ifset
@ifset BOUT
@set aout-bout
@end ifset
@ifset H8/300
@set H8
@end ifset
@ifset SH
@set H8
@end ifset
@ifset HPPA
@set abnormal-separator
@end ifset
@c ------------
@ifset GENERIC
@settitle Using @value{AS}
@end ifset
@ifclear GENERIC
@settitle Using @value{AS} (@value{TARGET})
@end ifclear
@setchapternewpage odd
@c %**end of header
@c @smallbook
@c @set SMALL
@c WARE! Some of the machine-dependent sections contain tables of machine
@c instructions. Except in multi-column format, these tables look silly.
@c Unfortunately, Texinfo doesn't have a general-purpose multi-col format, so
@c the multi-col format is faked within @example sections.
@c
@c Again unfortunately, the natural size that fits on a page, for these tables,
@c is different depending on whether or not smallbook is turned on.
@c This matters, because of order: text flow switches columns at each page
@c break.
@c
@c The format faked in this source works reasonably well for smallbook,
@c not well for the default large-page format. This manual expects that if you
@c turn on @smallbook, you will also uncomment the "@set SMALL" to enable the
@c tables in question. You can turn on one without the other at your
@c discretion, of course.
@ifinfo
@set SMALL
@c the insn tables look just as silly in info files regardless of smallbook,
@c might as well show 'em anyways.
@end ifinfo
@ifnottex
@dircategory Software development
@direntry
* As: (as). The GNU assembler.
* Gas: (as). The GNU assembler.
@end direntry
@end ifnottex
@finalout
@syncodeindex ky cp
@copying
This file documents the GNU Assembler "@value{AS}".
@c man begin COPYRIGHT
Copyright @copyright{} 1991-2016 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
@c man end
@end copying
@titlepage
@title Using @value{AS}
@subtitle The @sc{gnu} Assembler
@ifclear GENERIC
@subtitle for the @value{TARGET} family
@end ifclear
@ifset VERSION_PACKAGE
@sp 1
@subtitle @value{VERSION_PACKAGE}
@end ifset
@sp 1
@subtitle Version @value{VERSION}
@sp 1
@sp 13
The Free Software Foundation Inc.@: thanks The Nice Computer
Company of Australia for loaning Dean Elsner to write the
first (Vax) version of @command{as} for Project @sc{gnu}.
The proprietors, management and staff of TNCCA thank FSF for
distracting the boss while they got some work
done.
@sp 3
@author Dean Elsner, Jay Fenlason & friends
@page
@tex
{\parskip=0pt
\hfill {\it Using {\tt @value{AS}}}\par
\hfill Edited by Cygnus Support\par
}
%"boxit" macro for figures:
%Modified from Knuth's ``boxit'' macro from TeXbook (answer to exercise 21.3)
\gdef\boxit#1#2{\vbox{\hrule\hbox{\vrule\kern3pt
\vbox{\parindent=0pt\parskip=0pt\hsize=#1\kern3pt\strut\hfil
#2\hfil\strut\kern3pt}\kern3pt\vrule}\hrule}}%box with visible outline
\gdef\ibox#1#2{\hbox to #1{#2\hfil}\kern8pt}% invisible box
@end tex
@vskip 0pt plus 1filll
Copyright @copyright{} 1991-2016 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
@end titlepage
@contents
@ifnottex
@node Top
@top Using @value{AS}
This file is a user guide to the @sc{gnu} assembler @command{@value{AS}}
@ifset VERSION_PACKAGE
@value{VERSION_PACKAGE}
@end ifset
version @value{VERSION}.
@ifclear GENERIC
This version of the file describes @command{@value{AS}} configured to generate
code for @value{TARGET} architectures.
@end ifclear
This document is distributed under the terms of the GNU Free
Documentation License. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
@menu
* Overview:: Overview
* Invoking:: Command-Line Options
* Syntax:: Syntax
* Sections:: Sections and Relocation
* Symbols:: Symbols
* Expressions:: Expressions
* Pseudo Ops:: Assembler Directives
@ifset ELF
* Object Attributes:: Object Attributes
@end ifset
* Machine Dependencies:: Machine Dependent Features
* Reporting Bugs:: Reporting Bugs
* Acknowledgements:: Who Did What
* GNU Free Documentation License:: GNU Free Documentation License
* AS Index:: AS Index
@end menu
@end ifnottex
@node Overview
@chapter Overview
@iftex
This manual is a user guide to the @sc{gnu} assembler @command{@value{AS}}.
@ifclear GENERIC
This version of the manual describes @command{@value{AS}} configured to generate
code for @value{TARGET} architectures.
@end ifclear
@end iftex
@cindex invocation summary
@cindex option summary
@cindex summary of options
Here is a brief summary of how to invoke @command{@value{AS}}. For details,
see @ref{Invoking,,Command-Line Options}.
@c man title AS the portable GNU assembler.
@ignore
@c man begin SEEALSO
gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
@c man end
@end ignore
@c We don't use deffn and friends for the following because they seem
@c to be limited to one line for the header.
@smallexample
@c man begin SYNOPSIS
@value{AS} [@b{-a}[@b{cdghlns}][=@var{file}]] [@b{--alternate}] [@b{-D}]
[@b{--compress-debug-sections}] [@b{--nocompress-debug-sections}]
[@b{--debug-prefix-map} @var{old}=@var{new}]
[@b{--defsym} @var{sym}=@var{val}] [@b{-f}] [@b{-g}] [@b{--gstabs}]
[@b{--gstabs+}] [@b{--gdwarf-2}] [@b{--gdwarf-sections}]
[@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{--no-pad-sections}]
[@b{-o} @var{objfile}] [@b{-R}]
[@b{--hash-size}=@var{NUM}] [@b{--reduce-memory-overheads}]
[@b{--statistics}]
[@b{-v}] [@b{-version}] [@b{--version}]
[@b{-W}] [@b{--warn}] [@b{--fatal-warnings}] [@b{-w}] [@b{-x}]
[@b{-Z}] [@b{@@@var{FILE}}]
[@b{--sectname-subst}] [@b{--size-check=[error|warning]}]
[@b{--elf-stt-common=[no|yes]}]
[@b{--target-help}] [@var{target-options}]
[@b{--}|@var{files} @dots{}]
@c
@c man end
@c Target dependent options are listed below. Keep the list sorted.
@c Add an empty line for separation.
@c man begin TARGET
@ifset AARCH64
@emph{Target AArch64 options:}
[@b{-EB}|@b{-EL}]
[@b{-mabi}=@var{ABI}]
@end ifset
@ifset ALPHA
@emph{Target Alpha options:}
[@b{-m@var{cpu}}]
[@b{-mdebug} | @b{-no-mdebug}]
[@b{-replace} | @b{-noreplace}]
[@b{-relax}] [@b{-g}] [@b{-G@var{size}}]
[@b{-F}] [@b{-32addr}]
@end ifset
@ifset ARC
@emph{Target ARC options:}
[@b{-mcpu=@var{cpu}}]
[@b{-mA6}|@b{-mARC600}|@b{-mARC601}|@b{-mA7}|@b{-mARC700}|@b{-mEM}|@b{-mHS}]
[@b{-mcode-density}]
[@b{-mrelax}]
[@b{-EB}|@b{-EL}]
@end ifset
@ifset ARM
@emph{Target ARM options:}
@c Don't document the deprecated options
[@b{-mcpu}=@var{processor}[+@var{extension}@dots{}]]
[@b{-march}=@var{architecture}[+@var{extension}@dots{}]]
[@b{-mfpu}=@var{floating-point-format}]
[@b{-mfloat-abi}=@var{abi}]
[@b{-meabi}=@var{ver}]
[@b{-mthumb}]
[@b{-EB}|@b{-EL}]
[@b{-mapcs-32}|@b{-mapcs-26}|@b{-mapcs-float}|
@b{-mapcs-reentrant}]
[@b{-mthumb-interwork}] [@b{-k}]
@end ifset
@ifset Blackfin
@emph{Target Blackfin options:}
[@b{-mcpu}=@var{processor}[-@var{sirevision}]]
[@b{-mfdpic}]
[@b{-mno-fdpic}]
[@b{-mnopic}]
@end ifset
@ifset CRIS
@emph{Target CRIS options:}
[@b{--underscore} | @b{--no-underscore}]
[@b{--pic}] [@b{-N}]
[@b{--emulation=criself} | @b{--emulation=crisaout}]
[@b{--march=v0_v10} | @b{--march=v10} | @b{--march=v32} | @b{--march=common_v10_v32}]
@c Deprecated -- deliberately not documented.
@c [@b{-h}] [@b{-H}]
@end ifset
@ifset D10V
@emph{Target D10V options:}
[@b{-O}]
@end ifset
@ifset D30V
@emph{Target D30V options:}
[@b{-O}|@b{-n}|@b{-N}]
@end ifset
@ifset EPIPHANY
@emph{Target EPIPHANY options:}
[@b{-mepiphany}|@b{-mepiphany16}]
@end ifset
@ifset H8
@emph{Target H8/300 options:}
[-h-tick-hex]
@end ifset
@ifset HPPA
@c HPPA has no machine-dependent assembler options (yet).
@end ifset
@ifset I80386
@emph{Target i386 options:}
[@b{--32}|@b{--x32}|@b{--64}] [@b{-n}]
[@b{-march}=@var{CPU}[+@var{EXTENSION}@dots{}]] [@b{-mtune}=@var{CPU}]
@end ifset
@ifset I960
@emph{Target i960 options:}
@c see md_parse_option in tc-i960.c
[@b{-ACA}|@b{-ACA_A}|@b{-ACB}|@b{-ACC}|@b{-AKA}|@b{-AKB}|
@b{-AKC}|@b{-AMC}]
[@b{-b}] [@b{-no-relax}]
@end ifset
@ifset IA64
@emph{Target IA-64 options:}
[@b{-mconstant-gp}|@b{-mauto-pic}]
[@b{-milp32}|@b{-milp64}|@b{-mlp64}|@b{-mp64}]
[@b{-mle}|@b{mbe}]
[@b{-mtune=itanium1}|@b{-mtune=itanium2}]
[@b{-munwind-check=warning}|@b{-munwind-check=error}]
[@b{-mhint.b=ok}|@b{-mhint.b=warning}|@b{-mhint.b=error}]
[@b{-x}|@b{-xexplicit}] [@b{-xauto}] [@b{-xdebug}]
@end ifset
@ifset IP2K
@emph{Target IP2K options:}
[@b{-mip2022}|@b{-mip2022ext}]
@end ifset
@ifset M32C
@emph{Target M32C options:}
[@b{-m32c}|@b{-m16c}] [-relax] [-h-tick-hex]
@end ifset
@ifset M32R
@emph{Target M32R options:}
[@b{--m32rx}|@b{--[no-]warn-explicit-parallel-conflicts}|
@b{--W[n]p}]
@end ifset
@ifset M680X0
@emph{Target M680X0 options:}
[@b{-l}] [@b{-m68000}|@b{-m68010}|@b{-m68020}|@dots{}]
@end ifset
@ifset M68HC11
@emph{Target M68HC11 options:}
[@b{-m68hc11}|@b{-m68hc12}|@b{-m68hcs12}|@b{-mm9s12x}|@b{-mm9s12xg}]
[@b{-mshort}|@b{-mlong}]
[@b{-mshort-double}|@b{-mlong-double}]
[@b{--force-long-branches}] [@b{--short-branches}]
[@b{--strict-direct-mode}] [@b{--print-insn-syntax}]
[@b{--print-opcodes}] [@b{--generate-example}]
@end ifset
@ifset MCORE
@emph{Target MCORE options:}
[@b{-jsri2bsr}] [@b{-sifilter}] [@b{-relax}]
[@b{-mcpu=[210|340]}]
@end ifset
@ifset METAG
@emph{Target Meta options:}
[@b{-mcpu=@var{cpu}}] [@b{-mfpu=@var{cpu}}] [@b{-mdsp=@var{cpu}}]
@end ifset
@ifset MICROBLAZE
@emph{Target MICROBLAZE options:}
@c MicroBlaze has no machine-dependent assembler options.
@end ifset
@ifset MIPS
@emph{Target MIPS options:}
[@b{-nocpp}] [@b{-EL}] [@b{-EB}] [@b{-O}[@var{optimization level}]]
[@b{-g}[@var{debug level}]] [@b{-G} @var{num}] [@b{-KPIC}] [@b{-call_shared}]
[@b{-non_shared}] [@b{-xgot} [@b{-mvxworks-pic}]
[@b{-mabi}=@var{ABI}] [@b{-32}] [@b{-n32}] [@b{-64}] [@b{-mfp32}] [@b{-mgp32}]
[@b{-mfp64}] [@b{-mgp64}] [@b{-mfpxx}]
[@b{-modd-spreg}] [@b{-mno-odd-spreg}]
[@b{-march}=@var{CPU}] [@b{-mtune}=@var{CPU}] [@b{-mips1}] [@b{-mips2}]
[@b{-mips3}] [@b{-mips4}] [@b{-mips5}] [@b{-mips32}] [@b{-mips32r2}]
[@b{-mips32r3}] [@b{-mips32r5}] [@b{-mips32r6}] [@b{-mips64}] [@b{-mips64r2}]
[@b{-mips64r3}] [@b{-mips64r5}] [@b{-mips64r6}]
[@b{-construct-floats}] [@b{-no-construct-floats}]
[@b{-mnan=@var{encoding}}]
[@b{-trap}] [@b{-no-break}] [@b{-break}] [@b{-no-trap}]
[@b{-mips16}] [@b{-no-mips16}]
[@b{-mmicromips}] [@b{-mno-micromips}]
[@b{-msmartmips}] [@b{-mno-smartmips}]
[@b{-mips3d}] [@b{-no-mips3d}]
[@b{-mdmx}] [@b{-no-mdmx}]
[@b{-mdsp}] [@b{-mno-dsp}]
[@b{-mdspr2}] [@b{-mno-dspr2}]
[@b{-mdspr3}] [@b{-mno-dspr3}]
[@b{-mmsa}] [@b{-mno-msa}]
[@b{-mxpa}] [@b{-mno-xpa}]
[@b{-mmt}] [@b{-mno-mt}]
[@b{-mmcu}] [@b{-mno-mcu}]
[@b{-minsn32}] [@b{-mno-insn32}]
[@b{-mfix7000}] [@b{-mno-fix7000}]
[@b{-mfix-rm7000}] [@b{-mno-fix-rm7000}]
[@b{-mfix-vr4120}] [@b{-mno-fix-vr4120}]
[@b{-mfix-vr4130}] [@b{-mno-fix-vr4130}]
[@b{-mdebug}] [@b{-no-mdebug}]
[@b{-mpdr}] [@b{-mno-pdr}]
@end ifset
@ifset MMIX
@emph{Target MMIX options:}
[@b{--fixed-special-register-names}] [@b{--globalize-symbols}]
[@b{--gnu-syntax}] [@b{--relax}] [@b{--no-predefined-symbols}]
[@b{--no-expand}] [@b{--no-merge-gregs}] [@b{-x}]
[@b{--linker-allocated-gregs}]
@end ifset
@ifset NIOSII
@emph{Target Nios II options:}
[@b{-relax-all}] [@b{-relax-section}] [@b{-no-relax}]
[@b{-EB}] [@b{-EL}]
@end ifset
@ifset NDS32
@emph{Target NDS32 options:}
[@b{-EL}] [@b{-EB}] [@b{-O}] [@b{-Os}] [@b{-mcpu=@var{cpu}}]
[@b{-misa=@var{isa}}] [@b{-mabi=@var{abi}}] [@b{-mall-ext}]
[@b{-m[no-]16-bit}] [@b{-m[no-]perf-ext}] [@b{-m[no-]perf2-ext}]
[@b{-m[no-]string-ext}] [@b{-m[no-]dsp-ext}] [@b{-m[no-]mac}] [@b{-m[no-]div}]
[@b{-m[no-]audio-isa-ext}] [@b{-m[no-]fpu-sp-ext}] [@b{-m[no-]fpu-dp-ext}]
[@b{-m[no-]fpu-fma}] [@b{-mfpu-freg=@var{FREG}}] [@b{-mreduced-regs}]
[@b{-mfull-regs}] [@b{-m[no-]dx-regs}] [@b{-mpic}] [@b{-mno-relax}]
[@b{-mb2bb}]
@end ifset
@ifset PDP11
@emph{Target PDP11 options:}
[@b{-mpic}|@b{-mno-pic}] [@b{-mall}] [@b{-mno-extensions}]
[@b{-m}@var{extension}|@b{-mno-}@var{extension}]
[@b{-m}@var{cpu}] [@b{-m}@var{machine}]
@end ifset
@ifset PJ
@emph{Target picoJava options:}
[@b{-mb}|@b{-me}]
@end ifset
@ifset PPC
@emph{Target PowerPC options:}
[@b{-a32}|@b{-a64}]
[@b{-mpwrx}|@b{-mpwr2}|@b{-mpwr}|@b{-m601}|@b{-mppc}|@b{-mppc32}|@b{-m603}|@b{-m604}|@b{-m403}|@b{-m405}|
@b{-m440}|@b{-m464}|@b{-m476}|@b{-m7400}|@b{-m7410}|@b{-m7450}|@b{-m7455}|@b{-m750cl}|@b{-mppc64}|
@b{-m620}|@b{-me500}|@b{-e500x2}|@b{-me500mc}|@b{-me500mc64}|@b{-me5500}|@b{-me6500}|@b{-mppc64bridge}|
@b{-mbooke}|@b{-mpower4}|@b{-mpwr4}|@b{-mpower5}|@b{-mpwr5}|@b{-mpwr5x}|@b{-mpower6}|@b{-mpwr6}|
@b{-mpower7}|@b{-mpwr7}|@b{-mpower8}|@b{-mpwr8}|@b{-mpower9}|@b{-mpwr9}@b{-ma2}|
@b{-mcell}|@b{-mspe}|@b{-mtitan}|@b{-me300}|@b{-mcom}]
[@b{-many}] [@b{-maltivec}|@b{-mvsx}|@b{-mhtm}|@b{-mvle}]
[@b{-mregnames}|@b{-mno-regnames}]
[@b{-mrelocatable}|@b{-mrelocatable-lib}|@b{-K PIC}] [@b{-memb}]
[@b{-mlittle}|@b{-mlittle-endian}|@b{-le}|@b{-mbig}|@b{-mbig-endian}|@b{-be}]
[@b{-msolaris}|@b{-mno-solaris}]
[@b{-nops=@var{count}}]
@end ifset
@ifset RL78
@emph{Target RL78 options:}
[@b{-mg10}]
[@b{-m32bit-doubles}|@b{-m64bit-doubles}]
@end ifset
@ifset RX
@emph{Target RX options:}
[@b{-mlittle-endian}|@b{-mbig-endian}]
[@b{-m32bit-doubles}|@b{-m64bit-doubles}]
[@b{-muse-conventional-section-names}]
[@b{-msmall-data-limit}]
[@b{-mpid}]
[@b{-mrelax}]
[@b{-mint-register=@var{number}}]
[@b{-mgcc-abi}|@b{-mrx-abi}]
@end ifset
@ifset S390
@emph{Target s390 options:}
[@b{-m31}|@b{-m64}] [@b{-mesa}|@b{-mzarch}] [@b{-march}=@var{CPU}]
[@b{-mregnames}|@b{-mno-regnames}]
[@b{-mwarn-areg-zero}]
@end ifset
@ifset SCORE
@emph{Target SCORE options:}
[@b{-EB}][@b{-EL}][@b{-FIXDD}][@b{-NWARN}]
[@b{-SCORE5}][@b{-SCORE5U}][@b{-SCORE7}][@b{-SCORE3}]
[@b{-march=score7}][@b{-march=score3}]
[@b{-USE_R1}][@b{-KPIC}][@b{-O0}][@b{-G} @var{num}][@b{-V}]
@end ifset
@ifset SPARC
@emph{Target SPARC options:}
@c The order here is important. See c-sparc.texi.
[@b{-Av6}|@b{-Av7}|@b{-Av8}|@b{-Asparclet}|@b{-Asparclite}
@b{-Av8plus}|@b{-Av8plusa}|@b{-Av9}|@b{-Av9a}]
[@b{-xarch=v8plus}|@b{-xarch=v8plusa}] [@b{-bump}]
[@b{-32}|@b{-64}]
@end ifset
@ifset TIC54X
@emph{Target TIC54X options:}
[@b{-mcpu=54[123589]}|@b{-mcpu=54[56]lp}] [@b{-mfar-mode}|@b{-mf}]
[@b{-merrors-to-file} @var{<filename>}|@b{-me} @var{<filename>}]
@end ifset
@ifset TIC6X
@emph{Target TIC6X options:}
[@b{-march=@var{arch}}] [@b{-mbig-endian}|@b{-mlittle-endian}]
[@b{-mdsbt}|@b{-mno-dsbt}] [@b{-mpid=no}|@b{-mpid=near}|@b{-mpid=far}]
[@b{-mpic}|@b{-mno-pic}]
@end ifset
@ifset TILEGX
@emph{Target TILE-Gx options:}
[@b{-m32}|@b{-m64}][@b{-EB}][@b{-EL}]
@end ifset
@ifset TILEPRO
@c TILEPro has no machine-dependent assembler options
@end ifset
@ifset VISIUM
@emph{Target Visium options:}
[@b{-mtune=@var{arch}}]
@end ifset
@ifset XTENSA
@emph{Target Xtensa options:}
[@b{--[no-]text-section-literals}] [@b{--[no-]auto-litpools}]
[@b{--[no-]absolute-literals}]
[@b{--[no-]target-align}] [@b{--[no-]longcalls}]
[@b{--[no-]transform}]
[@b{--rename-section} @var{oldname}=@var{newname}]
[@b{--[no-]trampolines}]
@end ifset
@ifset Z80
@emph{Target Z80 options:}
[@b{-z80}] [@b{-r800}]
[@b{ -ignore-undocumented-instructions}] [@b{-Wnud}]
[@b{ -ignore-unportable-instructions}] [@b{-Wnup}]
[@b{ -warn-undocumented-instructions}] [@b{-Wud}]
[@b{ -warn-unportable-instructions}] [@b{-Wup}]
[@b{ -forbid-undocumented-instructions}] [@b{-Fud}]
[@b{ -forbid-unportable-instructions}] [@b{-Fup}]
@end ifset
@ifset Z8000
@c Z8000 has no machine-dependent assembler options
@end ifset
@c man end
@end smallexample
@c man begin OPTIONS
@table @gcctabopt
@include at-file.texi
@item -a[cdghlmns]
Turn on listings, in any of a variety of ways:
@table @gcctabopt
@item -ac
omit false conditionals
@item -ad
omit debugging directives
@item -ag
include general information, like @value{AS} version and options passed
@item -ah
include high-level source
@item -al
include assembly
@item -am
include macro expansions
@item -an
omit forms processing
@item -as
include symbols
@item =file
set the name of the listing file
@end table
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.
@ifclear man
@xref{Altmacro,,@code{.altmacro}}.
@end ifclear
@item --compress-debug-sections
Compress DWARF debug sections using zlib with SHF_COMPRESSED from the
ELF ABI. The resulting object file may not be compatible with older
linkers and object file utilities. Note if compression would make a
given section @emph{larger} then it is not compressed.
@ifset ELF
@cindex @samp{--compress-debug-sections=} option
@item --compress-debug-sections=none
@itemx --compress-debug-sections=zlib
@itemx --compress-debug-sections=zlib-gnu
@itemx --compress-debug-sections=zlib-gabi
These options control how DWARF debug sections are compressed.
@option{--compress-debug-sections=none} is equivalent to
@option{--nocompress-debug-sections}.
@option{--compress-debug-sections=zlib} and
@option{--compress-debug-sections=zlib-gabi} are equivalent to
@option{--compress-debug-sections}.
@option{--compress-debug-sections=zlib-gnu} compresses DWARF debug
sections using zlib. The debug sections are renamed to begin with
@samp{.zdebug}. Note if compression would make a given section
@emph{larger} then it is not compressed nor renamed.
@end ifset
@item --nocompress-debug-sections
Do not compress DWARF debug sections. This is usually the default for all
targets except the x86/x86_64, but a configure time option can be used to
override this.
@item -D
Ignored. This option is accepted for script compatibility with calls to
other assemblers.
@item --debug-prefix-map @var{old}=@var{new}
When assembling files in directory @file{@var{old}}, record debugging
information describing them as in @file{@var{new}} instead.
@item --defsym @var{sym}=@var{value}
Define the symbol @var{sym} to be @var{value} before assembling the input file.
@var{value} must be an integer constant. As in C, a leading @samp{0x}
indicates a hexadecimal value, and a leading @samp{0} indicates an octal
value. The value of the symbol can be overridden inside a source file via the
use of a @code{.set} pseudo-op.
@item -f
``fast''---skip whitespace and comment preprocessing (assume source is
compiler output).
@item -g
@itemx --gen-debug
Generate debugging information for each assembler source line using whichever
debug format is preferred by the target. This currently means either STABS,
ECOFF or DWARF2.
@item --gstabs
Generate stabs debugging information for each assembler line. This
may help debugging assembler code, if the debugger can handle it.
@item --gstabs+
Generate stabs debugging information for each assembler line, with GNU
extensions that probably only gdb can handle, and that could make other
debuggers crash or refuse to read your program. This
may help debugging assembler code. Currently the only GNU extension is
the location of the current working directory at assembling time.
@item --gdwarf-2
Generate DWARF2 debugging information for each assembler line. This
may help debugging assembler code, if the debugger can handle it. Note---this
option is only supported by some targets, not all of them.
@item --gdwarf-sections
Instead of creating a .debug_line section, create a series of
.debug_line.@var{foo} sections where @var{foo} is the name of the
corresponding code section. For example a code section called @var{.text.func}
will have its dwarf line number information placed into a section called
@var{.debug_line.text.func}. If the code section is just called @var{.text}
then debug line section will still be called just @var{.debug_line} without any
suffix.
@ifset ELF
@item --size-check=error
@itemx --size-check=warning
Issue an error or warning for invalid ELF .size directive.
@item --elf-stt-common=no
@itemx --elf-stt-common=yes
These options control whether the ELF assembler should generate common
symbols with the @code{STT_COMMON} type. The default can be controlled
by a configure option @option{--enable-elf-stt-common}.
@end ifset
@item --help
Print a summary of the command line options and exit.
@item --target-help
Print a summary of all target specific options and exit.
@item -I @var{dir}
Add directory @var{dir} to the search list for @code{.include} directives.
@item -J
Don't warn about signed overflow.
@item -K
@ifclear DIFF-TBL-KLUGE
This option is accepted but has no effect on the @value{TARGET} family.
@end ifclear
@ifset DIFF-TBL-KLUGE
Issue warnings when difference tables altered for long displacements.
@end ifset
@item -L
@itemx --keep-locals
Keep (in the symbol table) local symbols. These symbols start with
system-specific local label prefixes, typically @samp{.L} for ELF systems
or @samp{L} for traditional a.out systems.
@ifclear man
@xref{Symbol Names}.
@end ifclear
@item --listing-lhs-width=@var{number}
Set the maximum width, in words, of the output data column for an assembler
listing to @var{number}.
@item --listing-lhs-width2=@var{number}
Set the maximum width, in words, of the output data column for continuation
lines in an assembler listing to @var{number}.
@item --listing-rhs-width=@var{number}
Set the maximum width of an input source line, as displayed in a listing, to
@var{number} bytes.
@item --listing-cont-lines=@var{number}
Set the maximum number of lines printed in a listing for a single line of input
to @var{number} + 1.
@item --no-pad-sections
Stop the assembler for padding the ends of output sections to the alignment
of that section. The default is to pad the sections, but this can waste space
which might be needed on targets which have tight memory constraints.
@item -o @var{objfile}
Name the object-file output from @command{@value{AS}} @var{objfile}.
@item -R
Fold the data section into the text section.
@item --hash-size=@var{number}
Set the default size of GAS's hash tables to a prime number close to
@var{number}. Increasing this value can reduce the length of time it takes the
assembler to perform its tasks, at the expense of increasing the assembler's
memory requirements. Similarly reducing this value can reduce the memory
requirements at the expense of speed.
@item --reduce-memory-overheads
This option reduces GAS's memory requirements, at the expense of making the
assembly processes slower. Currently this switch is a synonym for
@samp{--hash-size=4051}, but in the future it may have other effects as well.
@ifset ELF
@item --sectname-subst
Honor substitution sequences in section names.
@ifclear man
@xref{Section Name Substitutions,,@code{.section @var{name}}}.
@end ifclear
@end ifset
@item --statistics
Print the maximum space (in bytes) and total time (in seconds) used by
assembly.
@item --strip-local-absolute
Remove local absolute symbols from the outgoing symbol table.
@item -v
@itemx -version
Print the @command{as} version.
@item --version
Print the @command{as} version and exit.
@item -W
@itemx --no-warn
Suppress warning messages.
@item --fatal-warnings
Treat warnings as errors.
@item --warn
Don't suppress warning messages or treat them as errors.
@item -w
Ignored.
@item -x
Ignored.
@item -Z
Generate an object file even after errors.
@item -- | @var{files} @dots{}
Standard input, or source files to assemble.
@end table
@c man end
@ifset AARCH64
@ifclear man
@xref{AArch64 Options}, for the options available when @value{AS} is configured
for the 64-bit mode of the ARM Architecture (AArch64).
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for the
64-bit mode of the ARM Architecture (AArch64).
@c man end
@c man begin INCLUDE
@include c-aarch64.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset ALPHA
@ifclear man
@xref{Alpha Options}, for the options available when @value{AS} is configured
for an Alpha processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for an Alpha
processor.
@c man end
@c man begin INCLUDE
@include c-alpha.texi
@c ended inside the included file
@end ifset
@end ifset
@c man begin OPTIONS
@ifset ARC
The following options are available when @value{AS} is configured for an ARC
processor.
@table @gcctabopt
@item -mcpu=@var{cpu}
This option selects the core processor variant.
@item -EB | -EL
Select either big-endian (-EB) or little-endian (-EL) output.
@item -mcode-density
Enable Code Density extenssion instructions.
@end table
@end ifset
@ifset ARM
The following options are available when @value{AS} is configured for the ARM
processor family.
@table @gcctabopt
@item -mcpu=@var{processor}[+@var{extension}@dots{}]
Specify which ARM processor variant is the target.
@item -march=@var{architecture}[+@var{extension}@dots{}]
Specify which ARM architecture variant is used by the target.
@item -mfpu=@var{floating-point-format}
Select which Floating Point architecture is the target.
@item -mfloat-abi=@var{abi}
Select which floating point ABI is in use.
@item -mthumb
Enable Thumb only instruction decoding.
@item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant
Select which procedure calling convention is in use.
@item -EB | -EL
Select either big-endian (-EB) or little-endian (-EL) output.
@item -mthumb-interwork
Specify that the code has been generated with interworking between Thumb and
ARM code in mind.
@item -mccs
Turns on CodeComposer Studio assembly syntax compatibility mode.
@item -k
Specify that PIC code has been generated.
@end table
@end ifset
@c man end
@ifset Blackfin
@ifclear man
@xref{Blackfin Options}, for the options available when @value{AS} is
configured for the Blackfin processor family.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for
the Blackfin processor family.
@c man end
@c man begin INCLUDE
@include c-bfin.texi
@c ended inside the included file
@end ifset
@end ifset
@c man begin OPTIONS
@ifset CRIS
See the info pages for documentation of the CRIS-specific options.
@end ifset
@ifset D10V
The following options are available when @value{AS} is configured for
a D10V processor.
@table @gcctabopt
@cindex D10V optimization
@cindex optimization, D10V
@item -O
Optimize output by parallelizing instructions.
@end table
@end ifset
@ifset D30V
The following options are available when @value{AS} is configured for a D30V
processor.
@table @gcctabopt
@cindex D30V optimization
@cindex optimization, D30V
@item -O
Optimize output by parallelizing instructions.
@cindex D30V nops
@item -n
Warn when nops are generated.
@cindex D30V nops after 32-bit multiply
@item -N
Warn when a nop after a 32-bit multiply instruction is generated.
@end table
@end ifset
@c man end
@ifset EPIPHANY
The following options are available when @value{AS} is configured for the
Adapteva EPIPHANY series.
@ifclear man
@xref{Epiphany Options}, for the options available when @value{AS} is
configured for an Epiphany processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for
an Epiphany processor.
@c man end
@c man begin INCLUDE
@include c-epiphany.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset H8300
@ifclear man
@xref{H8/300 Options}, for the options available when @value{AS} is configured
for an H8/300 processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for an H8/300
processor.
@c man end
@c man begin INCLUDE
@include c-h8300.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset I80386
@ifclear man
@xref{i386-Options}, for the options available when @value{AS} is
configured for an i386 processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for
an i386 processor.
@c man end
@c man begin INCLUDE
@include c-i386.texi
@c ended inside the included file
@end ifset
@end ifset
@c man begin OPTIONS
@ifset I960
The following options are available when @value{AS} is configured for the
Intel 80960 processor.
@table @gcctabopt
@item -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
Specify which variant of the 960 architecture is the target.
@item -b
Add code to collect statistics about branches taken.
@item -no-relax
Do not alter compare-and-branch instructions for long displacements;
error if necessary.
@end table
@end ifset
@ifset IP2K
The following options are available when @value{AS} is configured for the
Ubicom IP2K series.
@table @gcctabopt
@item -mip2022ext
Specifies that the extended IP2022 instructions are allowed.
@item -mip2022
Restores the default behaviour, which restricts the permitted instructions to
just the basic IP2022 ones.
@end table
@end ifset
@ifset M32C
The following options are available when @value{AS} is configured for the
Renesas M32C and M16C processors.
@table @gcctabopt
@item -m32c
Assemble M32C instructions.
@item -m16c
Assemble M16C instructions (the default).
@item -relax
Enable support for link-time relaxations.
@item -h-tick-hex
Support H'00 style hex constants in addition to 0x00 style.
@end table
@end ifset
@ifset M32R
The following options are available when @value{AS} is configured for the
Renesas M32R (formerly Mitsubishi M32R) series.
@table @gcctabopt
@item --m32rx
Specify which processor in the M32R family is the target. The default
is normally the M32R, but this option changes it to the M32RX.
@item --warn-explicit-parallel-conflicts or --Wp
Produce warning messages when questionable parallel constructs are
encountered.
@item --no-warn-explicit-parallel-conflicts or --Wnp
Do not produce warning messages when questionable parallel constructs are
encountered.
@end table
@end ifset
@ifset M680X0
The following options are available when @value{AS} is configured for the
Motorola 68000 series.
@table @gcctabopt
@item -l
Shorten references to undefined symbols, to one word instead of two.
@item -m68000 | -m68008 | -m68010 | -m68020 | -m68030
@itemx | -m68040 | -m68060 | -m68302 | -m68331 | -m68332
@itemx | -m68333 | -m68340 | -mcpu32 | -m5200
Specify what processor in the 68000 family is the target. The default
is normally the 68020, but this can be changed at configuration time.
@item -m68881 | -m68882 | -mno-68881 | -mno-68882
The target machine does (or does not) have a floating-point coprocessor.
The default is to assume a coprocessor for 68020, 68030, and cpu32. Although
the basic 68000 is not compatible with the 68881, a combination of the
two can be specified, since it's possible to do emulation of the
coprocessor instructions with the main processor.
@item -m68851 | -mno-68851
The target machine does (or does not) have a memory-management
unit coprocessor. The default is to assume an MMU for 68020 and up.
@end table
@end ifset
@ifset NIOSII
@ifclear man
@xref{Nios II Options}, for the options available when @value{AS} is configured
for an Altera Nios II processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for an
Altera Nios II processor.
@c man end
@c man begin INCLUDE
@include c-nios2.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset PDP11
For details about the PDP-11 machine dependent features options,
see @ref{PDP-11-Options}.
@table @gcctabopt
@item -mpic | -mno-pic
Generate position-independent (or position-dependent) code. The
default is @option{-mpic}.
@item -mall
@itemx -mall-extensions
Enable all instruction set extensions. This is the default.
@item -mno-extensions
Disable all instruction set extensions.
@item -m@var{extension} | -mno-@var{extension}
Enable (or disable) a particular instruction set extension.
@item -m@var{cpu}
Enable the instruction set extensions supported by a particular CPU, and
disable all other extensions.
@item -m@var{machine}
Enable the instruction set extensions supported by a particular machine
model, and disable all other extensions.
@end table
@end ifset
@ifset PJ
The following options are available when @value{AS} is configured for
a picoJava processor.
@table @gcctabopt
@cindex PJ endianness
@cindex endianness, PJ
@cindex big endian output, PJ
@item -mb
Generate ``big endian'' format output.
@cindex little endian output, PJ
@item -ml
Generate ``little endian'' format output.
@end table
@end ifset
@ifset M68HC11
The following options are available when @value{AS} is configured for the
Motorola 68HC11 or 68HC12 series.
@table @gcctabopt
@item -m68hc11 | -m68hc12 | -m68hcs12 | -mm9s12x | -mm9s12xg
Specify what processor is the target. The default is
defined by the configuration option when building the assembler.
@item --xgate-ramoffset
Instruct the linker to offset RAM addresses from S12X address space into
XGATE address space.
@item -mshort
Specify to use the 16-bit integer ABI.
@item -mlong
Specify to use the 32-bit integer ABI.
@item -mshort-double
Specify to use the 32-bit double ABI.
@item -mlong-double
Specify to use the 64-bit double ABI.
@item --force-long-branches
Relative branches are turned into absolute ones. This concerns
conditional branches, unconditional branches and branches to a
sub routine.
@item -S | --short-branches
Do not turn relative branches into absolute ones
when the offset is out of range.
@item --strict-direct-mode
Do not turn the direct addressing mode into extended addressing mode
when the instruction does not support direct addressing mode.
@item --print-insn-syntax
Print the syntax of instruction in case of error.
@item --print-opcodes
Print the list of instructions with syntax and then exit.
@item --generate-example
Print an example of instruction for each possible instruction and then exit.
This option is only useful for testing @command{@value{AS}}.
@end table
@end ifset
@ifset SPARC
The following options are available when @command{@value{AS}} is configured
for the SPARC architecture:
@table @gcctabopt
@item -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
@itemx -Av8plus | -Av8plusa | -Av9 | -Av9a
Explicitly select a variant of the SPARC architecture.
@samp{-Av8plus} and @samp{-Av8plusa} select a 32 bit environment.
@samp{-Av9} and @samp{-Av9a} select a 64 bit environment.
@samp{-Av8plusa} and @samp{-Av9a} enable the SPARC V9 instruction set with
UltraSPARC extensions.
@item -xarch=v8plus | -xarch=v8plusa
For compatibility with the Solaris v9 assembler. These options are
equivalent to -Av8plus and -Av8plusa, respectively.
@item -bump
Warn when the assembler switches to another architecture.
@end table
@end ifset
@ifset TIC54X
The following options are available when @value{AS} is configured for the 'c54x
architecture.
@table @gcctabopt
@item -mfar-mode
Enable extended addressing mode. All addresses and relocations will assume
extended addressing (usually 23 bits).
@item -mcpu=@var{CPU_VERSION}
Sets the CPU version being compiled for.
@item -merrors-to-file @var{FILENAME}
Redirect error output to a file, for broken systems which don't support such
behaviour in the shell.
@end table
@end ifset
@ifset MIPS
The following options are available when @value{AS} is configured for
a MIPS processor.
@table @gcctabopt
@item -G @var{num}
This option sets the largest size of an object that can be referenced
implicitly with the @code{gp} register. It is only accepted for targets that
use ECOFF format, such as a DECstation running Ultrix. The default value is 8.
@cindex MIPS endianness
@cindex endianness, MIPS
@cindex big endian output, MIPS
@item -EB
Generate ``big endian'' format output.
@cindex little endian output, MIPS
@item -EL
Generate ``little endian'' format output.
@cindex MIPS ISA
@item -mips1
@itemx -mips2
@itemx -mips3
@itemx -mips4
@itemx -mips5
@itemx -mips32
@itemx -mips32r2
@itemx -mips32r3
@itemx -mips32r5
@itemx -mips32r6
@itemx -mips64
@itemx -mips64r2
@itemx -mips64r3
@itemx -mips64r5
@itemx -mips64r6
Generate code for a particular MIPS Instruction Set Architecture level.
@samp{-mips1} is an alias for @samp{-march=r3000}, @samp{-mips2} is an
alias for @samp{-march=r6000}, @samp{-mips3} is an alias for
@samp{-march=r4000} and @samp{-mips4} is an alias for @samp{-march=r8000}.
@samp{-mips5}, @samp{-mips32}, @samp{-mips32r2}, @samp{-mips32r3},
@samp{-mips32r5}, @samp{-mips32r6}, @samp{-mips64}, @samp{-mips64r2},
@samp{-mips64r3}, @samp{-mips64r5}, and @samp{-mips64r6} correspond to generic
MIPS V, MIPS32, MIPS32 Release 2, MIPS32 Release 3, MIPS32 Release 5, MIPS32
Release 6, MIPS64, MIPS64 Release 2, MIPS64 Release 3, MIPS64 Release 5, and
MIPS64 Release 6 ISA processors, respectively.
@item -march=@var{cpu}
Generate code for a particular MIPS CPU.
@item -mtune=@var{cpu}
Schedule and tune for a particular MIPS CPU.
@item -mfix7000
@itemx -mno-fix7000
Cause nops to be inserted if the read of the destination register
of an mfhi or mflo instruction occurs in the following two instructions.
@item -mfix-rm7000
@itemx -mno-fix-rm7000
Cause nops to be inserted if a dmult or dmultu instruction is
followed by a load instruction.
@item -mdebug
@itemx -no-mdebug
Cause stabs-style debugging output to go into an ECOFF-style .mdebug
section instead of the standard ELF .stabs sections.
@item -mpdr
@itemx -mno-pdr
Control generation of @code{.pdr} sections.
@item -mgp32
@itemx -mfp32
The register sizes are normally inferred from the ISA and ABI, but these
flags force a certain group of registers to be treated as 32 bits wide at
all times. @samp{-mgp32} controls the size of general-purpose registers
and @samp{-mfp32} controls the size of floating-point registers.
@item -mgp64
@itemx -mfp64
The register sizes are normally inferred from the ISA and ABI, but these
flags force a certain group of registers to be treated as 64 bits wide at
all times. @samp{-mgp64} controls the size of general-purpose registers
and @samp{-mfp64} controls the size of floating-point registers.
@item -mfpxx
The register sizes are normally inferred from the ISA and ABI, but using
this flag in combination with @samp{-mabi=32} enables an ABI variant
which will operate correctly with floating-point registers which are
32 or 64 bits wide.
@item -modd-spreg
@itemx -mno-odd-spreg
Enable use of floating-point operations on odd-numbered single-precision
registers when supported by the ISA. @samp{-mfpxx} implies
@samp{-mno-odd-spreg}, otherwise the default is @samp{-modd-spreg}.
@item -mips16
@itemx -no-mips16
Generate code for the MIPS 16 processor. This is equivalent to putting
@code{.set mips16} at the start of the assembly file. @samp{-no-mips16}
turns off this option.
@item -mmicromips
@itemx -mno-micromips
Generate code for the microMIPS processor. This is equivalent to putting
@code{.set micromips} at the start of the assembly file. @samp{-mno-micromips}
turns off this option. This is equivalent to putting @code{.set nomicromips}
at the start of the assembly file.
@item -msmartmips
@itemx -mno-smartmips
Enables the SmartMIPS extension to the MIPS32 instruction set. This is
equivalent to putting @code{.set smartmips} at the start of the assembly file.
@samp{-mno-smartmips} turns off this option.
@item -mips3d
@itemx -no-mips3d
Generate code for the MIPS-3D Application Specific Extension.
This tells the assembler to accept MIPS-3D instructions.
@samp{-no-mips3d} turns off this option.
@item -mdmx
@itemx -no-mdmx
Generate code for the MDMX Application Specific Extension.
This tells the assembler to accept MDMX instructions.
@samp{-no-mdmx} turns off this option.
@item -mdsp
@itemx -mno-dsp
Generate code for the DSP Release 1 Application Specific Extension.
This tells the assembler to accept DSP Release 1 instructions.
@samp{-mno-dsp} turns off this option.
@item -mdspr2
@itemx -mno-dspr2
Generate code for the DSP Release 2 Application Specific Extension.
This option implies @samp{-mdsp}.
This tells the assembler to accept DSP Release 2 instructions.
@samp{-mno-dspr2} turns off this option.
@item -mdspr3
@itemx -mno-dspr3
Generate code for the DSP Release 3 Application Specific Extension.
This option implies @samp{-mdsp} and @samp{-mdspr2}.
This tells the assembler to accept DSP Release 3 instructions.
@samp{-mno-dspr3} turns off this option.
@item -mmsa
@itemx -mno-msa
Generate code for the MIPS SIMD Architecture Extension.
This tells the assembler to accept MSA instructions.
@samp{-mno-msa} turns off this option.
@item -mxpa
@itemx -mno-xpa
Generate code for the MIPS eXtended Physical Address (XPA) Extension.
This tells the assembler to accept XPA instructions.
@samp{-mno-xpa} turns off this option.
@item -mmt
@itemx -mno-mt
Generate code for the MT Application Specific Extension.
This tells the assembler to accept MT instructions.
@samp{-mno-mt} turns off this option.
@item -mmcu
@itemx -mno-mcu
Generate code for the MCU Application Specific Extension.
This tells the assembler to accept MCU instructions.
@samp{-mno-mcu} turns off this option.
@item -minsn32
@itemx -mno-insn32
Only use 32-bit instruction encodings when generating code for the
microMIPS processor. This option inhibits the use of any 16-bit
instructions. This is equivalent to putting @code{.set insn32} at
the start of the assembly file. @samp{-mno-insn32} turns off this
option. This is equivalent to putting @code{.set noinsn32} at the
start of the assembly file. By default @samp{-mno-insn32} is
selected, allowing all instructions to be used.
@item --construct-floats
@itemx --no-construct-floats
The @samp{--no-construct-floats} option disables the construction of
double width floating point constants by loading the two halves of the
value into the two single width floating point registers that make up
the double width register. By default @samp{--construct-floats} is
selected, allowing construction of these floating point constants.
@item --relax-branch
@itemx --no-relax-branch
The @samp{--relax-branch} option enables the relaxation of out-of-range
branches. By default @samp{--no-relax-branch} is selected, causing any
out-of-range branches to produce an error.
@item -mnan=@var{encoding}
Select between the IEEE 754-2008 (@option{-mnan=2008}) or the legacy
(@option{-mnan=legacy}) NaN encoding format. The latter is the default.
@cindex emulation
@item --emulation=@var{name}
This option was formerly used to switch between ELF and ECOFF output
on targets like IRIX 5 that supported both. MIPS ECOFF support was
removed in GAS 2.24, so the option now serves little purpose.
It is retained for backwards compatibility.
The available configuration names are: @samp{mipself}, @samp{mipslelf} and
@samp{mipsbelf}. Choosing @samp{mipself} now has no effect, since the output
is always ELF. @samp{mipslelf} and @samp{mipsbelf} select little- and
big-endian output respectively, but @samp{-EL} and @samp{-EB} are now the
preferred options instead.
@item -nocpp
@command{@value{AS}} ignores this option. It is accepted for compatibility with
the native tools.
@item --trap
@itemx --no-trap
@itemx --break
@itemx --no-break
Control how to deal with multiplication overflow and division by zero.
@samp{--trap} or @samp{--no-break} (which are synonyms) take a trap exception
(and only work for Instruction Set Architecture level 2 and higher);
@samp{--break} or @samp{--no-trap} (also synonyms, and the default) take a
break exception.
@item -n
When this option is used, @command{@value{AS}} will issue a warning every
time it generates a nop instruction from a macro.
@end table
@end ifset
@ifset MCORE
The following options are available when @value{AS} is configured for
an MCore processor.
@table @gcctabopt
@item -jsri2bsr
@itemx -nojsri2bsr
Enable or disable the JSRI to BSR transformation. By default this is enabled.
The command line option @samp{-nojsri2bsr} can be used to disable it.
@item -sifilter
@itemx -nosifilter
Enable or disable the silicon filter behaviour. By default this is disabled.
The default can be overridden by the @samp{-sifilter} command line option.
@item -relax
Alter jump instructions for long displacements.
@item -mcpu=[210|340]
Select the cpu type on the target hardware. This controls which instructions
can be assembled.
@item -EB
Assemble for a big endian target.
@item -EL
Assemble for a little endian target.
@end table
@end ifset
@c man end
@ifset METAG
@ifclear man
@xref{Meta Options}, for the options available when @value{AS} is configured
for a Meta processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for a
Meta processor.
@c man end
@c man begin INCLUDE
@include c-metag.texi
@c ended inside the included file
@end ifset
@end ifset
@c man begin OPTIONS
@ifset MMIX
See the info pages for documentation of the MMIX-specific options.
@end ifset
@ifset NDS32
@ifclear man
@xref{NDS32 Options}, for the options available when @value{AS} is configured
for a NDS32 processor.
@end ifclear
@c ended inside the included file
@end ifset
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for a
NDS32 processor.
@c man end
@c man begin INCLUDE
@include c-nds32.texi
@c ended inside the included file
@end ifset
@c man end
@ifset PPC
@ifclear man
@xref{PowerPC-Opts}, for the options available when @value{AS} is configured
for a PowerPC processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for a
PowerPC processor.
@c man end
@c man begin INCLUDE
@include c-ppc.texi
@c ended inside the included file
@end ifset
@end ifset
@c man begin OPTIONS
@ifset RX
See the info pages for documentation of the RX-specific options.
@end ifset
@ifset S390
The following options are available when @value{AS} is configured for the s390
processor family.
@table @gcctabopt
@item -m31
@itemx -m64
Select the word size, either 31/32 bits or 64 bits.
@item -mesa
@item -mzarch
Select the architecture mode, either the Enterprise System
Architecture (esa) or the z/Architecture mode (zarch).
@item -march=@var{processor}
Specify which s390 processor variant is the target, @samp{g6}, @samp{g6},
@samp{z900}, @samp{z990}, @samp{z9-109}, @samp{z9-ec}, @samp{z10},
@samp{z196}, @samp{zEC12}, or @samp{z13}.
@item -mregnames
@itemx -mno-regnames
Allow or disallow symbolic names for registers.
@item -mwarn-areg-zero
Warn whenever the operand for a base or index register has been specified
but evaluates to zero.
@end table
@end ifset
@c man end
@ifset TIC6X
@ifclear man
@xref{TIC6X Options}, for the options available when @value{AS} is configured
for a TMS320C6000 processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for a
TMS320C6000 processor.
@c man end
@c man begin INCLUDE
@include c-tic6x.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset TILEGX
@ifclear man
@xref{TILE-Gx Options}, for the options available when @value{AS} is configured
for a TILE-Gx processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for a TILE-Gx
processor.
@c man end
@c man begin INCLUDE
@include c-tilegx.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset VISIUM
@ifclear man
@xref{Visium Options}, for the options available when @value{AS} is configured
for a Visium processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following option is available when @value{AS} is configured for a Visium
processor.
@c man end
@c man begin INCLUDE
@include c-visium.texi
@c ended inside the included file
@end ifset
@end ifset
@ifset XTENSA
@ifclear man
@xref{Xtensa Options}, for the options available when @value{AS} is configured
for an Xtensa processor.
@end ifclear
@ifset man
@c man begin OPTIONS
The following options are available when @value{AS} is configured for an
Xtensa processor.
@c man end
@c man begin INCLUDE
@include c-xtensa.texi
@c ended inside the included file
@end ifset
@end ifset
@c man begin OPTIONS
@ifset Z80
The following options are available when @value{AS} is configured for
a Z80 family processor.
@table @gcctabopt
@item -z80
Assemble for Z80 processor.
@item -r800
Assemble for R800 processor.
@item -ignore-undocumented-instructions
@itemx -Wnud
Assemble undocumented Z80 instructions that also work on R800 without warning.
@item -ignore-unportable-instructions
@itemx -Wnup
Assemble all undocumented Z80 instructions without warning.
@item -warn-undocumented-instructions
@itemx -Wud
Issue a warning for undocumented Z80 instructions that also work on R800.
@item -warn-unportable-instructions
@itemx -Wup
Issue a warning for undocumented Z80 instructions that do not work on R800.
@item -forbid-undocumented-instructions
@itemx -Fud
Treat all undocumented instructions as errors.
@item -forbid-unportable-instructions
@itemx -Fup
Treat undocumented Z80 instructions that do not work on R800 as errors.
@end table
@end ifset
@c man end
@menu
* Manual:: Structure of this Manual
* GNU Assembler:: The GNU Assembler
* Object Formats:: Object File Formats
* Command Line:: Command Line
* Input Files:: Input Files
* Object:: Output (Object) File
* Errors:: Error and Warning Messages
@end menu
@node Manual
@section Structure of this Manual
@cindex manual, structure and purpose
This manual is intended to describe what you need to know to use
@sc{gnu} @command{@value{AS}}. We cover the syntax expected in source files, including
notation for symbols, constants, and expressions; the directives that
@command{@value{AS}} understands; and of course how to invoke @command{@value{AS}}.
@ifclear GENERIC
We also cover special features in the @value{TARGET}
configuration of @command{@value{AS}}, including assembler directives.
@end ifclear
@ifset GENERIC
This manual also describes some of the machine-dependent features of
various flavors of the assembler.
@end ifset
@cindex machine instructions (not covered)
On the other hand, this manual is @emph{not} intended as an introduction
to programming in assembly language---let alone programming in general!
In a similar vein, we make no attempt to introduce the machine
architecture; we do @emph{not} describe the instruction set, standard
mnemonics, registers or addressing modes that are standard to a
particular architecture.
@ifset GENERIC
You may want to consult the manufacturer's
machine architecture manual for this information.
@end ifset
@ifclear GENERIC
@ifset H8/300
For information on the H8/300 machine instruction set, see @cite{H8/300
Series Programming Manual}. For the H8/300H, see @cite{H8/300H Series
Programming Manual} (Renesas).
@end ifset
@ifset SH
For information on the Renesas (formerly Hitachi) / SuperH SH machine instruction set,
see @cite{SH-Microcomputer User's Manual} (Renesas) or
@cite{SH-4 32-bit CPU Core Architecture} (SuperH) and
@cite{SuperH (SH) 64-Bit RISC Series} (SuperH).
@end ifset
@ifset Z8000
For information on the Z8000 machine instruction set, see @cite{Z8000 CPU Technical Manual}
@end ifset
@end ifclear
@c I think this is premature---doc@cygnus.com, 17jan1991
@ignore
Throughout this manual, we assume that you are running @dfn{GNU},
the portable operating system from the @dfn{Free Software
Foundation, Inc.}. This restricts our attention to certain kinds of
computer (in particular, the kinds of computers that @sc{gnu} can run on);
once this assumption is granted examples and definitions need less
qualification.
@command{@value{AS}} is part of a team of programs that turn a high-level
human-readable series of instructions into a low-level
computer-readable series of instructions. Different versions of
@command{@value{AS}} are used for different kinds of computer.
@end ignore
@c There used to be a section "Terminology" here, which defined
@c "contents", "byte", "word", and "long". Defining "word" to any
@c particular size is confusing when the .word directive may generate 16
@c bits on one machine and 32 bits on another; in general, for the user
@c version of this manual, none of these terms seem essential to define.
@c They were used very little even in the former draft of the manual;
@c this draft makes an effort to avoid them (except in names of
@c directives).
@node GNU Assembler
@section The GNU Assembler
@c man begin DESCRIPTION
@sc{gnu} @command{as} is really a family of assemblers.
@ifclear GENERIC
This manual describes @command{@value{AS}}, a member of that family which is
configured for the @value{TARGET} architectures.
@end ifclear
If you use (or have used) the @sc{gnu} assembler on one architecture, you
should find a fairly similar environment when you use it on another
architecture. Each version has much in common with the others,
including object file formats, most assembler directives (often called
@dfn{pseudo-ops}) and assembler syntax.@refill
@cindex purpose of @sc{gnu} assembler
@command{@value{AS}} is primarily intended to assemble the output of the
@sc{gnu} C compiler @code{@value{GCC}} for use by the linker
@code{@value{LD}}. Nevertheless, we've tried to make @command{@value{AS}}
assemble correctly everything that other assemblers for the same
machine would assemble.
@ifset VAX
Any exceptions are documented explicitly (@pxref{Machine Dependencies}).
@end ifset
@ifset M680X0
@c This remark should appear in generic version of manual; assumption
@c here is that generic version sets M680x0.
This doesn't mean @command{@value{AS}} always uses the same syntax as another
assembler for the same architecture; for example, we know of several
incompatible versions of 680x0 assembly language syntax.
@end ifset
@c man end
Unlike older assemblers, @command{@value{AS}} is designed to assemble a source
program in one pass of the source file. This has a subtle impact on the
@kbd{.org} directive (@pxref{Org,,@code{.org}}).
@node Object Formats
@section Object File Formats
@cindex object file format
The @sc{gnu} assembler can be configured to produce several alternative
object file formats. For the most part, this does not affect how you
write assembly language programs; but directives for debugging symbols
are typically different in different file formats. @xref{Symbol
Attributes,,Symbol Attributes}.
@ifclear GENERIC
@ifclear MULTI-OBJ
For the @value{TARGET} target, @command{@value{AS}} is configured to produce
@value{OBJ-NAME} format object files.
@end ifclear
@c The following should exhaust all configs that set MULTI-OBJ, ideally
@ifset I960
On the @value{TARGET}, @command{@value{AS}} can be configured to produce either
@code{b.out} or COFF format object files.
@end ifset
@ifset HPPA
On the @value{TARGET}, @command{@value{AS}} can be configured to produce either
SOM or ELF format object files.
@end ifset
@end ifclear
@node Command Line
@section Command Line
@cindex command line conventions
After the program name @command{@value{AS}}, the command line may contain
options and file names. Options may appear in any order, and may be
before, after, or between file names. The order of file names is
significant.
@cindex standard input, as input file
@kindex --
@file{--} (two hyphens) by itself names the standard input file
explicitly, as one of the files for @command{@value{AS}} to assemble.
@cindex options, command line
Except for @samp{--} any command line argument that begins with a
hyphen (@samp{-}) is an option. Each option changes the behavior of
@command{@value{AS}}. No option changes the way another option works. An
option is a @samp{-} followed by one or more letters; the case of
the letter is important. All options are optional.
Some options expect exactly one file name to follow them. The file
name may either immediately follow the option's letter (compatible
with older assemblers) or it may be the next command argument (@sc{gnu}
standard). These two command lines are equivalent:
@smallexample
@value{AS} -o my-object-file.o mumble.s
@value{AS} -omy-object-file.o mumble.s
@end smallexample
@node Input Files
@section Input Files
@cindex input
@cindex source program
@cindex files, input
We use the phrase @dfn{source program}, abbreviated @dfn{source}, to
describe the program input to one run of @command{@value{AS}}. The program may
be in one or more files; how the source is partitioned into files
doesn't change the meaning of the source.
@c I added "con" prefix to "catenation" just to prove I can overcome my
@c APL training... doc@cygnus.com
The source program is a concatenation of the text in all the files, in the
order specified.
@c man begin DESCRIPTION
Each time you run @command{@value{AS}} it assembles exactly one source
program. The source program is made up of one or more files.
(The standard input is also a file.)
You give @command{@value{AS}} a command line that has zero or more input file
names. The input files are read (from left file name to right). A
command line argument (in any position) that has no special meaning
is taken to be an input file name.
If you give @command{@value{AS}} no file names it attempts to read one input file
from the @command{@value{AS}} standard input, which is normally your terminal. You
may have to type @key{ctl-D} to tell @command{@value{AS}} there is no more program
to assemble.
Use @samp{--} if you need to explicitly name the standard input file
in your command line.
If the source is empty, @command{@value{AS}} produces a small, empty object
file.
@c man end
@subheading Filenames and Line-numbers
@cindex input file linenumbers
@cindex line numbers, in input files
There are two ways of locating a line in the input file (or files) and
either may be used in reporting error messages. One way refers to a line
number in a physical file; the other refers to a line number in a
``logical'' file. @xref{Errors, ,Error and Warning Messages}.
@dfn{Physical files} are those files named in the command line given
to @command{@value{AS}}.
@dfn{Logical files} are simply names declared explicitly by assembler
directives; they bear no relation to physical files. Logical file names help
error messages reflect the original source file, when @command{@value{AS}} source
is itself synthesized from other files. @command{@value{AS}} understands the
@samp{#} directives emitted by the @code{@value{GCC}} preprocessor. See also
@ref{File,,@code{.file}}.
@node Object
@section Output (Object) File
@cindex object file
@cindex output file
@kindex a.out
@kindex .o
Every time you run @command{@value{AS}} it produces an output file, which is
your assembly language program translated into numbers. This file
is the object file. Its default name is
@ifclear BOUT
@code{a.out}.
@end ifclear
@ifset BOUT
@ifset GENERIC
@code{a.out}, or
@end ifset
@code{b.out} when @command{@value{AS}} is configured for the Intel 80960.
@end ifset
You can give it another name by using the @option{-o} option. Conventionally,
object file names end with @file{.o}. The default name is used for historical
reasons: older assemblers were capable of assembling self-contained programs
directly into a runnable program. (For some formats, this isn't currently
possible, but it can be done for the @code{a.out} format.)
@cindex linker
@kindex ld
The object file is meant for input to the linker @code{@value{LD}}. It contains
assembled program code, information to help @code{@value{LD}} integrate
the assembled program into a runnable file, and (optionally) symbolic
information for the debugger.
@c link above to some info file(s) like the description of a.out.
@c don't forget to describe @sc{gnu} info as well as Unix lossage.
@node Errors
@section Error and Warning Messages
@c man begin DESCRIPTION
@cindex error messages
@cindex warning messages
@cindex messages from assembler
@command{@value{AS}} may write warnings and error messages to the standard error
file (usually your terminal). This should not happen when a compiler
runs @command{@value{AS}} automatically. Warnings report an assumption made so
that @command{@value{AS}} could keep assembling a flawed program; errors report a
grave problem that stops the assembly.
@c man end
@cindex format of warning messages
Warning messages have the format
@smallexample
file_name:@b{NNN}:Warning Message Text
@end smallexample
@noindent
@cindex file names and line numbers, in warnings/errors
(where @b{NNN} is a line number). If both a logical file name
(@pxref{File,,@code{.file}}) and a logical line number
@ifset GENERIC
(@pxref{Line,,@code{.line}})
@end ifset
have been given then they will be used, otherwise the file name and line number
in the current assembler source file will be used. The message text is
intended to be self explanatory (in the grand Unix tradition).
Note the file name must be set via the logical version of the @code{.file}
directive, not the DWARF2 version of the @code{.file} directive. For example:
@smallexample
.file 2 "bar.c"
error_assembler_source
.file "foo.c"
.line 30
error_c_source
@end smallexample
produces this output:
@smallexample
Assembler messages:
asm.s:2: Error: no such instruction: `error_assembler_source'
foo.c:31: Error: no such instruction: `error_c_source'
@end smallexample
@cindex format of error messages
Error messages have the format
@smallexample
file_name:@b{NNN}:FATAL:Error Message Text
@end smallexample
The file name and line number are derived as for warning
messages. The actual message text may be rather less explanatory
because many of them aren't supposed to happen.
@node Invoking
@chapter Command-Line Options
@cindex options, all versions of assembler
This chapter describes command-line options available in @emph{all}
versions of the @sc{gnu} assembler; see @ref{Machine Dependencies},
for options specific
@ifclear GENERIC
to the @value{TARGET} target.
@end ifclear
@ifset GENERIC
to particular machine architectures.
@end ifset
@c man begin DESCRIPTION
If you are invoking @command{@value{AS}} via the @sc{gnu} C compiler,
you can use the @samp{-Wa} option to pass arguments through to the assembler.
The assembler arguments must be separated from each other (and the @samp{-Wa})
by commas. For example:
@smallexample
gcc -c -g -O -Wa,-alh,-L file.c
@end smallexample
@noindent
This passes two options to the assembler: @samp{-alh} (emit a listing to
standard output with high-level and assembly source) and @samp{-L} (retain
local symbols in the symbol table).
Usually you do not need to use this @samp{-Wa} mechanism, since many compiler
command-line options are automatically passed to the assembler by the compiler.
(You can call the @sc{gnu} compiler driver with the @samp{-v} option to see
precisely what options it passes to each compilation pass, including the
assembler.)
@c man end
@menu
* a:: -a[cdghlns] enable listings
* alternate:: --alternate enable alternate macro syntax
* D:: -D for compatibility
* f:: -f to work faster
* I:: -I for .include search path
@ifclear DIFF-TBL-KLUGE
* K:: -K for compatibility
@end ifclear
@ifset DIFF-TBL-KLUGE
* K:: -K for difference tables
@end ifset
* L:: -L to retain local symbols
* listing:: --listing-XXX to configure listing output
* M:: -M or --mri to assemble in MRI compatibility mode
* MD:: --MD for dependency tracking
* no-pad-sections:: --no-pad-sections to stop section padding
* o:: -o to name the object file
* R:: -R to join data and text sections
* statistics:: --statistics to see statistics about assembly
* traditional-format:: --traditional-format for compatible output
* v:: -v to announce version
* W:: -W, --no-warn, --warn, --fatal-warnings to control warnings
* Z:: -Z to make object file even after errors
@end menu
@node a
@section Enable Listings: @option{-a[cdghlns]}
@kindex -a
@kindex -ac
@kindex -ad
@kindex -ag
@kindex -ah
@kindex -al
@kindex -an
@kindex -as
@cindex listings, enabling
@cindex assembly listings, enabling
These options enable listing output from the assembler. By itself,
@samp{-a} requests high-level, assembly, and symbols listing.
You can use other letters to select specific options for the list:
@samp{-ah} requests a high-level language listing,
@samp{-al} requests an output-program assembly listing, and
@samp{-as} requests a symbol table listing.
High-level listings require that a compiler debugging option like
@samp{-g} be used, and that assembly listings (@samp{-al}) be requested
also.
Use the @samp{-ag} option to print a first section with general assembly
information, like @value{AS} version, switches passed, or time stamp.
Use the @samp{-ac} option to omit false conditionals from a listing. Any lines
which are not assembled because of a false @code{.if} (or @code{.ifdef}, or any
other conditional), or a true @code{.if} followed by an @code{.else}, will be
omitted from the listing.
Use the @samp{-ad} option to omit debugging directives from the
listing.
Once you have specified one of these options, you can further control
listing output and its appearance using the directives @code{.list},
@code{.nolist}, @code{.psize}, @code{.eject}, @code{.title}, and
@code{.sbttl}.
The @samp{-an} option turns off all forms processing.
If you do not request listing output with one of the @samp{-a} options, the
listing-control directives have no effect.
The letters after @samp{-a} may be combined into one option,
@emph{e.g.}, @samp{-aln}.
Note if the assembler source is coming from the standard input (e.g.,
because it
is being created by @code{@value{GCC}} and the @samp{-pipe} command line switch
is being used) then the listing will not contain any comments or preprocessor
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}
@kindex -D
This option has no effect whatsoever, but it is accepted to make it more
likely that scripts written for other assemblers also work with
@command{@value{AS}}.
@node f
@section Work Faster: @option{-f}
@kindex -f
@cindex trusted compiler
@cindex faster processing (@option{-f})
@samp{-f} should only be used when assembling programs written by a
(trusted) compiler. @samp{-f} stops the assembler from doing whitespace
and comment preprocessing on
the input file(s) before assembling them. @xref{Preprocessing,
,Preprocessing}.
@quotation
@emph{Warning:} if you use @samp{-f} when the files actually need to be
preprocessed (if they contain comments, for example), @command{@value{AS}} does
not work correctly.
@end quotation
@node I
@section @code{.include} Search Path: @option{-I} @var{path}
@kindex -I @var{path}
@cindex paths for @code{.include}
@cindex search path for @code{.include}
@cindex @code{include} directive search path
Use this option to add a @var{path} to the list of directories
@command{@value{AS}} searches for files specified in @code{.include}
directives (@pxref{Include,,@code{.include}}). You may use @option{-I} as
many times as necessary to include a variety of paths. The current
working directory is always searched first; after that, @command{@value{AS}}
searches any @samp{-I} directories in the same order as they were
specified (left to right) on the command line.
@node K
@section Difference Tables: @option{-K}
@kindex -K
@ifclear DIFF-TBL-KLUGE
On the @value{TARGET} family, this option is allowed, but has no effect. It is
permitted for compatibility with the @sc{gnu} assembler on other platforms,
where it can be used to warn when the assembler alters the machine code
generated for @samp{.word} directives in difference tables. The @value{TARGET}
family does not have the addressing limitations that sometimes lead to this
alteration on other platforms.
@end ifclear
@ifset DIFF-TBL-KLUGE
@cindex difference tables, warning
@cindex warning for altered difference tables
@command{@value{AS}} sometimes alters the code emitted for directives of the
form @samp{.word @var{sym1}-@var{sym2}}. @xref{Word,,@code{.word}}.
You can use the @samp{-K} option if you want a warning issued when this
is done.
@end ifset
@node L
@section Include Local Symbols: @option{-L}
@kindex -L
@cindex local symbols, retaining in output
Symbols beginning with system-specific local label prefixes, typically
@samp{.L} for ELF systems or @samp{L} for traditional a.out systems, are
called @dfn{local symbols}. @xref{Symbol Names}. Normally you do not see
such symbols when debugging, because they are intended for the use of
programs (like compilers) that compose assembler programs, not for your
notice. Normally both @command{@value{AS}} and @code{@value{LD}} discard
such symbols, so you do not normally debug with them.
This option tells @command{@value{AS}} to retain those local symbols
in the object file. Usually if you do this you also tell the linker
@code{@value{LD}} to preserve those symbols.
@node listing
@section Configuring listing output: @option{--listing}
The listing feature of the assembler can be enabled via the command line switch
@samp{-a} (@pxref{a}). This feature combines the input source file(s) with a
hex dump of the corresponding locations in the output object file, and displays
them as a listing file. The format of this listing can be controlled by
directives inside the assembler source (i.e., @code{.list} (@pxref{List}),
@code{.title} (@pxref{Title}), @code{.sbttl} (@pxref{Sbttl}),
@code{.psize} (@pxref{Psize}), and
@code{.eject} (@pxref{Eject}) and also by the following switches:
@table @gcctabopt
@item --listing-lhs-width=@samp{number}
@kindex --listing-lhs-width
@cindex Width of first line disassembly output
Sets the maximum width, in words, of the first line of the hex byte dump. This
dump appears on the left hand side of the listing output.
@item --listing-lhs-width2=@samp{number}
@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 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.
@item --listing-rhs-width=@samp{number}
@kindex --listing-rhs-width
@cindex Width of source line output
Sets the maximum width, in characters, of the source line that is displayed
alongside the hex dump. The default value for this parameter is 100. The
source line is displayed on the right hand side of the listing output.
@item --listing-cont-lines=@samp{number}
@kindex --listing-cont-lines
@cindex Maximum number of continuation lines
Sets the maximum number of continuation lines of hex dump that will be
displayed for a given single line of source input. The default value is 4.
@end table
@node M
@section Assemble in MRI Compatibility Mode: @option{-M}
@kindex -M
@cindex MRI compatibility mode
The @option{-M} or @option{--mri} option selects MRI compatibility mode. This
changes the syntax and pseudo-op handling of @command{@value{AS}} to make it
compatible with the @code{ASM68K} or the @code{ASM960} (depending upon the
configured target) assembler from Microtec Research. The exact nature of the
MRI syntax will not be documented here; see the MRI manuals for more
information. Note in particular that the handling of macros and macro
arguments is somewhat different. The purpose of this option is to permit
assembling existing MRI assembler code using @command{@value{AS}}.
The MRI compatibility is not complete. Certain operations of the MRI assembler
depend upon its object file format, and can not be supported using other object
file formats. Supporting these would require enhancing each object file format
individually. These are:
@itemize @bullet
@item global symbols in common section
The m68k MRI assembler supports common sections which are merged by the linker.
Other object file formats do not support this. @command{@value{AS}} handles
common sections by treating them as a single common symbol. It permits local
symbols to be defined within a common section, but it can not support global
symbols, since it has no way to describe them.
@item complex relocations
The MRI assemblers support relocations against a negated section address, and
relocations which combine the start addresses of two or more sections. These
are not support by other object file formats.
@item @code{END} pseudo-op specifying start address
The MRI @code{END} pseudo-op permits the specification of a start address.
This is not supported by other object file formats. The start address may
instead be specified using the @option{-e} option to the linker, or in a linker
script.
@item @code{IDNT}, @code{.ident} and @code{NAME} pseudo-ops
The MRI @code{IDNT}, @code{.ident} and @code{NAME} pseudo-ops assign a module
name to the output file. This is not supported by other object file formats.
@item @code{ORG} pseudo-op
The m68k MRI @code{ORG} pseudo-op begins an absolute section at a given
address. This differs from the usual @command{@value{AS}} @code{.org} pseudo-op,
which changes the location within the current section. Absolute sections are
not supported by other object file formats. The address of a section may be
assigned within a linker script.
@end itemize
There are some other features of the MRI assembler which are not supported by
@command{@value{AS}}, typically either because they are difficult or because they
seem of little consequence. Some of these may be supported in future releases.
@itemize @bullet
@item EBCDIC strings
EBCDIC strings are not supported.
@item packed binary coded decimal
Packed binary coded decimal is not supported. This means that the @code{DC.P}
and @code{DCB.P} pseudo-ops are not supported.
@item @code{FEQU} pseudo-op
The m68k @code{FEQU} pseudo-op is not supported.
@item @code{NOOBJ} pseudo-op
The m68k @code{NOOBJ} pseudo-op is not supported.
@item @code{OPT} branch control options
The m68k @code{OPT} branch control options---@code{B}, @code{BRS}, @code{BRB},
@code{BRL}, and @code{BRW}---are ignored. @command{@value{AS}} automatically
relaxes all branches, whether forward or backward, to an appropriate size, so
these options serve no purpose.
@item @code{OPT} list control options
The following m68k @code{OPT} list control options are ignored: @code{C},
@code{CEX}, @code{CL}, @code{CRE}, @code{E}, @code{G}, @code{I}, @code{M},
@code{MEX}, @code{MC}, @code{MD}, @code{X}.
@item other @code{OPT} options
The following m68k @code{OPT} options are ignored: @code{NEST}, @code{O},
@code{OLD}, @code{OP}, @code{P}, @code{PCO}, @code{PCR}, @code{PCS}, @code{R}.
@item @code{OPT} @code{D} option is default
The m68k @code{OPT} @code{D} option is the default, unlike the MRI assembler.
@code{OPT NOD} may be used to turn it off.
@item @code{XREF} pseudo-op.
The m68k @code{XREF} pseudo-op is ignored.
@item @code{.debug} pseudo-op
The i960 @code{.debug} pseudo-op is not supported.
@item @code{.extended} pseudo-op
The i960 @code{.extended} pseudo-op is not supported.
@item @code{.list} pseudo-op.
The various options of the i960 @code{.list} pseudo-op are not supported.
@item @code{.optimize} pseudo-op
The i960 @code{.optimize} pseudo-op is not supported.
@item @code{.output} pseudo-op
The i960 @code{.output} pseudo-op is not supported.
@item @code{.setreal} pseudo-op
The i960 @code{.setreal} pseudo-op is not supported.
@end itemize
@node MD
@section Dependency Tracking: @option{--MD}
@kindex --MD
@cindex dependency tracking
@cindex make rules
@command{@value{AS}} can generate a dependency file for the file it creates. This
file consists of a single rule suitable for @code{make} describing the
dependencies of the main source file.
The rule is written to the file named in its argument.
This feature is used in the automatic updating of makefiles.
@node no-pad-sections
@section Output Section Padding
@kindex --no-pad-sections
@cindex output section padding
Normally the assembler will pad the end of each output section up to its
alignment boundary. But this can waste space, which can be significant on
memory constrained targets. So the @option{--no-pad-sections} option will
disable this behaviour.
@node o
@section Name the Object File: @option{-o}
@kindex -o
@cindex naming object file
@cindex object file name
There is always one object file output when you run @command{@value{AS}}. By
default it has the name
@ifset GENERIC
@ifset I960
@file{a.out} (or @file{b.out}, for Intel 960 targets only).
@end ifset
@ifclear I960
@file{a.out}.
@end ifclear
@end ifset
@ifclear GENERIC
@ifset I960
@file{b.out}.
@end ifset
@ifclear I960
@file{a.out}.
@end ifclear
@end ifclear
You use this option (which takes exactly one filename) to give the
object file a different name.
Whatever the object file is called, @command{@value{AS}} overwrites any
existing file of the same name.
@node R
@section Join Data and Text Sections: @option{-R}
@kindex -R
@cindex data and text sections, joining
@cindex text and data sections, joining
@cindex joining text and data sections
@cindex merging text and data sections
@option{-R} tells @command{@value{AS}} to write the object file as if all
data-section data lives in the text section. This is only done at
the very last moment: your binary data are the same, but data
section parts are relocated differently. The data section part of
your object file is zero bytes long because all its bytes are
appended to the text section. (@xref{Sections,,Sections and Relocation}.)
When you specify @option{-R} it would be possible to generate shorter
address displacements (because we do not have to cross between text and
data section). We refrain from doing this simply for compatibility with
older versions of @command{@value{AS}}. In future, @option{-R} may work this way.
@ifset COFF-ELF
When @command{@value{AS}} is configured for COFF or ELF output,
this option is only useful if you use sections named @samp{.text} and
@samp{.data}.
@end ifset
@ifset HPPA
@option{-R} is not supported for any of the HPPA targets. Using
@option{-R} generates a warning from @command{@value{AS}}.
@end ifset
@node statistics
@section Display Assembly Statistics: @option{--statistics}
@kindex --statistics
@cindex statistics, about assembly
@cindex time, total for assembly
@cindex space used, maximum for assembly
Use @samp{--statistics} to display two statistics about the resources used by
@command{@value{AS}}: the maximum amount of space allocated during the assembly
(in bytes), and the total execution time taken for the assembly (in @sc{cpu}
seconds).
@node traditional-format
@section Compatible Output: @option{--traditional-format}
@kindex --traditional-format
For some targets, the output of @command{@value{AS}} is different in some ways
from the output of some existing assembler. This switch requests
@command{@value{AS}} to use the traditional format instead.
For example, it disables the exception frame optimizations which
@command{@value{AS}} normally does by default on @code{@value{GCC}} output.
@node v
@section Announce Version: @option{-v}
@kindex -v
@kindex -version
@cindex assembler version
@cindex version of assembler
You can find out what version of as is running by including the
option @samp{-v} (which you can also spell as @samp{-version}) on the
command line.
@node W
@section Control Warnings: @option{-W}, @option{--warn}, @option{--no-warn}, @option{--fatal-warnings}
@command{@value{AS}} should never give a warning or error message when
assembling compiler output. But programs written by people often
cause @command{@value{AS}} to give a warning that a particular assumption was
made. All such warnings are directed to the standard error file.
@kindex -W
@kindex --no-warn
@cindex suppressing warnings
@cindex warnings, suppressing
If you use the @option{-W} and @option{--no-warn} options, no warnings are issued.
This only affects the warning messages: it does not change any particular of
how @command{@value{AS}} assembles your file. Errors, which stop the assembly,
are still reported.
@kindex --fatal-warnings
@cindex errors, caused by warnings
@cindex warnings, causing error
If you use the @option{--fatal-warnings} option, @command{@value{AS}} considers
files that generate warnings to be in error.
@kindex --warn
@cindex warnings, switching on
You can switch these options off again by specifying @option{--warn}, which
causes warnings to be output as usual.
@node Z
@section Generate Object File in Spite of Errors: @option{-Z}
@cindex object file, after errors
@cindex errors, continuing after
After an error message, @command{@value{AS}} normally produces no output. If for
some reason you are interested in object file output even after
@command{@value{AS}} gives an error message on your program, use the @samp{-Z}
option. If there are any errors, @command{@value{AS}} continues anyways, and
writes an object file after a final warning message of the form @samp{@var{n}
errors, @var{m} warnings, generating bad object file.}
@node Syntax
@chapter Syntax
@cindex machine-independent syntax
@cindex syntax, machine-independent
This chapter describes the machine-independent syntax allowed in a
source file. @command{@value{AS}} syntax is similar to what many other
assemblers use; it is inspired by the BSD 4.2
@ifclear VAX
assembler.
@end ifclear
@ifset VAX
assembler, except that @command{@value{AS}} does not assemble Vax bit-fields.
@end ifset
@menu
* Preprocessing:: Preprocessing
* Whitespace:: Whitespace
* Comments:: Comments
* Symbol Intro:: Symbols
* Statements:: Statements
* Constants:: Constants
@end menu
@node Preprocessing
@section Preprocessing
@cindex preprocessing
The @command{@value{AS}} internal preprocessor:
@itemize @bullet
@cindex whitespace, removed by preprocessor
@item
adjusts and removes extra whitespace. It leaves one space or tab before
the keywords on a line, and turns any other whitespace on the line into
a single space.
@cindex comments, removed by preprocessor
@item
removes all comments, replacing them with a single space, or an
appropriate number of newlines.
@cindex constants, converted by preprocessor
@item
converts character constants into the appropriate numeric values.
@end itemize
It does not do macro processing, include file handling, or
anything else you may get from your C compiler's preprocessor. You can
do include file processing with the @code{.include} directive
(@pxref{Include,,@code{.include}}). You can use the @sc{gnu} C compiler driver
to get other ``CPP'' style preprocessing by giving the input file a
@samp{.S} suffix. @xref{Overall Options, ,Options Controlling the Kind of
Output, gcc info, Using GNU CC}.
Excess whitespace, comments, and character constants
cannot be used in the portions of the input text that are not
preprocessed.
@cindex turning preprocessing on and off
@cindex preprocessing, turning on and off
@kindex #NO_APP
@kindex #APP
If the first line of an input file is @code{#NO_APP} or if you use the
@samp{-f} option, whitespace and comments are not removed from the input file.
Within an input file, you can ask for whitespace and comment removal in
specific portions of the by putting a line that says @code{#APP} before the
text that may contain whitespace or comments, and putting a line that says
@code{#NO_APP} after this text. This feature is mainly intend to support
@code{asm} statements in compilers whose output is otherwise free of comments
and whitespace.
@node Whitespace
@section Whitespace
@cindex whitespace
@dfn{Whitespace} is one or more blanks or tabs, in any order.
Whitespace is used to separate symbols, and to make programs neater for
people to read. Unless within character constants
(@pxref{Characters,,Character Constants}), any whitespace means the same
as exactly one space.
@node Comments
@section Comments
@cindex comments
There are two ways of rendering comments to @command{@value{AS}}. In both
cases the comment is equivalent to one space.
Anything from @samp{/*} through the next @samp{*/} is a comment.
This means you may not nest these comments.
@smallexample
/*
The only way to include a newline ('\n') in a comment
is to use this sort of comment.
*/
/* This sort of comment does not nest. */
@end smallexample
@cindex line comment character
Anything from a @dfn{line comment} character up to the next newline is
considered a comment and is ignored. The line comment character is target
specific, and some targets multiple comment characters. Some targets also have
line comment characters that only work if they are the first character on a
line. Some targets use a sequence of two characters to introduce a line
comment. Some targets can also change their line comment characters depending
upon command line options that have been used. For more details see the
@emph{Syntax} section in the documentation for individual targets.
If the line comment character is the hash sign (@samp{#}) then it still has the
special ability to enable and disable preprocessing (@pxref{Preprocessing}) and
to specify logical line numbers:
@kindex #
@cindex lines starting with @code{#}
@cindex logical line numbers
To be compatible with past assemblers, lines that begin with @samp{#} have a
special interpretation. Following the @samp{#} should be an absolute
expression (@pxref{Expressions}): the logical line number of the @emph{next}
line. Then a string (@pxref{Strings, ,Strings}) is allowed: if present it is a
new logical file name. The rest of the line, if any, should be whitespace.
If the first non-whitespace characters on the line are not numeric,
the line is ignored. (Just like a comment.)
@smallexample
# This is an ordinary comment.
# 42-6 "new_file_name" # New logical file name
# This is logical line # 36.
@end smallexample
This feature is deprecated, and may disappear from future versions
of @command{@value{AS}}.
@node Symbol Intro
@section Symbols
@cindex characters used in symbols
@ifclear SPECIAL-SYMS
A @dfn{symbol} is one or more characters chosen from the set of all
letters (both upper and lower case), digits and the three characters
@samp{_.$}.
@end ifclear
@ifset SPECIAL-SYMS
@ifclear GENERIC
@ifset H8
A @dfn{symbol} is one or more characters chosen from the set of all
letters (both upper and lower case), digits and the three characters
@samp{._$}. (Save that, on the H8/300 only, you may not use @samp{$} in
symbol names.)
@end ifset
@end ifclear
@end ifset
@ifset GENERIC
On most machines, you can also use @code{$} in symbol names; exceptions
are noted in @ref{Machine Dependencies}.
@end ifset
No symbol may begin with a digit. Case is significant.
There is no length limit; all characters are significant. Multibyte characters
are supported. Symbols are delimited by characters not in that set, or by the
beginning of a file (since the source program must end with a newline, the end
of a file is not a possible symbol delimiter). @xref{Symbols}.
Symbol names may also be enclosed in double quote @code{"} characters. In such
cases any characters are allowed, except for the NUL character. If a double
quote character is to be included in the symbol name it must be preceeded by a
backslash @code{\} character.
@cindex length of symbols
@node Statements
@section Statements
@cindex statements, structure of
@cindex line separator character
@cindex statement separator character
A @dfn{statement} ends at a newline character (@samp{\n}) or a
@dfn{line separator character}. The line separator character is target
specific and described in the @emph{Syntax} section of each
target's documentation. Not all targets support a line separator character.
The newline or line separator character is considered to be part of the
preceding statement. Newlines and separators within character constants are an
exception: they do not end statements.
@cindex newline, required at file end
@cindex EOF, newline must precede
It is an error to end any statement with end-of-file: the last
character of any input file should be a newline.@refill
An empty statement is allowed, and may include whitespace. It is ignored.
@cindex instructions and directives
@cindex directives and instructions
@c "key symbol" is not used elsewhere in the document; seems pedantic to
@c @defn{} it in that case, as was done previously... doc@cygnus.com,
@c 13feb91.
A statement begins with zero or more labels, optionally followed by a
key symbol which determines what kind of statement it is. The key
symbol determines the syntax of the rest of the statement. If the
symbol begins with a dot @samp{.} then the statement is an assembler
directive: typically valid for any computer. If the symbol begins with
a letter the statement is an assembly language @dfn{instruction}: it
assembles into a machine language instruction.
@ifset GENERIC
Different versions of @command{@value{AS}} for different computers
recognize different instructions. In fact, the same symbol may
represent a different instruction in a different computer's assembly
language.@refill
@end ifset
@cindex @code{:} (label)
@cindex label (@code{:})
A label is a symbol immediately followed by a colon (@code{:}).
Whitespace before a label or after a colon is permitted, but you may not
have whitespace between a label's symbol and its colon. @xref{Labels}.
@ifset HPPA
For HPPA targets, labels need not be immediately followed by a colon, but
the definition of a label must begin in column zero. This also implies that
only one label may be defined on each line.
@end ifset
@smallexample
label: .directive followed by something
another_label: # This is an empty statement.
instruction operand_1, operand_2, @dots{}
@end smallexample
@node Constants
@section Constants
@cindex constants
A constant is a number, written so that its value is known by
inspection, without knowing any context. Like this:
@smallexample
@group
.byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value.
.ascii "Ring the bell\7" # A string constant.
.octa 0x123456789abcdef0123456789ABCDEF0 # A bignum.
.float 0f-314159265358979323846264338327\
95028841971.693993751E-40 # - pi, a flonum.
@end group
@end smallexample
@menu
* Characters:: Character Constants
* Numbers:: Number Constants
@end menu
@node Characters
@subsection Character Constants
@cindex character constants
@cindex constants, character
There are two kinds of character constants. A @dfn{character} stands
for one character in one byte and its value may be used in
numeric expressions. String constants (properly called string
@emph{literals}) are potentially many bytes and their values may not be
used in arithmetic expressions.
@menu
* Strings:: Strings
* Chars:: Characters
@end menu
@node Strings
@subsubsection Strings
@cindex string constants
@cindex constants, string
A @dfn{string} is written between double-quotes. It may contain
double-quotes or null characters. The way to get special characters
into a string is to @dfn{escape} these characters: precede them with
a backslash @samp{\} character. For example @samp{\\} represents
one backslash: the first @code{\} is an escape which tells
@command{@value{AS}} to interpret the second character literally as a backslash
(which prevents @command{@value{AS}} from recognizing the second @code{\} as an
escape character). The complete list of escapes follows.
@cindex escape codes, character
@cindex character escape codes
@c NOTE: Cindex entries must not start with a backlash character.
@c NOTE: This confuses the pdf2texi script when it is creating the
@c NOTE: index based upon the first character and so it generates:
@c NOTE: \initial {\\}
@c NOTE: which then results in the error message:
@c NOTE: Argument of \\ has an extra }.
@c NOTE: So in the index entries below a space character has been
@c NOTE: prepended to avoid this problem.
@table @kbd
@c @item \a
@c Mnemonic for ACKnowledge; for ASCII this is octal code 007.
@c
@cindex @code{ \b} (backspace character)
@cindex backspace (@code{\b})
@item \b
Mnemonic for backspace; for ASCII this is octal code 010.
@c @item \e
@c Mnemonic for EOText; for ASCII this is octal code 004.
@c
@cindex @code{ \f} (formfeed character)
@cindex formfeed (@code{\f})
@item backslash-f
Mnemonic for FormFeed; for ASCII this is octal code 014.
@cindex @code{ \n} (newline character)
@cindex newline (@code{\n})
@item \n
Mnemonic for newline; for ASCII this is octal code 012.
@c @item \p
@c Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}.
@c
@cindex @code{ \r} (carriage return character)
@cindex carriage return (@code{backslash-r})
@item \r
Mnemonic for carriage-Return; for ASCII this is octal code 015.
@c @item \s
@c Mnemonic for space; for ASCII this is octal code 040. Included for compliance with
@c other assemblers.
@c
@cindex @code{ \t} (tab)
@cindex tab (@code{\t})
@item \t
Mnemonic for horizontal Tab; for ASCII this is octal code 011.
@c @item \v
@c Mnemonic for Vertical tab; for ASCII this is octal code 013.
@c @item \x @var{digit} @var{digit} @var{digit}
@c A hexadecimal character code. The numeric code is 3 hexadecimal digits.
@c
@cindex @code{ \@var{ddd}} (octal character code)
@cindex octal character code (@code{\@var{ddd}})
@item \ @var{digit} @var{digit} @var{digit}
An octal character code. The numeric code is 3 octal digits.
For compatibility with other Unix systems, 8 and 9 are accepted as digits:
for example, @code{\008} has the value 010, and @code{\009} the value 011.
@cindex @code{ \@var{xd...}} (hex character code)
@cindex hex character code (@code{\@var{xd...}})
@item \@code{x} @var{hex-digits...}
A hex character code. All trailing hex digits are combined. Either upper or
lower case @code{x} works.
@cindex @code{ \\} (@samp{\} character)
@cindex backslash (@code{\\})
@item \\
Represents one @samp{\} character.
@c @item \'
@c Represents one @samp{'} (accent acute) character.
@c This is needed in single character literals
@c (@xref{Characters,,Character Constants}.) to represent
@c a @samp{'}.
@c
@cindex @code{ \"} (doublequote character)
@cindex doublequote (@code{\"})
@item \"
Represents one @samp{"} character. Needed in strings to represent
this character, because an unescaped @samp{"} would end the string.
@item \ @var{anything-else}
Any other character when escaped by @kbd{\} gives a warning, but
assembles as if the @samp{\} was not present. The idea is that if
you used an escape sequence you clearly didn't want the literal
interpretation of the following character. However @command{@value{AS}} has no
other interpretation, so @command{@value{AS}} knows it is giving you the wrong
code and warns you of the fact.
@end table
Which characters are escapable, and what those escapes represent,
varies widely among assemblers. The current set is what we think
the BSD 4.2 assembler recognizes, and is a subset of what most C
compilers recognize. If you are in doubt, do not use an escape
sequence.
@node Chars
@subsubsection Characters
@cindex single character constant
@cindex character, single
@cindex constant, single character
A single character may be written as a single quote immediately
followed by that character. The same escapes apply to characters as
to strings. So if you want to write the character backslash, you
must write @kbd{'\\} where the first @code{\} escapes the second
@code{\}. As you can see, the quote is an acute accent, not a
grave accent. A newline
@ifclear GENERIC
@ifclear abnormal-separator
(or semicolon @samp{;})
@end ifclear
@ifset abnormal-separator
@ifset H8
(or dollar sign @samp{$}, for the H8/300; or semicolon @samp{;} for the
Renesas SH)
@end ifset
@end ifset
@end ifclear
immediately following an acute accent is taken as a literal character
and does not count as the end of a statement. The value of a character
constant in a numeric expression is the machine's byte-wide code for
that character. @command{@value{AS}} assumes your character code is ASCII:
@kbd{'A} means 65, @kbd{'B} means 66, and so on. @refill
@node Numbers
@subsection Number Constants
@cindex constants, number
@cindex number constants
@command{@value{AS}} distinguishes three kinds of numbers according to how they
are stored in the target machine. @emph{Integers} are numbers that
would fit into an @code{int} in the C language. @emph{Bignums} are
integers, but they are stored in more than 32 bits. @emph{Flonums}
are floating point numbers, described below.
@menu
* Integers:: Integers
* Bignums:: Bignums
* Flonums:: Flonums
@ifclear GENERIC
@ifset I960
* Bit Fields:: Bit Fields
@end ifset
@end ifclear
@end menu
@node Integers
@subsubsection Integers
@cindex integers
@cindex constants, integer
@cindex binary integers
@cindex integers, binary
A binary integer is @samp{0b} or @samp{0B} followed by zero or more of
the binary digits @samp{01}.
@cindex octal integers
@cindex integers, octal
An octal integer is @samp{0} followed by zero or more of the octal
digits (@samp{01234567}).
@cindex decimal integers
@cindex integers, decimal
A decimal integer starts with a non-zero digit followed by zero or
more digits (@samp{0123456789}).
@cindex hexadecimal integers
@cindex integers, hexadecimal
A hexadecimal integer is @samp{0x} or @samp{0X} followed by one or
more hexadecimal digits chosen from @samp{0123456789abcdefABCDEF}.
Integers have the usual values. To denote a negative integer, use
the prefix operator @samp{-} discussed under expressions
(@pxref{Prefix Ops,,Prefix Operators}).
@node Bignums
@subsubsection Bignums
@cindex bignums
@cindex constants, bignum
A @dfn{bignum} has the same syntax and semantics as an integer
except that the number (or its negative) takes more than 32 bits to
represent in binary. The distinction is made because in some places
integers are permitted while bignums are not.
@node Flonums
@subsubsection Flonums
@cindex flonums
@cindex floating point numbers
@cindex constants, floating point
@cindex precision, floating point
A @dfn{flonum} represents a floating point number. The translation is
indirect: a decimal floating point number from the text is converted by
@command{@value{AS}} to a generic binary floating point number of more than
sufficient precision. This generic floating point number is converted
to a particular computer's floating point format (or formats) by a
portion of @command{@value{AS}} specialized to that computer.
A flonum is written by writing (in order)
@itemize @bullet
@item
The digit @samp{0}.
@ifset HPPA
(@samp{0} is optional on the HPPA.)
@end ifset
@item
A letter, to tell @command{@value{AS}} the rest of the number is a flonum.
@ifset GENERIC
@kbd{e} is recommended. Case is not important.
@ignore
@c FIXME: verify if flonum syntax really this vague for most cases
(Any otherwise illegal letter works here, but that might be changed. Vax BSD
4.2 assembler seems to allow any of @samp{defghDEFGH}.)
@end ignore
On the H8/300, Renesas / SuperH SH,
and AMD 29K architectures, the letter must be
one of the letters @samp{DFPRSX} (in upper or lower case).
On the ARC, the letter must be one of the letters @samp{DFRS}
(in upper or lower case).
On the Intel 960 architecture, the letter must be
one of the letters @samp{DFT} (in upper or lower case).
On the HPPA architecture, the letter must be @samp{E} (upper case only).
@end ifset
@ifclear GENERIC
@ifset ARC
One of the letters @samp{DFRS} (in upper or lower case).
@end ifset
@ifset H8
One of the letters @samp{DFPRSX} (in upper or lower case).
@end ifset
@ifset HPPA
The letter @samp{E} (upper case only).
@end ifset
@ifset I960
One of the letters @samp{DFT} (in upper or lower case).
@end ifset
@end ifclear
@item
An optional sign: either @samp{+} or @samp{-}.
@item
An optional @dfn{integer part}: zero or more decimal digits.
@item
An optional @dfn{fractional part}: @samp{.} followed by zero
or more decimal digits.
@item
An optional exponent, consisting of:
@itemize @bullet
@item
An @samp{E} or @samp{e}.
@c I can't find a config where "EXP_CHARS" is other than 'eE', but in
@c principle this can perfectly well be different on different targets.
@item
Optional sign: either @samp{+} or @samp{-}.
@item
One or more decimal digits.
@end itemize
@end itemize
At least one of the integer part or the fractional part must be
present. The floating point number has the usual base-10 value.
@command{@value{AS}} does all processing using integers. Flonums are computed
independently of any floating point hardware in the computer running
@command{@value{AS}}.
@ifclear GENERIC
@ifset I960
@c Bit fields are written as a general facility but are also controlled
@c by a conditional-compilation flag---which is as of now (21mar91)
@c turned on only by the i960 config of GAS.
@node Bit Fields
@subsubsection Bit Fields
@cindex bit fields
@cindex constants, bit field
You can also define numeric constants as @dfn{bit fields}.
Specify two numbers separated by a colon---
@example
@var{mask}:@var{value}
@end example
@noindent
@command{@value{AS}} applies a bitwise @sc{and} between @var{mask} and
@var{value}.
The resulting number is then packed
@ifset GENERIC
@c this conditional paren in case bit fields turned on elsewhere than 960
(in host-dependent byte order)
@end ifset
into a field whose width depends on which assembler directive has the
bit-field as its argument. Overflow (a result from the bitwise and
requiring more binary digits to represent) is not an error; instead,
more constants are generated, of the specified width, beginning with the
least significant digits.@refill
The directives @code{.byte}, @code{.hword}, @code{.int}, @code{.long},
@code{.short}, and @code{.word} accept bit-field arguments.
@end ifset
@end ifclear
@node Sections
@chapter Sections and Relocation
@cindex sections
@cindex relocation
@menu
* Secs Background:: Background
* Ld Sections:: Linker Sections
* As Sections:: Assembler Internal Sections
* Sub-Sections:: Sub-Sections
* bss:: bss Section
@end menu
@node Secs Background
@section Background
Roughly, a section is a range of addresses, with no gaps; all data
``in'' those addresses is treated the same for some particular purpose.
For example there may be a ``read only'' section.
@cindex linker, and assembler
@cindex assembler, and linker
The linker @code{@value{LD}} reads many object files (partial programs) and
combines their contents to form a runnable program. When @command{@value{AS}}
emits an object file, the partial program is assumed to start at address 0.
@code{@value{LD}} assigns the final addresses for the partial program, so that
different partial programs do not overlap. This is actually an
oversimplification, but it suffices to explain how @command{@value{AS}} uses
sections.
@code{@value{LD}} moves blocks of bytes of your program to their run-time
addresses. These blocks slide to their run-time addresses as rigid
units; their length does not change and neither does the order of bytes
within them. Such a rigid unit is called a @emph{section}. Assigning
run-time addresses to sections is called @dfn{relocation}. It includes
the task of adjusting mentions of object-file addresses so they refer to
the proper run-time addresses.
@ifset H8
For the H8/300, and for the Renesas / SuperH SH,
@command{@value{AS}} pads sections if needed to
ensure they end on a word (sixteen bit) boundary.
@end ifset
@cindex standard assembler sections
An object file written by @command{@value{AS}} has at least three sections, any
of which may be empty. These are named @dfn{text}, @dfn{data} and
@dfn{bss} sections.
@ifset COFF-ELF
@ifset GENERIC
When it generates COFF or ELF output,
@end ifset
@command{@value{AS}} can also generate whatever other named sections you specify
using the @samp{.section} directive (@pxref{Section,,@code{.section}}).
If you do not use any directives that place output in the @samp{.text}
or @samp{.data} sections, these sections still exist, but are empty.
@end ifset
@ifset HPPA
@ifset GENERIC
When @command{@value{AS}} generates SOM or ELF output for the HPPA,
@end ifset
@command{@value{AS}} can also generate whatever other named sections you
specify using the @samp{.space} and @samp{.subspace} directives. See
@cite{HP9000 Series 800 Assembly Language Reference Manual}
(HP 92432-90001) for details on the @samp{.space} and @samp{.subspace}
assembler directives.
@ifset SOM
Additionally, @command{@value{AS}} uses different names for the standard
text, data, and bss sections when generating SOM output. Program text
is placed into the @samp{$CODE$} section, data into @samp{$DATA$}, and
BSS into @samp{$BSS$}.
@end ifset
@end ifset
Within the object file, the text section starts at address @code{0}, the
data section follows, and the bss section follows the data section.
@ifset HPPA
When generating either SOM or ELF output files on the HPPA, the text
section starts at address @code{0}, the data section at address
@code{0x4000000}, and the bss section follows the data section.
@end ifset
To let @code{@value{LD}} know which data changes when the sections are
relocated, and how to change that data, @command{@value{AS}} also writes to the
object file details of the relocation needed. To perform relocation
@code{@value{LD}} must know, each time an address in the object
file is mentioned:
@itemize @bullet
@item
Where in the object file is the beginning of this reference to
an address?
@item
How long (in bytes) is this reference?
@item
Which section does the address refer to? What is the numeric value of
@display
(@var{address}) @minus{} (@var{start-address of section})?
@end display
@item
Is the reference to an address ``Program-Counter relative''?
@end itemize
@cindex addresses, format of
@cindex section-relative addressing
In fact, every address @command{@value{AS}} ever uses is expressed as
@display
(@var{section}) + (@var{offset into section})
@end display
@noindent
Further, most expressions @command{@value{AS}} computes have this section-relative
nature.
@ifset SOM
(For some object formats, such as SOM for the HPPA, some expressions are
symbol-relative instead.)
@end ifset
In this manual we use the notation @{@var{secname} @var{N}@} to mean ``offset
@var{N} into section @var{secname}.''
Apart from text, data and bss sections you need to know about the
@dfn{absolute} section. When @code{@value{LD}} mixes partial programs,
addresses in the absolute section remain unchanged. For example, address
@code{@{absolute 0@}} is ``relocated'' to run-time address 0 by
@code{@value{LD}}. Although the linker never arranges two partial programs'
data sections with overlapping addresses after linking, @emph{by definition}
their absolute sections must overlap. Address @code{@{absolute@ 239@}} in one
part of a program is always the same address when the program is running as
address @code{@{absolute@ 239@}} in any other part of the program.
The idea of sections is extended to the @dfn{undefined} section. Any
address whose section is unknown at assembly time is by definition
rendered @{undefined @var{U}@}---where @var{U} is filled in later.
Since numbers are always defined, the only way to generate an undefined
address is to mention an undefined symbol. A reference to a named
common block would be such a symbol: its value is unknown at assembly
time so it has section @emph{undefined}.
By analogy the word @emph{section} is used to describe groups of sections in
the linked program. @code{@value{LD}} puts all partial programs' text
sections in contiguous addresses in the linked program. It is
customary to refer to the @emph{text section} of a program, meaning all
the addresses of all partial programs' text sections. Likewise for
data and bss sections.
Some sections are manipulated by @code{@value{LD}}; others are invented for
use of @command{@value{AS}} and have no meaning except during assembly.
@node Ld Sections
@section Linker Sections
@code{@value{LD}} deals with just four kinds of sections, summarized below.
@table @strong
@ifset COFF-ELF
@cindex named sections
@cindex sections, named
@item named sections
@end ifset
@ifset aout-bout
@cindex text section
@cindex data section
@itemx text section
@itemx data section
@end ifset
These sections hold your program. @command{@value{AS}} and @code{@value{LD}} treat them as
separate but equal sections. Anything you can say of one section is
true of another.
@c @ifset aout-bout
When the program is running, however, it is
customary for the text section to be unalterable. The
text section is often shared among processes: it contains
instructions, constants and the like. The data section of a running
program is usually alterable: for example, C variables would be stored
in the data section.
@c @end ifset
@cindex bss section
@item bss section
This section contains zeroed bytes when your program begins running. It
is used to hold uninitialized variables or common storage. The length of
each partial program's bss section is important, but because it starts
out containing zeroed bytes there is no need to store explicit zero
bytes in the object file. The bss section was invented to eliminate
those explicit zeros from object files.
@cindex absolute section
@item absolute section
Address 0 of this section is always ``relocated'' to runtime address 0.
This is useful if you want to refer to an address that @code{@value{LD}} must
not change when relocating. In this sense we speak of absolute
addresses being ``unrelocatable'': they do not change during relocation.
@cindex undefined section
@item undefined section
This ``section'' is a catch-all for address references to objects not in
the preceding sections.
@c FIXME: ref to some other doc on obj-file formats could go here.
@end table
@cindex relocation example
An idealized example of three relocatable sections follows.
@ifset COFF-ELF
The example uses the traditional section names @samp{.text} and @samp{.data}.
@end ifset
Memory addresses are on the horizontal axis.
@c TEXI2ROFF-KILL
@ifnottex
@c END TEXI2ROFF-KILL
@smallexample
+-----+----+--+
partial program # 1: |ttttt|dddd|00|
+-----+----+--+
text data bss
seg. seg. seg.
+---+---+---+
partial program # 2: |TTT|DDD|000|
+---+---+---+
+--+---+-----+--+----+---+-----+~~
linked program: | |TTT|ttttt| |dddd|DDD|00000|
+--+---+-----+--+----+---+-----+~~
addresses: 0 @dots{}
@end smallexample
@c TEXI2ROFF-KILL
@end ifnottex
@need 5000
@tex
\bigskip
\line{\it Partial program \#1: \hfil}
\line{\ibox{2.5cm}{\tt text}\ibox{2cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
\line{\boxit{2.5cm}{\tt ttttt}\boxit{2cm}{\tt dddd}\boxit{1cm}{\tt 00}\hfil}
\line{\it Partial program \#2: \hfil}
\line{\ibox{1cm}{\tt text}\ibox{1.5cm}{\tt data}\ibox{1cm}{\tt bss}\hfil}
\line{\boxit{1cm}{\tt TTT}\boxit{1.5cm}{\tt DDDD}\boxit{1cm}{\tt 000}\hfil}
\line{\it linked program: \hfil}
\line{\ibox{.5cm}{}\ibox{1cm}{\tt text}\ibox{2.5cm}{}\ibox{.75cm}{}\ibox{2cm}{\tt data}\ibox{1.5cm}{}\ibox{2cm}{\tt bss}\hfil}
\line{\boxit{.5cm}{}\boxit{1cm}{\tt TTT}\boxit{2.5cm}{\tt
ttttt}\boxit{.75cm}{}\boxit{2cm}{\tt dddd}\boxit{1.5cm}{\tt
DDDD}\boxit{2cm}{\tt 00000}\ \dots\hfil}
\line{\it addresses: \hfil}
\line{0\dots\hfil}
@end tex
@c END TEXI2ROFF-KILL
@node As Sections
@section Assembler Internal Sections
@cindex internal assembler sections
@cindex sections in messages, internal
These sections are meant only for the internal use of @command{@value{AS}}. They
have no meaning at run-time. You do not really need to know about these
sections for most purposes; but they can be mentioned in @command{@value{AS}}
warning messages, so it might be helpful to have an idea of their
meanings to @command{@value{AS}}. These sections are used to permit the
value of every expression in your assembly language program to be a
section-relative address.
@table @b
@cindex assembler internal logic error
@item ASSEMBLER-INTERNAL-LOGIC-ERROR!
An internal assembler logic error has been found. This means there is a
bug in the assembler.
@cindex expr (internal section)
@item expr section
The assembler stores complex expression internally as combinations of
symbols. When it needs to represent an expression as a symbol, it puts
it in the expr section.
@c FIXME item debug
@c FIXME item transfer[t] vector preload
@c FIXME item transfer[t] vector postload
@c FIXME item register
@end table
@node Sub-Sections
@section Sub-Sections
@cindex numbered subsections
@cindex grouping data
@ifset aout-bout
Assembled bytes
@ifset COFF-ELF
conventionally
@end ifset
fall into two sections: text and data.
@end ifset
You may have separate groups of
@ifset GENERIC
data in named sections
@end ifset
@ifclear GENERIC
@ifclear aout-bout
data in named sections
@end ifclear
@ifset aout-bout
text or data
@end ifset
@end ifclear
that you want to end up near to each other in the object file, even though they
are not contiguous in the assembler source. @command{@value{AS}} allows you to
use @dfn{subsections} for this purpose. Within each section, there can be
numbered subsections with values from 0 to 8192. Objects assembled into the
same subsection go into the object file together with other objects in the same
subsection. For example, a compiler might want to store constants in the text
section, but might not want to have them interspersed with the program being
assembled. In this case, the compiler could issue a @samp{.text 0} before each
section of code being output, and a @samp{.text 1} before each group of
constants being output.
Subsections are optional. If you do not use subsections, everything
goes in subsection number zero.
@ifset GENERIC
Each subsection is zero-padded up to a multiple of four bytes.
(Subsections may be padded a different amount on different flavors
of @command{@value{AS}}.)
@end ifset
@ifclear GENERIC
@ifset H8
On the H8/300 platform, each subsection is zero-padded to a word
boundary (two bytes).
The same is true on the Renesas SH.
@end ifset
@ifset I960
@c FIXME section padding (alignment)?
@c Rich Pixley says padding here depends on target obj code format; that
@c doesn't seem particularly useful to say without further elaboration,
@c so for now I say nothing about it. If this is a generic BFD issue,
@c these paragraphs might need to vanish from this manual, and be
@c discussed in BFD chapter of binutils (or some such).
@end ifset
@end ifclear
Subsections appear in your object file in numeric order, lowest numbered
to highest. (All this to be compatible with other people's assemblers.)
The object file contains no representation of subsections; @code{@value{LD}} and
other programs that manipulate object files see no trace of them.
They just see all your text subsections as a text section, and all your
data subsections as a data section.
To specify which subsection you want subsequent statements assembled
into, use a numeric argument to specify it, in a @samp{.text
@var{expression}} or a @samp{.data @var{expression}} statement.
@ifset COFF
@ifset GENERIC
When generating COFF output, you
@end ifset
@ifclear GENERIC
You
@end ifclear
can also use an extra subsection
argument with arbitrary named sections: @samp{.section @var{name},
@var{expression}}.
@end ifset
@ifset ELF
@ifset GENERIC
When generating ELF output, you
@end ifset
@ifclear GENERIC
You
@end ifclear
can also use the @code{.subsection} directive (@pxref{SubSection})
to specify a subsection: @samp{.subsection @var{expression}}.
@end ifset
@var{Expression} should be an absolute expression
(@pxref{Expressions}). If you just say @samp{.text} then @samp{.text 0}
is assumed. Likewise @samp{.data} means @samp{.data 0}. Assembly
begins in @code{text 0}. For instance:
@smallexample
.text 0 # The default subsection is text 0 anyway.
.ascii "This lives in the first text subsection. *"
.text 1
.ascii "But this lives in the second text subsection."
.data 0
.ascii "This lives in the data section,"
.ascii "in the first data subsection."
.text 0
.ascii "This lives in the first text section,"
.ascii "immediately following the asterisk (*)."
@end smallexample
Each section has a @dfn{location counter} incremented by one for every byte
assembled into that section. Because subsections are merely a convenience
restricted to @command{@value{AS}} there is no concept of a subsection location
counter. There is no way to directly manipulate a location counter---but the
@code{.align} directive changes it, and any label definition captures its
current value. The location counter of the section where statements are being
assembled is said to be the @dfn{active} location counter.
@node bss
@section bss Section
@cindex bss section
@cindex common variable storage
The bss section is used for local common variable storage.
You may allocate address space in the bss section, but you may
not dictate data to load into it before your program executes. When
your program starts running, all the contents of the bss
section are zeroed bytes.
The @code{.lcomm} pseudo-op defines a symbol in the bss section; see
@ref{Lcomm,,@code{.lcomm}}.
The @code{.comm} pseudo-op may be used to declare a common symbol, which is
another form of uninitialized symbol; see @ref{Comm,,@code{.comm}}.
@ifset GENERIC
When assembling for a target which supports multiple sections, such as ELF or
COFF, you may switch into the @code{.bss} section and define symbols as usual;
see @ref{Section,,@code{.section}}. You may only assemble zero values into the
section. Typically the section will only contain symbol definitions and
@code{.skip} directives (@pxref{Skip,,@code{.skip}}).
@end ifset
@node Symbols
@chapter Symbols
@cindex symbols
Symbols are a central concept: the programmer uses symbols to name
things, the linker uses symbols to link, and the debugger uses symbols
to debug.
@quotation
@cindex debuggers, and symbol order
@emph{Warning:} @command{@value{AS}} does not place symbols in the object file in
the same order they were declared. This may break some debuggers.
@end quotation
@menu
* Labels:: Labels
* Setting Symbols:: Giving Symbols Other Values
* Symbol Names:: Symbol Names
* Dot:: The Special Dot Symbol
* Symbol Attributes:: Symbol Attributes
@end menu
@node Labels
@section Labels
@cindex labels
A @dfn{label} is written as a symbol immediately followed by a colon
@samp{:}. The symbol then represents the current value of the
active location counter, and is, for example, a suitable instruction
operand. You are warned if you use the same symbol to represent two
different locations: the first definition overrides any other
definitions.
@ifset HPPA
On the HPPA, the usual form for a label need not be immediately followed by a
colon, but instead must start in column zero. Only one label may be defined on
a single line. To work around this, the HPPA version of @command{@value{AS}} also
provides a special directive @code{.label} for defining labels more flexibly.
@end ifset
@node Setting Symbols
@section Giving Symbols Other Values
@cindex assigning values to symbols
@cindex symbol values, assigning
A symbol can be given an arbitrary value by writing a symbol, followed
by an equals sign @samp{=}, followed by an expression
(@pxref{Expressions}). This is equivalent to using the @code{.set}
directive. @xref{Set,,@code{.set}}. In the same way, using a double
equals sign @samp{=}@samp{=} here represents an equivalent of the
@code{.eqv} directive. @xref{Eqv,,@code{.eqv}}.
@ifset Blackfin
Blackfin does not support symbol assignment with @samp{=}.
@end ifset
@node Symbol Names
@section Symbol Names
@cindex symbol names
@cindex names, symbol
@ifclear SPECIAL-SYMS
Symbol names begin with a letter or with one of @samp{._}. On most
machines, you can also use @code{$} in symbol names; exceptions are
noted in @ref{Machine Dependencies}. That character may be followed by any
string of digits, letters, dollar signs (unless otherwise noted for a