1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<!-- This file documents the GNU Assembler "as". 4 5Copyright (C) 1991-2021 Free Software Foundation, Inc. 6 7Permission is granted to copy, distribute and/or modify this document 8under the terms of the GNU Free Documentation License, Version 1.3 9or any later version published by the Free Software Foundation; 10with no Invariant Sections, with no Front-Cover Texts, and with no 11Back-Cover Texts. A copy of the license is included in the 12section entitled "GNU Free Documentation License". 13 --> 14<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ --> 15<head> 16<title>Using as: Invoking</title> 17 18<meta name="description" content="Using as: Invoking"> 19<meta name="keywords" content="Using as: Invoking"> 20<meta name="resource-type" content="document"> 21<meta name="distribution" content="global"> 22<meta name="Generator" content="makeinfo"> 23<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 24<link href="index.html#Top" rel="start" title="Top"> 25<link href="AS-Index.html#AS-Index" rel="index" title="AS Index"> 26<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> 27<link href="index.html#Top" rel="up" title="Top"> 28<link href="a.html#a" rel="next" title="a"> 29<link href="Errors.html#Errors" rel="previous" title="Errors"> 30<style type="text/css"> 31<!-- 32a.summary-letter {text-decoration: none} 33blockquote.smallquotation {font-size: smaller} 34div.display {margin-left: 3.2em} 35div.example {margin-left: 3.2em} 36div.indentedblock {margin-left: 3.2em} 37div.lisp {margin-left: 3.2em} 38div.smalldisplay {margin-left: 3.2em} 39div.smallexample {margin-left: 3.2em} 40div.smallindentedblock {margin-left: 3.2em; font-size: smaller} 41div.smalllisp {margin-left: 3.2em} 42kbd {font-style:oblique} 43pre.display {font-family: inherit} 44pre.format {font-family: inherit} 45pre.menu-comment {font-family: serif} 46pre.menu-preformatted {font-family: serif} 47pre.smalldisplay {font-family: inherit; font-size: smaller} 48pre.smallexample {font-size: smaller} 49pre.smallformat {font-family: inherit; font-size: smaller} 50pre.smalllisp {font-size: smaller} 51span.nocodebreak {white-space:nowrap} 52span.nolinebreak {white-space:nowrap} 53span.roman {font-family:serif; font-weight:normal} 54span.sansserif {font-family:sans-serif; font-weight:normal} 55ul.no-bullet {list-style: none} 56--> 57</style> 58 59 60</head> 61 62<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> 63<a name="Invoking"></a> 64<div class="header"> 65<p> 66Next: <a href="Syntax.html#Syntax" accesskey="n" rel="next">Syntax</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="previous">Overview</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p> 67</div> 68<hr> 69<a name="Command_002dLine-Options"></a> 70<h2 class="chapter">2 Command-Line Options</h2> 71 72<a name="index-options_002c-all-versions-of-assembler"></a> 73<p>This chapter describes command-line options available in <em>all</em> 74versions of the <small>GNU</small> assembler; see <a href="Machine-Dependencies.html#Machine-Dependencies">Machine Dependencies</a>, 75for options specific 76to particular machine architectures. 77</p> 78 79<p>If you are invoking <code>as</code> via the <small>GNU</small> C compiler, 80you can use the ‘<samp>-Wa</samp>’ option to pass arguments through to the assembler. 81The assembler arguments must be separated from each other (and the ‘<samp>-Wa</samp>’) 82by commas. For example: 83</p> 84<div class="smallexample"> 85<pre class="smallexample">gcc -c -g -O -Wa,-alh,-L file.c 86</pre></div> 87 88<p>This passes two options to the assembler: ‘<samp>-alh</samp>’ (emit a listing to 89standard output with high-level and assembly source) and ‘<samp>-L</samp>’ (retain 90local symbols in the symbol table). 91</p> 92<p>Usually you do not need to use this ‘<samp>-Wa</samp>’ mechanism, since many compiler 93command-line options are automatically passed to the assembler by the compiler. 94(You can call the <small>GNU</small> compiler driver with the ‘<samp>-v</samp>’ option to see 95precisely what options it passes to each compilation pass, including the 96assembler.) 97</p> 98 99<table class="menu" border="0" cellspacing="0"> 100<tr><td align="left" valign="top">• <a href="a.html#a" accesskey="1">a</a>:</td><td> </td><td align="left" valign="top">-a[cdghlns] enable listings 101</td></tr> 102<tr><td align="left" valign="top">• <a href="alternate.html#alternate" accesskey="2">alternate</a>:</td><td> </td><td align="left" valign="top">–alternate enable alternate macro syntax 103</td></tr> 104<tr><td align="left" valign="top">• <a href="D.html#D" accesskey="3">D</a>:</td><td> </td><td align="left" valign="top">-D for compatibility 105</td></tr> 106<tr><td align="left" valign="top">• <a href="f.html#f" accesskey="4">f</a>:</td><td> </td><td align="left" valign="top">-f to work faster 107</td></tr> 108<tr><td align="left" valign="top">• <a href="I.html#I" accesskey="5">I</a>:</td><td> </td><td align="left" valign="top">-I for .include search path 109</td></tr> 110<tr><td align="left" valign="top">• <a href="K.html#K" accesskey="6">K</a>:</td><td> </td><td align="left" valign="top">-K for difference tables 111</td></tr> 112<tr><th colspan="3" align="left" valign="top"><pre class="menu-comment"> 113</pre></th></tr><tr><td align="left" valign="top">• <a href="L.html#L" accesskey="7">L</a>:</td><td> </td><td align="left" valign="top">-L to retain local symbols 114</td></tr> 115<tr><td align="left" valign="top">• <a href="listing.html#listing" accesskey="8">listing</a>:</td><td> </td><td align="left" valign="top">–listing-XXX to configure listing output 116</td></tr> 117<tr><td align="left" valign="top">• <a href="M.html#M" accesskey="9">M</a>:</td><td> </td><td align="left" valign="top">-M or –mri to assemble in MRI compatibility mode 118</td></tr> 119<tr><td align="left" valign="top">• <a href="MD.html#MD">MD</a>:</td><td> </td><td align="left" valign="top">–MD for dependency tracking 120</td></tr> 121<tr><td align="left" valign="top">• <a href="no_002dpad_002dsections.html#no_002dpad_002dsections">no-pad-sections</a>:</td><td> </td><td align="left" valign="top">–no-pad-sections to stop section padding 122</td></tr> 123<tr><td align="left" valign="top">• <a href="o.html#o">o</a>:</td><td> </td><td align="left" valign="top">-o to name the object file 124</td></tr> 125<tr><td align="left" valign="top">• <a href="R.html#R">R</a>:</td><td> </td><td align="left" valign="top">-R to join data and text sections 126</td></tr> 127<tr><td align="left" valign="top">• <a href="statistics.html#statistics">statistics</a>:</td><td> </td><td align="left" valign="top">–statistics to see statistics about assembly 128</td></tr> 129<tr><td align="left" valign="top">• <a href="traditional_002dformat.html#traditional_002dformat">traditional-format</a>:</td><td> </td><td align="left" valign="top">–traditional-format for compatible output 130</td></tr> 131<tr><td align="left" valign="top">• <a href="v.html#v">v</a>:</td><td> </td><td align="left" valign="top">-v to announce version 132</td></tr> 133<tr><td align="left" valign="top">• <a href="W.html#W">W</a>:</td><td> </td><td align="left" valign="top">-W, –no-warn, –warn, –fatal-warnings to control warnings 134</td></tr> 135<tr><td align="left" valign="top">• <a href="Z.html#Z">Z</a>:</td><td> </td><td align="left" valign="top">-Z to make object file even after errors 136</td></tr> 137</table> 138 139<hr> 140<div class="header"> 141<p> 142Next: <a href="Syntax.html#Syntax" accesskey="n" rel="next">Syntax</a>, Previous: <a href="Overview.html#Overview" accesskey="p" rel="previous">Overview</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="AS-Index.html#AS-Index" title="Index" rel="index">Index</a>]</p> 143</div> 144 145 146 147</body> 148</html> 149