📄 as.html
字号:
The m68k MRI assembler supports common sections which are merged by the linker.Other object file formats do not support this. <CODE>as</CODE> handlescommon sections by treating them as a single common symbol. It permits localsymbols to be defined within a common section, but it can not support globalsymbols, since it has no way to describe them.<LI>complex relocationsThe MRI assemblers support relocations against a negated section address, andrelocations which combine the start addresses of two or more sections. Theseare not support by other object file formats.<LI><CODE>END</CODE> pseudo-op specifying start addressThe MRI <CODE>END</CODE> pseudo-op permits the specification of a start address.This is not supported by other object file formats. The start address mayinstead be specified using the <CODE>-e</CODE> option to the linker, or in a linkerscript.<LI><CODE>IDNT</CODE>, <CODE>.ident</CODE> and <CODE>NAME</CODE> pseudo-opsThe MRI <CODE>IDNT</CODE>, <CODE>.ident</CODE> and <CODE>NAME</CODE> pseudo-ops assign a modulename to the output file. This is not supported by other object file formats.<LI><CODE>ORG</CODE> pseudo-opThe m68k MRI <CODE>ORG</CODE> pseudo-op begins an absolute section at a givenaddress. This differs from the usual <CODE>as</CODE> <CODE>.org</CODE> pseudo-op,which changes the location within the current section. Absolute sections arenot supported by other object file formats. The address of a section may beassigned within a linker script.</UL><P>There are some other features of the MRI assembler which are not supported by<CODE>as</CODE>, typically either because they are difficult or because theyseem of little consequence. Some of these may be supported in future releases.</P><UL><LI>EBCDIC stringsEBCDIC strings are not supported.<LI>packed binary coded decimalPacked binary coded decimal is not supported. This means that the <CODE>DC.P</CODE>and <CODE>DCB.P</CODE> pseudo-ops are not supported.<LI><CODE>FEQU</CODE> pseudo-opThe m68k <CODE>FEQU</CODE> pseudo-op is not supported.<LI><CODE>NOOBJ</CODE> pseudo-opThe m68k <CODE>NOOBJ</CODE> pseudo-op is not supported.<LI><CODE>OPT</CODE> branch control optionsThe m68k <CODE>OPT</CODE> branch control options---<CODE>B</CODE>, <CODE>BRS</CODE>, <CODE>BRB</CODE>,<CODE>BRL</CODE>, and <CODE>BRW</CODE>---are ignored. <CODE>as</CODE> automaticallyrelaxes all branches, whether forward or backward, to an appropriate size, sothese options serve no purpose.<LI><CODE>OPT</CODE> list control optionsThe following m68k <CODE>OPT</CODE> list control options are ignored: <CODE>C</CODE>,<CODE>CEX</CODE>, <CODE>CL</CODE>, <CODE>CRE</CODE>, <CODE>E</CODE>, <CODE>G</CODE>, <CODE>I</CODE>, <CODE>M</CODE>,<CODE>MEX</CODE>, <CODE>MC</CODE>, <CODE>MD</CODE>, <CODE>X</CODE>.<LI>other <CODE>OPT</CODE> optionsThe following m68k <CODE>OPT</CODE> options are ignored: <CODE>NEST</CODE>, <CODE>O</CODE>,<CODE>OLD</CODE>, <CODE>OP</CODE>, <CODE>P</CODE>, <CODE>PCO</CODE>, <CODE>PCR</CODE>, <CODE>PCS</CODE>, <CODE>R</CODE>.<LI><CODE>OPT</CODE> <CODE>D</CODE> option is defaultThe m68k <CODE>OPT</CODE> <CODE>D</CODE> option is the default, unlike the MRI assembler.<CODE>OPT NOD</CODE> may be used to turn it off.<LI><CODE>XREF</CODE> pseudo-op.The m68k <CODE>XREF</CODE> pseudo-op is ignored.<LI><CODE>.debug</CODE> pseudo-opThe i960 <CODE>.debug</CODE> pseudo-op is not supported.<LI><CODE>.extended</CODE> pseudo-opThe i960 <CODE>.extended</CODE> pseudo-op is not supported.<LI><CODE>.list</CODE> pseudo-op.The various options of the i960 <CODE>.list</CODE> pseudo-op are not supported.<LI><CODE>.optimize</CODE> pseudo-opThe i960 <CODE>.optimize</CODE> pseudo-op is not supported.<LI><CODE>.output</CODE> pseudo-opThe i960 <CODE>.output</CODE> pseudo-op is not supported.<LI><CODE>.setreal</CODE> pseudo-opThe i960 <CODE>.setreal</CODE> pseudo-op is not supported.</UL><H2><A NAME="SEC17" HREF="as_toc.html#TOC17">Name the Object File: <CODE>-o</CODE></A></H2><P><A NAME="IDX59"></A><A NAME="IDX60"></A><A NAME="IDX61"></A>There is always one object file output when you run <CODE>as</CODE>. Bydefault it has the name<TT>`a.out'</TT> (or <TT>`b.out'</TT>, for Intel 960 targets only).You use this option (which takes exactly one filename) to give theobject file a different name.</P><P>Whatever the object file is called, <CODE>as</CODE> overwrites anyexisting file of the same name.</P><H2><A NAME="SEC18" HREF="as_toc.html#TOC18">Join Data and Text Sections: <CODE>-R</CODE></A></H2><P><A NAME="IDX62"></A><A NAME="IDX63"></A><A NAME="IDX64"></A><A NAME="IDX65"></A><A NAME="IDX66"></A><CODE>-R</CODE> tells <CODE>as</CODE> to write the object file as if alldata-section data lives in the text section. This is only done atthe very last moment: your binary data are the same, but datasection parts are relocated differently. The data section part ofyour object file is zero bytes long because all its bytes areappended to the text section. (See section <A HREF="as.html#SEC37">Sections and Relocation</A>.)</P><P>When you specify <CODE>-R</CODE> it would be possible to generate shorteraddress displacements (because we do not have to cross between text anddata section). We refrain from doing this simply for compatibility witholder versions of <CODE>as</CODE>. In future, <CODE>-R</CODE> may work this way.</P><P>When <CODE>as</CODE> is configured for COFF output,this option is only useful if you use sections named <SAMP>`.text'</SAMP> and<SAMP>`.data'</SAMP>.</P><P><CODE>-R</CODE> is not supported for any of the HPPA targets. Using<CODE>-R</CODE> generates a warning from <CODE>as</CODE>.</P><H2><A NAME="SEC19" HREF="as_toc.html#TOC19">Display Assembly Statistics: <CODE>--statistics</CODE></A></H2><P><A NAME="IDX67"></A><A NAME="IDX68"></A><A NAME="IDX69"></A><A NAME="IDX70"></A>Use <SAMP>`--statistics'</SAMP> to display two statistics about the resources used by<CODE>as</CODE>: the maximum amount of space allocated during the assembly(in bytes), and the total execution time taken for the assembly (in CPUseconds).</P><H2><A NAME="SEC20" HREF="as_toc.html#TOC20">Announce Version: <CODE>-v</CODE></A></H2><P><A NAME="IDX71"></A><A NAME="IDX72"></A><A NAME="IDX73"></A><A NAME="IDX74"></A>You can find out what version of as is running by including theoption <SAMP>`-v'</SAMP> (which you can also spell as <SAMP>`-version'</SAMP>) on thecommand line.</P><H2><A NAME="SEC21" HREF="as_toc.html#TOC21">Suppress Warnings: <CODE>-W</CODE></A></H2><P><A NAME="IDX75"></A><A NAME="IDX76"></A><A NAME="IDX77"></A><CODE>as</CODE> should never give a warning or error message whenassembling compiler output. But programs written by people oftencause <CODE>as</CODE> to give a warning that a particular assumption wasmade. All such warnings are directed to the standard error file.If you use this option, no warnings are issued. This option onlyaffects the warning messages: it does not change any particular of how<CODE>as</CODE> assembles your file. Errors, which stop the assembly, arestill reported.</P><H2><A NAME="SEC22" HREF="as_toc.html#TOC22">Generate Object File in Spite of Errors: <CODE>-Z</CODE></A></H2><P><A NAME="IDX78"></A><A NAME="IDX79"></A>After an error message, <CODE>as</CODE> normally produces no output. If forsome reason you are interested in object file output even after<CODE>as</CODE> gives an error message on your program, use the <SAMP>`-Z'</SAMP>option. If there are any errors, <CODE>as</CODE> continues anyways, andwrites an object file after a final warning message of the form <SAMP>`<VAR>n</VAR>errors, <VAR>m</VAR> warnings, generating bad object file.'</SAMP></P><H1><A NAME="SEC23" HREF="as_toc.html#TOC23">Syntax</A></H1><P><A NAME="IDX80"></A><A NAME="IDX81"></A>This chapter describes the machine-independent syntax allowed in asource file. <CODE>as</CODE> syntax is similar to what many otherassemblers use; it is inspired by the BSD 4.2assembler.</P><H2><A NAME="SEC24" HREF="as_toc.html#TOC24">Preprocessing</A></H2><P><A NAME="IDX82"></A>The <CODE>as</CODE> internal preprocessor:<UL><LI><A NAME="IDX83"></A> adjusts and removes extra whitespace. It leaves one space or tab beforethe keywords on a line, and turns any other whitespace on the line intoa single space.<A NAME="IDX84"></A><LI>removes all comments, replacing them with a single space, or anappropriate number of newlines.<A NAME="IDX85"></A><LI>converts character constants into the appropriate numeric values.</UL><P>It does not do macro processing, include file handling, oranything else you may get from your C compiler's preprocessor. You cando include file processing with the <CODE>.include</CODE> directive(see section <A HREF="as.html#SEC93"><CODE>.include "<VAR>file</CODE>"</VAR></A>). You can use the GNU C compiler driverto get other "CPP" style preprocessing, by giving the input file a<SAMP>`.S'</SAMP> suffix. See section `Options Controlling the Kind of Output' in <CITE>Using GNU CC</CITE>.</P><P>Excess whitespace, comments, and character constantscannot be used in the portions of the input text that are notpreprocessed.</P><P><A NAME="IDX86"></A><A NAME="IDX87"></A><A NAME="IDX88"></A><A NAME="IDX89"></A>If the first line of an input file is <CODE>#NO_APP</CODE> or if you use the<SAMP>`-f'</SAMP> option, whitespace and comments are not removed from the input file.Within an input file, you can ask for whitespace and comment removal inspecific portions of the by putting a line that says <CODE>#APP</CODE> before thetext that may contain whitespace or comments, and putting a line that says<CODE>#NO_APP</CODE> after this text. This feature is mainly intend to support<CODE>asm</CODE> statements in compilers whose output is otherwise free of commentsand whitespace.</P><H2><A NAME="SEC25" HREF="as_toc.html#TOC25">Whitespace</A></H2><P><A NAME="IDX90"></A><EM>Whitespace</EM> is one or more blanks or tabs, in any order.Whitespace is used to separate symbols, and to make programs neater forpeople to read. Unless within character constants(see section <A HREF="as.html#SEC30">Character Constants</A>), any whitespace means the sameas exactly one space.</P><H2><A NAME="SEC26" HREF="as_toc.html#TOC26">Comments</A></H2><P><A NAME="IDX91"></A>There are two ways of rendering comments to <CODE>as</CODE>. In bothcases the comment is equivalent to one space.</P><P>Anything from <SAMP>`/*'</SAMP> through the next <SAMP>`*/'</SAMP> is a comment.This means you may not nest these comments.</P><PRE>/* 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. */</PRE><P><A NAME="IDX92"></A>Anything from the <EM>line comment</EM> character to the next newlineis considered a comment and is ignored. The line comment character is<SAMP>`#'</SAMP> on the i960;<SAMP>`!'</SAMP> on the SPARC;<SAMP>`;'</SAMP> for the HPPA;<SAMP>`!'</SAMP> for the Z8000;see section <A HREF="as.html#SEC128">Machine Dependent Features</A>. </P><P>On some machines there are two different line comment characters. Onecharacter only begins a comment if it is the first non-whitespace character ona line, while the other always begins a comment.</P><P><A NAME="IDX93"></A><A NAME="IDX94"></A><A NAME="IDX95"></A>To be compatible with past assemblers, lines that begin with <SAMP>`#'</SAMP> have aspecial interpretation. Following the <SAMP>`#'</SAMP> should be an absoluteexpression (see section <A HREF="as.html#SEC58">Expressions</A>): the logical line number of the <EM>next</EM>line. Then a string (see section <A HREF="as.html#SEC31">Strings</A>) is allowed: if present it is anew logical file name. The rest of the line, if any, should be whitespace.</P><P>If the first non-whitespace characters on the line are not numeric,the line is ignored. (Just like a comment.)</P><PRE> # This is an ordinary comment.# 42-6 "new_file_name" # New logical file name # This is logical line # 36.</PRE><P>This feature is deprecated, and may disappear from future versionsof <CODE>as</CODE>.</P><H2><A NAME="SEC27" HREF="as_toc.html#TOC27">Symbols</A></H2><P><A NAME="IDX96"></A>A <EM>symbol</EM> is one or more characters chosen from the set of allletters (both upper and lower case), digits and the three characters<SAMP>`_.$'</SAMP>.On most machines, you can also use <CODE>$</CODE> in symbol names; exceptionsare noted in section <A HREF="as.html#SEC128">Machine Dependent Features</A>.No symbol may begin with a digit. Case is significant.There is no length limit: all characters are significant. Symbols aredelimited 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 isnot a possible symbol delimiter). See section <A HREF="as.html#SEC43">Symbols</A>.<A NAME="IDX97"></A></P><H2><A NAME="SEC28" HREF="as_toc.html#TOC28">Statements</A></H2><P><A NAME="IDX98"></A><A NAME="IDX99"></A><A NAME="IDX100"></A>A <EM>statement</EM> ends at a newline character (<SAMP>`\n'</SAMP>) or an exclamation point (<SAMP>`!'</SAMP>). The newline or exclamation point is considered part of thepreceding statement. Newlines and exclamation points within character
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -