| 1 | This is as.info, produced by makeinfo version 4.3 from as.texinfo. | 
|---|
| 2 |  | 
|---|
| 3 | START-INFO-DIR-ENTRY | 
|---|
| 4 | * As: (as).                     The GNU assembler. | 
|---|
| 5 | * Gas: (as).                    The GNU assembler. | 
|---|
| 6 | END-INFO-DIR-ENTRY | 
|---|
| 7 |  | 
|---|
| 8 | This file documents the GNU Assembler "as". | 
|---|
| 9 |  | 
|---|
| 10 | Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 | 
|---|
| 11 | Free Software Foundation, Inc. | 
|---|
| 12 |  | 
|---|
| 13 | Permission is granted to copy, distribute and/or modify this document | 
|---|
| 14 | under the terms of the GNU Free Documentation License, Version 1.1 or | 
|---|
| 15 | any later version published by the Free Software Foundation; with no | 
|---|
| 16 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover | 
|---|
| 17 | Texts.  A copy of the license is included in the section entitled "GNU | 
|---|
| 18 | Free Documentation License". | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | File: as.info,  Node: Top,  Next: Overview,  Up: (dir) | 
|---|
| 22 |  | 
|---|
| 23 | Using as | 
|---|
| 24 | ******** | 
|---|
| 25 |  | 
|---|
| 26 | This file is a user guide to the GNU assembler `as' version 2.14. | 
|---|
| 27 |  | 
|---|
| 28 | This document is distributed under the terms of the GNU Free | 
|---|
| 29 | Documentation License.  A copy of the license is included in the | 
|---|
| 30 | section entitled "GNU Free Documentation License". | 
|---|
| 31 |  | 
|---|
| 32 | * Menu: | 
|---|
| 33 |  | 
|---|
| 34 | * Overview::                    Overview | 
|---|
| 35 | * Invoking::                    Command-Line Options | 
|---|
| 36 | * Syntax::                      Syntax | 
|---|
| 37 | * Sections::                    Sections and Relocation | 
|---|
| 38 | * Symbols::                     Symbols | 
|---|
| 39 | * Expressions::                 Expressions | 
|---|
| 40 | * Pseudo Ops::                  Assembler Directives | 
|---|
| 41 | * Machine Dependencies::        Machine Dependent Features | 
|---|
| 42 | * Reporting Bugs::              Reporting Bugs | 
|---|
| 43 | * Acknowledgements::            Who Did What | 
|---|
| 44 | * GNU Free Documentation License::  GNU Free Documentation License | 
|---|
| 45 | * Index::                       Index | 
|---|
| 46 |  | 
|---|
| 47 |  | 
|---|
| 48 | File: as.info,  Node: Overview,  Next: Invoking,  Prev: Top,  Up: Top | 
|---|
| 49 |  | 
|---|
| 50 | Overview | 
|---|
| 51 | ******** | 
|---|
| 52 |  | 
|---|
| 53 | Here is a brief summary of how to invoke `as'.  For details, *note | 
|---|
| 54 | Command-Line Options: Invoking.. | 
|---|
| 55 |  | 
|---|
| 56 | as [-a[cdhlns][=FILE]] [-D] [-defsym SYM=VAL] | 
|---|
| 57 | [-f] [-gstabs] [-gdwarf2] [-help] [-I DIR] | 
|---|
| 58 | [-J] [-K] [-L] | 
|---|
| 59 | [-listing-lhs-width=NUM] [-listing-lhs-width2=NUM] | 
|---|
| 60 | [-listing-rhs-width=NUM] [-listing-cont-lines=NUM] | 
|---|
| 61 | [-keep-locals] [-o OBJFILE] [-R] [-statistics] [-v] | 
|---|
| 62 | [-version] [-version] [-W] [-warn] [-fatal-warnings] | 
|---|
| 63 | [-w] [-x] [-Z] [-target-help] [TARGET-OPTIONS] | 
|---|
| 64 | [-|FILES ...] | 
|---|
| 65 |  | 
|---|
| 66 | _Target Alpha options:_ | 
|---|
| 67 | [-mCPU] | 
|---|
| 68 | [-mdebug | -no-mdebug] | 
|---|
| 69 | [-relax] [-g] [-GSIZE] | 
|---|
| 70 | [-F] [-32addr] | 
|---|
| 71 |  | 
|---|
| 72 | _Target ARC options:_ | 
|---|
| 73 | [-marc[5|6|7|8]] | 
|---|
| 74 | [-EB|-EL] | 
|---|
| 75 |  | 
|---|
| 76 | _Target ARM options:_ | 
|---|
| 77 | [-mcpu=PROCESSOR[+EXTENSION...]] | 
|---|
| 78 | [-march=ARCHITECTURE[+EXTENSION...]] | 
|---|
| 79 | [-mfpu=FLOATING-POINT-FROMAT] | 
|---|
| 80 | [-mthumb] | 
|---|
| 81 | [-EB|-EL] | 
|---|
| 82 | [-mapcs-32|-mapcs-26|-mapcs-float| | 
|---|
| 83 | -mapcs-reentrant] | 
|---|
| 84 | [-mthumb-interwork] [-moabi] [-k] | 
|---|
| 85 |  | 
|---|
| 86 | _Target CRIS options:_ | 
|---|
| 87 | [-underscore | -no-underscore] | 
|---|
| 88 | [-pic] [-N] | 
|---|
| 89 | [-emulation=criself | -emulation=crisaout] | 
|---|
| 90 |  | 
|---|
| 91 | _Target D10V options:_ | 
|---|
| 92 | [-O] | 
|---|
| 93 |  | 
|---|
| 94 | _Target D30V options:_ | 
|---|
| 95 | [-O|-n|-N] | 
|---|
| 96 |  | 
|---|
| 97 | _Target i386 options:_ | 
|---|
| 98 | [-32|-64] | 
|---|
| 99 |  | 
|---|
| 100 | _Target i960 options:_ | 
|---|
| 101 | [-ACA|-ACA_A|-ACB|-ACC|-AKA|-AKB| | 
|---|
| 102 | -AKC|-AMC] | 
|---|
| 103 | [-b] [-no-relax] | 
|---|
| 104 |  | 
|---|
| 105 | _Target IP2K options:_ | 
|---|
| 106 | [-mip2022|-mip2022ext] | 
|---|
| 107 |  | 
|---|
| 108 | _Target M32R options:_ | 
|---|
| 109 | [-m32rx|-[no-]warn-explicit-parallel-conflicts| | 
|---|
| 110 | -W[n]p] | 
|---|
| 111 |  | 
|---|
| 112 | _Target M680X0 options:_ | 
|---|
| 113 | [-l] [-m68000|-m68010|-m68020|...] | 
|---|
| 114 |  | 
|---|
| 115 | _Target M68HC11 options:_ | 
|---|
| 116 | [-m68hc11|-m68hc12|-m68hcs12] | 
|---|
| 117 | [-mshort|-mlong] | 
|---|
| 118 | [-mshort-double|-mlong-double] | 
|---|
| 119 | [-force-long-branchs] [-short-branchs] | 
|---|
| 120 | [-strict-direct-mode] [-print-insn-syntax] | 
|---|
| 121 | [-print-opcodes] [-generate-example] | 
|---|
| 122 |  | 
|---|
| 123 | _Target MCORE options:_ | 
|---|
| 124 | [-jsri2bsr] [-sifilter] [-relax] | 
|---|
| 125 | [-mcpu=[210|340]] | 
|---|
| 126 |  | 
|---|
| 127 | _Target MIPS options:_ | 
|---|
| 128 | [-nocpp] [-EL] [-EB] [-n] [-O[OPTIMIZATION LEVEL]] | 
|---|
| 129 | [-g[DEBUG LEVEL]] [-G NUM] [-KPIC] [-call_shared] | 
|---|
| 130 | [-non_shared] [-xgot] [-membedded-pic] | 
|---|
| 131 | [-mabi=ABI] [-32] [-n32] [-64] [-mfp32] [-mgp32] | 
|---|
| 132 | [-march=CPU] [-mtune=CPU] [-mips1] [-mips2] | 
|---|
| 133 | [-mips3] [-mips4] [-mips5] [-mips32] [-mips32r2] | 
|---|
| 134 | [-mips64] | 
|---|
| 135 | [-construct-floats] [-no-construct-floats] | 
|---|
| 136 | [-trap] [-no-break] [-break] [-no-trap] | 
|---|
| 137 | [-mfix7000] [-mno-fix7000] | 
|---|
| 138 | [-mips16] [-no-mips16] | 
|---|
| 139 | [-mips3d] [-no-mips3d] | 
|---|
| 140 | [-mdmx] [-no-mdmx] | 
|---|
| 141 | [-mdebug] [-no-mdebug] | 
|---|
| 142 |  | 
|---|
| 143 | _Target MMIX options:_ | 
|---|
| 144 | [-fixed-special-register-names] [-globalize-symbols] | 
|---|
| 145 | [-gnu-syntax] [-relax] [-no-predefined-symbols] | 
|---|
| 146 | [-no-expand] [-no-merge-gregs] [-x] | 
|---|
| 147 | [-linker-allocated-gregs] | 
|---|
| 148 |  | 
|---|
| 149 | _Target PDP11 options:_ | 
|---|
| 150 | [-mpic|-mno-pic] [-mall] [-mno-extensions] | 
|---|
| 151 | [-mEXTENSION|-mno-EXTENSION] | 
|---|
| 152 | [-mCPU] [-mMACHINE] | 
|---|
| 153 |  | 
|---|
| 154 | _Target picoJava options:_ | 
|---|
| 155 | [-mb|-me] | 
|---|
| 156 |  | 
|---|
| 157 | _Target PowerPC options:_ | 
|---|
| 158 | [-mpwrx|-mpwr2|-mpwr|-m601|-mppc|-mppc32|-m603|-m604| | 
|---|
| 159 | -m403|-m405|-mppc64|-m620|-mppc64bridge|-mbooke| | 
|---|
| 160 | -mbooke32|-mbooke64] | 
|---|
| 161 | [-mcom|-many|-maltivec] [-memb] | 
|---|
| 162 | [-mregnames|-mno-regnames] | 
|---|
| 163 | [-mrelocatable|-mrelocatable-lib] | 
|---|
| 164 | [-mlittle|-mlittle-endian|-mbig|-mbig-endian] | 
|---|
| 165 | [-msolaris|-mno-solaris] | 
|---|
| 166 |  | 
|---|
| 167 | _Target SPARC options:_ | 
|---|
| 168 | [-Av6|-Av7|-Av8|-Asparclet|-Asparclite | 
|---|
| 169 | -Av8plus|-Av8plusa|-Av9|-Av9a] | 
|---|
| 170 | [-xarch=v8plus|-xarch=v8plusa] [-bump] | 
|---|
| 171 | [-32|-64] | 
|---|
| 172 |  | 
|---|
| 173 | _Target TIC54X options:_ | 
|---|
| 174 | [-mcpu=54[123589]|-mcpu=54[56]lp] [-mfar-mode|-mf] | 
|---|
| 175 | [-merrors-to-file <FILENAME>|-me <FILENAME>] | 
|---|
| 176 |  | 
|---|
| 177 | _Target Xtensa options:_ | 
|---|
| 178 | [-[no-]density] [-[no-]relax] [-[no-]generics] | 
|---|
| 179 | [-[no-]text-section-literals] | 
|---|
| 180 | [-[no-]target-align] [-[no-]longcalls] | 
|---|
| 181 |  | 
|---|
| 182 | `-a[cdhlmns]' | 
|---|
| 183 | Turn on listings, in any of a variety of ways: | 
|---|
| 184 |  | 
|---|
| 185 | `-ac' | 
|---|
| 186 | omit false conditionals | 
|---|
| 187 |  | 
|---|
| 188 | `-ad' | 
|---|
| 189 | omit debugging directives | 
|---|
| 190 |  | 
|---|
| 191 | `-ah' | 
|---|
| 192 | include high-level source | 
|---|
| 193 |  | 
|---|
| 194 | `-al' | 
|---|
| 195 | include assembly | 
|---|
| 196 |  | 
|---|
| 197 | `-am' | 
|---|
| 198 | include macro expansions | 
|---|
| 199 |  | 
|---|
| 200 | `-an' | 
|---|
| 201 | omit forms processing | 
|---|
| 202 |  | 
|---|
| 203 | `-as' | 
|---|
| 204 | include symbols | 
|---|
| 205 |  | 
|---|
| 206 | `=file' | 
|---|
| 207 | set the name of the listing file | 
|---|
| 208 |  | 
|---|
| 209 | You may combine these options; for example, use `-aln' for assembly | 
|---|
| 210 | listing without forms processing.  The `=file' option, if used, | 
|---|
| 211 | must be the last one.  By itself, `-a' defaults to `-ahls'. | 
|---|
| 212 |  | 
|---|
| 213 | `-D' | 
|---|
| 214 | Ignored.  This option is accepted for script compatibility with | 
|---|
| 215 | calls to other assemblers. | 
|---|
| 216 |  | 
|---|
| 217 | `--defsym SYM=VALUE' | 
|---|
| 218 | Define the symbol SYM to be VALUE before assembling the input file. | 
|---|
| 219 | VALUE must be an integer constant.  As in C, a leading `0x' | 
|---|
| 220 | indicates a hexadecimal value, and a leading `0' indicates an | 
|---|
| 221 | octal value. | 
|---|
| 222 |  | 
|---|
| 223 | `-f' | 
|---|
| 224 | "fast"--skip whitespace and comment preprocessing (assume source is | 
|---|
| 225 | compiler output). | 
|---|
| 226 |  | 
|---|
| 227 | `--gstabs' | 
|---|
| 228 | Generate stabs debugging information for each assembler line.  This | 
|---|
| 229 | may help debugging assembler code, if the debugger can handle it. | 
|---|
| 230 |  | 
|---|
| 231 | `--gdwarf2' | 
|---|
| 232 | Generate DWARF2 debugging information for each assembler line. | 
|---|
| 233 | This may help debugging assembler code, if the debugger can handle | 
|---|
| 234 | it.  Note--this option is only supported by some targets, not all | 
|---|
| 235 | of them. | 
|---|
| 236 |  | 
|---|
| 237 | `--help' | 
|---|
| 238 | Print a summary of the command line options and exit. | 
|---|
| 239 |  | 
|---|
| 240 | `--target-help' | 
|---|
| 241 | Print a summary of all target specific options and exit. | 
|---|
| 242 |  | 
|---|
| 243 | `-I DIR' | 
|---|
| 244 | Add directory DIR to the search list for `.include' directives. | 
|---|
| 245 |  | 
|---|
| 246 | `-J' | 
|---|
| 247 | Don't warn about signed overflow. | 
|---|
| 248 |  | 
|---|
| 249 | `-K' | 
|---|
| 250 | Issue warnings when difference tables altered for long | 
|---|
| 251 | displacements. | 
|---|
| 252 |  | 
|---|
| 253 | `-L' | 
|---|
| 254 | `--keep-locals' | 
|---|
| 255 | Keep (in the symbol table) local symbols.  On traditional a.out | 
|---|
| 256 | systems these start with `L', but different systems have different | 
|---|
| 257 | local label prefixes. | 
|---|
| 258 |  | 
|---|
| 259 | `--listing-lhs-width=NUMBER' | 
|---|
| 260 | Set the maximum width, in words, of the output data column for an | 
|---|
| 261 | assembler listing to NUMBER. | 
|---|
| 262 |  | 
|---|
| 263 | `--listing-lhs-width2=NUMBER' | 
|---|
| 264 | Set the maximum width, in words, of the output data column for | 
|---|
| 265 | continuation lines in an assembler listing to NUMBER. | 
|---|
| 266 |  | 
|---|
| 267 | `--listing-rhs-width=NUMBER' | 
|---|
| 268 | Set the maximum width of an input source line, as displayed in a | 
|---|
| 269 | listing, to NUMBER bytes. | 
|---|
| 270 |  | 
|---|
| 271 | `--listing-cont-lines=NUMBER' | 
|---|
| 272 | Set the maximum number of lines printed in a listing for a single | 
|---|
| 273 | line of input to NUMBER + 1. | 
|---|
| 274 |  | 
|---|
| 275 | `-o OBJFILE' | 
|---|
| 276 | Name the object-file output from `as' OBJFILE. | 
|---|
| 277 |  | 
|---|
| 278 | `-R' | 
|---|
| 279 | Fold the data section into the text section. | 
|---|
| 280 |  | 
|---|
| 281 | `--statistics' | 
|---|
| 282 | Print the maximum space (in bytes) and total time (in seconds) | 
|---|
| 283 | used by assembly. | 
|---|
| 284 |  | 
|---|
| 285 | `--strip-local-absolute' | 
|---|
| 286 | Remove local absolute symbols from the outgoing symbol table. | 
|---|
| 287 |  | 
|---|
| 288 | `-v' | 
|---|
| 289 | `-version' | 
|---|
| 290 | Print the `as' version. | 
|---|
| 291 |  | 
|---|
| 292 | `--version' | 
|---|
| 293 | Print the `as' version and exit. | 
|---|
| 294 |  | 
|---|
| 295 | `-W' | 
|---|
| 296 | `--no-warn' | 
|---|
| 297 | Suppress warning messages. | 
|---|
| 298 |  | 
|---|
| 299 | `--fatal-warnings' | 
|---|
| 300 | Treat warnings as errors. | 
|---|
| 301 |  | 
|---|
| 302 | `--warn' | 
|---|
| 303 | Don't suppress warning messages or treat them as errors. | 
|---|
| 304 |  | 
|---|
| 305 | `-w' | 
|---|
| 306 | Ignored. | 
|---|
| 307 |  | 
|---|
| 308 | `-x' | 
|---|
| 309 | Ignored. | 
|---|
| 310 |  | 
|---|
| 311 | `-Z' | 
|---|
| 312 | Generate an object file even after errors. | 
|---|
| 313 |  | 
|---|
| 314 | `-- | FILES ...' | 
|---|
| 315 | Standard input, or source files to assemble. | 
|---|
| 316 |  | 
|---|
| 317 | The following options are available when as is configured for an ARC | 
|---|
| 318 | processor. | 
|---|
| 319 |  | 
|---|
| 320 | `-marc[5|6|7|8]' | 
|---|
| 321 | This option selects the core processor variant. | 
|---|
| 322 |  | 
|---|
| 323 | `-EB | -EL' | 
|---|
| 324 | Select either big-endian (-EB) or little-endian (-EL) output. | 
|---|
| 325 |  | 
|---|
| 326 | The following options are available when as is configured for the ARM | 
|---|
| 327 | processor family. | 
|---|
| 328 |  | 
|---|
| 329 | `-mcpu=PROCESSOR[+EXTENSION...]' | 
|---|
| 330 | Specify which ARM processor variant is the target. | 
|---|
| 331 |  | 
|---|
| 332 | `-march=ARCHITECTURE[+EXTENSION...]' | 
|---|
| 333 | Specify which ARM architecture variant is used by the target. | 
|---|
| 334 |  | 
|---|
| 335 | `-mfpu=FLOATING-POINT-FORMAT' | 
|---|
| 336 | Select which Floating Point architecture is the target. | 
|---|
| 337 |  | 
|---|
| 338 | `-mthumb' | 
|---|
| 339 | Enable Thumb only instruction decoding. | 
|---|
| 340 |  | 
|---|
| 341 | `-mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi' | 
|---|
| 342 | Select which procedure calling convention is in use. | 
|---|
| 343 |  | 
|---|
| 344 | `-EB | -EL' | 
|---|
| 345 | Select either big-endian (-EB) or little-endian (-EL) output. | 
|---|
| 346 |  | 
|---|
| 347 | `-mthumb-interwork' | 
|---|
| 348 | Specify that the code has been generated with interworking between | 
|---|
| 349 | Thumb and ARM code in mind. | 
|---|
| 350 |  | 
|---|
| 351 | `-k' | 
|---|
| 352 | Specify that PIC code has been generated. | 
|---|
| 353 |  | 
|---|
| 354 | See the info pages for documentation of the CRIS-specific options. | 
|---|
| 355 |  | 
|---|
| 356 | The following options are available when as is configured for a D10V | 
|---|
| 357 | processor. | 
|---|
| 358 | `-O' | 
|---|
| 359 | Optimize output by parallelizing instructions. | 
|---|
| 360 |  | 
|---|
| 361 | The following options are available when as is configured for a D30V | 
|---|
| 362 | processor. | 
|---|
| 363 | `-O' | 
|---|
| 364 | Optimize output by parallelizing instructions. | 
|---|
| 365 |  | 
|---|
| 366 | `-n' | 
|---|
| 367 | Warn when nops are generated. | 
|---|
| 368 |  | 
|---|
| 369 | `-N' | 
|---|
| 370 | Warn when a nop after a 32-bit multiply instruction is generated. | 
|---|
| 371 |  | 
|---|
| 372 | The following options are available when as is configured for the | 
|---|
| 373 | Intel 80960 processor. | 
|---|
| 374 |  | 
|---|
| 375 | `-ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC' | 
|---|
| 376 | Specify which variant of the 960 architecture is the target. | 
|---|
| 377 |  | 
|---|
| 378 | `-b' | 
|---|
| 379 | Add code to collect statistics about branches taken. | 
|---|
| 380 |  | 
|---|
| 381 | `-no-relax' | 
|---|
| 382 | Do not alter compare-and-branch instructions for long | 
|---|
| 383 | displacements; error if necessary. | 
|---|
| 384 |  | 
|---|
| 385 | The following options are available when as is configured for the | 
|---|
| 386 | Ubicom IP2K series. | 
|---|
| 387 |  | 
|---|
| 388 | `-mip2022ext' | 
|---|
| 389 | Specifies that the extended IP2022 instructions are allowed. | 
|---|
| 390 |  | 
|---|
| 391 | `-mip2022' | 
|---|
| 392 | Restores the default behaviour, which restricts the permitted | 
|---|
| 393 | instructions to just the basic IP2022 ones. | 
|---|
| 394 |  | 
|---|
| 395 | The following options are available when as is configured for the | 
|---|
| 396 | Renesas M32R (formerly Mitsubishi M32R) series. | 
|---|
| 397 |  | 
|---|
| 398 | `--m32rx' | 
|---|
| 399 | Specify which processor in the M32R family is the target.  The | 
|---|
| 400 | default is normally the M32R, but this option changes it to the | 
|---|
| 401 | M32RX. | 
|---|
| 402 |  | 
|---|
| 403 | `--warn-explicit-parallel-conflicts or --Wp' | 
|---|
| 404 | Produce warning messages when questionable parallel constructs are | 
|---|
| 405 | encountered. | 
|---|
| 406 |  | 
|---|
| 407 | `--no-warn-explicit-parallel-conflicts or --Wnp' | 
|---|
| 408 | Do not produce warning messages when questionable parallel | 
|---|
| 409 | constructs are encountered. | 
|---|
| 410 |  | 
|---|
| 411 | The following options are available when as is configured for the | 
|---|
| 412 | Motorola 68000 series. | 
|---|
| 413 |  | 
|---|
| 414 | `-l' | 
|---|
| 415 | Shorten references to undefined symbols, to one word instead of | 
|---|
| 416 | two. | 
|---|
| 417 |  | 
|---|
| 418 | `-m68000 | -m68008 | -m68010 | -m68020 | -m68030' | 
|---|
| 419 | `| -m68040 | -m68060 | -m68302 | -m68331 | -m68332' | 
|---|
| 420 | `| -m68333 | -m68340 | -mcpu32 | -m5200' | 
|---|
| 421 | Specify what processor in the 68000 family is the target.  The | 
|---|
| 422 | default is normally the 68020, but this can be changed at | 
|---|
| 423 | configuration time. | 
|---|
| 424 |  | 
|---|
| 425 | `-m68881 | -m68882 | -mno-68881 | -mno-68882' | 
|---|
| 426 | The target machine does (or does not) have a floating-point | 
|---|
| 427 | coprocessor.  The default is to assume a coprocessor for 68020, | 
|---|
| 428 | 68030, and cpu32.  Although the basic 68000 is not compatible with | 
|---|
| 429 | the 68881, a combination of the two can be specified, since it's | 
|---|
| 430 | possible to do emulation of the coprocessor instructions with the | 
|---|
| 431 | main processor. | 
|---|
| 432 |  | 
|---|
| 433 | `-m68851 | -mno-68851' | 
|---|
| 434 | The target machine does (or does not) have a memory-management | 
|---|
| 435 | unit coprocessor.  The default is to assume an MMU for 68020 and | 
|---|
| 436 | up. | 
|---|
| 437 |  | 
|---|
| 438 | For details about the PDP-11 machine dependent features options, see | 
|---|
| 439 | *Note PDP-11-Options::. | 
|---|
| 440 |  | 
|---|
| 441 | `-mpic | -mno-pic' | 
|---|
| 442 | Generate position-independent (or position-dependent) code.  The | 
|---|
| 443 | default is `-mpic'. | 
|---|
| 444 |  | 
|---|
| 445 | `-mall' | 
|---|
| 446 | `-mall-extensions' | 
|---|
| 447 | Enable all instruction set extensions.  This is the default. | 
|---|
| 448 |  | 
|---|
| 449 | `-mno-extensions' | 
|---|
| 450 | Disable all instruction set extensions. | 
|---|
| 451 |  | 
|---|
| 452 | `-mEXTENSION | -mno-EXTENSION' | 
|---|
| 453 | Enable (or disable) a particular instruction set extension. | 
|---|
| 454 |  | 
|---|
| 455 | `-mCPU' | 
|---|
| 456 | Enable the instruction set extensions supported by a particular | 
|---|
| 457 | CPU, and disable all other extensions. | 
|---|
| 458 |  | 
|---|
| 459 | `-mMACHINE' | 
|---|
| 460 | Enable the instruction set extensions supported by a particular | 
|---|
| 461 | machine model, and disable all other extensions. | 
|---|
| 462 |  | 
|---|
| 463 | The following options are available when as is configured for a | 
|---|
| 464 | picoJava processor. | 
|---|
| 465 |  | 
|---|
| 466 | `-mb' | 
|---|
| 467 | Generate "big endian" format output. | 
|---|
| 468 |  | 
|---|
| 469 | `-ml' | 
|---|
| 470 | Generate "little endian" format output. | 
|---|
| 471 |  | 
|---|
| 472 | The following options are available when as is configured for the | 
|---|
| 473 | Motorola 68HC11 or 68HC12 series. | 
|---|
| 474 |  | 
|---|
| 475 | `-m68hc11 | -m68hc12 | -m68hcs12' | 
|---|
| 476 | Specify what processor is the target.  The default is defined by | 
|---|
| 477 | the configuration option when building the assembler. | 
|---|
| 478 |  | 
|---|
| 479 | `-mshort' | 
|---|
| 480 | Specify to use the 16-bit integer ABI. | 
|---|
| 481 |  | 
|---|
| 482 | `-mlong' | 
|---|
| 483 | Specify to use the 32-bit integer ABI. | 
|---|
| 484 |  | 
|---|
| 485 | `-mshort-double' | 
|---|
| 486 | Specify to use the 32-bit double ABI. | 
|---|
| 487 |  | 
|---|
| 488 | `-mlong-double' | 
|---|
| 489 | Specify to use the 64-bit double ABI. | 
|---|
| 490 |  | 
|---|
| 491 | `--force-long-branchs' | 
|---|
| 492 | Relative branches are turned into absolute ones. This concerns | 
|---|
| 493 | conditional branches, unconditional branches and branches to a sub | 
|---|
| 494 | routine. | 
|---|
| 495 |  | 
|---|
| 496 | `-S | --short-branchs' | 
|---|
| 497 | Do not turn relative branchs into absolute ones when the offset is | 
|---|
| 498 | out of range. | 
|---|
| 499 |  | 
|---|
| 500 | `--strict-direct-mode' | 
|---|
| 501 | Do not turn the direct addressing mode into extended addressing | 
|---|
| 502 | mode when the instruction does not support direct addressing mode. | 
|---|
| 503 |  | 
|---|
| 504 | `--print-insn-syntax' | 
|---|
| 505 | Print the syntax of instruction in case of error. | 
|---|
| 506 |  | 
|---|
| 507 | `--print-opcodes' | 
|---|
| 508 | print the list of instructions with syntax and then exit. | 
|---|
| 509 |  | 
|---|
| 510 | `--generate-example' | 
|---|
| 511 | print an example of instruction for each possible instruction and | 
|---|
| 512 | then exit.  This option is only useful for testing `as'. | 
|---|
| 513 |  | 
|---|
| 514 | The following options are available when `as' is configured for the | 
|---|
| 515 | SPARC architecture: | 
|---|
| 516 |  | 
|---|
| 517 | `-Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite' | 
|---|
| 518 | `-Av8plus | -Av8plusa | -Av9 | -Av9a' | 
|---|
| 519 | Explicitly select a variant of the SPARC architecture. | 
|---|
| 520 |  | 
|---|
| 521 | `-Av8plus' and `-Av8plusa' select a 32 bit environment.  `-Av9' | 
|---|
| 522 | and `-Av9a' select a 64 bit environment. | 
|---|
| 523 |  | 
|---|
| 524 | `-Av8plusa' and `-Av9a' enable the SPARC V9 instruction set with | 
|---|
| 525 | UltraSPARC extensions. | 
|---|
| 526 |  | 
|---|
| 527 | `-xarch=v8plus | -xarch=v8plusa' | 
|---|
| 528 | For compatibility with the Solaris v9 assembler.  These options are | 
|---|
| 529 | equivalent to -Av8plus and -Av8plusa, respectively. | 
|---|
| 530 |  | 
|---|
| 531 | `-bump' | 
|---|
| 532 | Warn when the assembler switches to another architecture. | 
|---|
| 533 |  | 
|---|
| 534 | The following options are available when as is configured for the | 
|---|
| 535 | 'c54x architecture. | 
|---|
| 536 |  | 
|---|
| 537 | `-mfar-mode' | 
|---|
| 538 | Enable extended addressing mode.  All addresses and relocations | 
|---|
| 539 | will assume extended addressing (usually 23 bits). | 
|---|
| 540 |  | 
|---|
| 541 | `-mcpu=CPU_VERSION' | 
|---|
| 542 | Sets the CPU version being compiled for. | 
|---|
| 543 |  | 
|---|
| 544 | `-merrors-to-file FILENAME' | 
|---|
| 545 | Redirect error output to a file, for broken systems which don't | 
|---|
| 546 | support such behaviour in the shell. | 
|---|
| 547 |  | 
|---|
| 548 | The following options are available when as is configured for a MIPS | 
|---|
| 549 | processor. | 
|---|
| 550 |  | 
|---|
| 551 | `-G NUM' | 
|---|
| 552 | This option sets the largest size of an object that can be | 
|---|
| 553 | referenced implicitly with the `gp' register.  It is only accepted | 
|---|
| 554 | for targets that use ECOFF format, such as a DECstation running | 
|---|
| 555 | Ultrix.  The default value is 8. | 
|---|
| 556 |  | 
|---|
| 557 | `-EB' | 
|---|
| 558 | Generate "big endian" format output. | 
|---|
| 559 |  | 
|---|
| 560 | `-EL' | 
|---|
| 561 | Generate "little endian" format output. | 
|---|
| 562 |  | 
|---|
| 563 | `-mips1' | 
|---|
| 564 | `-mips2' | 
|---|
| 565 | `-mips3' | 
|---|
| 566 | `-mips4' | 
|---|
| 567 | `-mips5' | 
|---|
| 568 | `-mips32' | 
|---|
| 569 | `-mips32r2' | 
|---|
| 570 | `-mips64' | 
|---|
| 571 | Generate code for a particular MIPS Instruction Set Architecture | 
|---|
| 572 | level.  `-mips1' is an alias for `-march=r3000', `-mips2' is an | 
|---|
| 573 | alias for `-march=r6000', `-mips3' is an alias for `-march=r4000' | 
|---|
| 574 | and `-mips4' is an alias for `-march=r8000'.  `-mips5', `-mips32', | 
|---|
| 575 | `-mips32r2', and `-mips64' correspond to generic `MIPS V', | 
|---|
| 576 | `MIPS32', `MIPS32 Release 2', and `MIPS64' ISA processors, | 
|---|
| 577 | respectively. | 
|---|
| 578 |  | 
|---|
| 579 | `-march=CPU' | 
|---|
| 580 | Generate code for a particular MIPS cpu. | 
|---|
| 581 |  | 
|---|
| 582 | `-mtune=CPU' | 
|---|
| 583 | Schedule and tune for a particular MIPS cpu. | 
|---|
| 584 |  | 
|---|
| 585 | `-mfix7000' | 
|---|
| 586 | `-mno-fix7000' | 
|---|
| 587 | Cause nops to be inserted if the read of the destination register | 
|---|
| 588 | of an mfhi or mflo instruction occurs in the following two | 
|---|
| 589 | instructions. | 
|---|
| 590 |  | 
|---|
| 591 | `-mdebug' | 
|---|
| 592 | `-no-mdebug' | 
|---|
| 593 | Cause stabs-style debugging output to go into an ECOFF-style | 
|---|
| 594 | .mdebug section instead of the standard ELF .stabs sections. | 
|---|
| 595 |  | 
|---|
| 596 | `-mgp32' | 
|---|
| 597 | `-mfp32' | 
|---|
| 598 | The register sizes are normally inferred from the ISA and ABI, but | 
|---|
| 599 | these flags force a certain group of registers to be treated as 32 | 
|---|
| 600 | bits wide at all times.  `-mgp32' controls the size of | 
|---|
| 601 | general-purpose registers and `-mfp32' controls the size of | 
|---|
| 602 | floating-point registers. | 
|---|
| 603 |  | 
|---|
| 604 | `-mips16' | 
|---|
| 605 | `-no-mips16' | 
|---|
| 606 | Generate code for the MIPS 16 processor.  This is equivalent to | 
|---|
| 607 | putting `.set mips16' at the start of the assembly file. | 
|---|
| 608 | `-no-mips16' turns off this option. | 
|---|
| 609 |  | 
|---|
| 610 | `-mips3d' | 
|---|
| 611 | `-no-mips3d' | 
|---|
| 612 | Generate code for the MIPS-3D Application Specific Extension. | 
|---|
| 613 | This tells the assembler to accept MIPS-3D instructions. | 
|---|
| 614 | `-no-mips3d' turns off this option. | 
|---|
| 615 |  | 
|---|
| 616 | `-mdmx' | 
|---|
| 617 | `-no-mdmx' | 
|---|
| 618 | Generate code for the MDMX Application Specific Extension.  This | 
|---|
| 619 | tells the assembler to accept MDMX instructions.  `-no-mdmx' turns | 
|---|
| 620 | off this option. | 
|---|
| 621 |  | 
|---|
| 622 | `--construct-floats' | 
|---|
| 623 | `--no-construct-floats' | 
|---|
| 624 | The `--no-construct-floats' option disables the construction of | 
|---|
| 625 | double width floating point constants by loading the two halves of | 
|---|
| 626 | the value into the two single width floating point registers that | 
|---|
| 627 | make up the double width register.  By default | 
|---|
| 628 | `--construct-floats' is selected, allowing construction of these | 
|---|
| 629 | floating point constants. | 
|---|
| 630 |  | 
|---|
| 631 | `--emulation=NAME' | 
|---|
| 632 | This option causes `as' to emulate `as' configured for some other | 
|---|
| 633 | target, in all respects, including output format (choosing between | 
|---|
| 634 | ELF and ECOFF only), handling of pseudo-opcodes which may generate | 
|---|
| 635 | debugging information or store symbol table information, and | 
|---|
| 636 | default endianness.  The available configuration names are: | 
|---|
| 637 | `mipsecoff', `mipself', `mipslecoff', `mipsbecoff', `mipslelf', | 
|---|
| 638 | `mipsbelf'.  The first two do not alter the default endianness | 
|---|
| 639 | from that of the primary target for which the assembler was | 
|---|
| 640 | configured; the others change the default to little- or big-endian | 
|---|
| 641 | as indicated by the `b' or `l' in the name.  Using `-EB' or `-EL' | 
|---|
| 642 | will override the endianness selection in any case. | 
|---|
| 643 |  | 
|---|
| 644 | This option is currently supported only when the primary target | 
|---|
| 645 | `as' is configured for is a MIPS ELF or ECOFF target. | 
|---|
| 646 | Furthermore, the primary target or others specified with | 
|---|
| 647 | `--enable-targets=...' at configuration time must include support | 
|---|
| 648 | for the other format, if both are to be available.  For example, | 
|---|
| 649 | the Irix 5 configuration includes support for both. | 
|---|
| 650 |  | 
|---|
| 651 | Eventually, this option will support more configurations, with more | 
|---|
| 652 | fine-grained control over the assembler's behavior, and will be | 
|---|
| 653 | supported for more processors. | 
|---|
| 654 |  | 
|---|
| 655 | `-nocpp' | 
|---|
| 656 | `as' ignores this option.  It is accepted for compatibility with | 
|---|
| 657 | the native tools. | 
|---|
| 658 |  | 
|---|
| 659 | `--trap' | 
|---|
| 660 | `--no-trap' | 
|---|
| 661 | `--break' | 
|---|
| 662 | `--no-break' | 
|---|
| 663 | Control how to deal with multiplication overflow and division by | 
|---|
| 664 | zero.  `--trap' or `--no-break' (which are synonyms) take a trap | 
|---|
| 665 | exception (and only work for Instruction Set Architecture level 2 | 
|---|
| 666 | and higher); `--break' or `--no-trap' (also synonyms, and the | 
|---|
| 667 | default) take a break exception. | 
|---|
| 668 |  | 
|---|
| 669 | `-n' | 
|---|
| 670 | When this option is used, `as' will issue a warning every time it | 
|---|
| 671 | generates a nop instruction from a macro. | 
|---|
| 672 |  | 
|---|
| 673 | The following options are available when as is configured for an | 
|---|
| 674 | MCore processor. | 
|---|
| 675 |  | 
|---|
| 676 | `-jsri2bsr' | 
|---|
| 677 | `-nojsri2bsr' | 
|---|
| 678 | Enable or disable the JSRI to BSR transformation.  By default this | 
|---|
| 679 | is enabled.  The command line option `-nojsri2bsr' can be used to | 
|---|
| 680 | disable it. | 
|---|
| 681 |  | 
|---|
| 682 | `-sifilter' | 
|---|
| 683 | `-nosifilter' | 
|---|
| 684 | Enable or disable the silicon filter behaviour.  By default this | 
|---|
| 685 | is disabled.  The default can be overridden by the `-sifilter' | 
|---|
| 686 | command line option. | 
|---|
| 687 |  | 
|---|
| 688 | `-relax' | 
|---|
| 689 | Alter jump instructions for long displacements. | 
|---|
| 690 |  | 
|---|
| 691 | `-mcpu=[210|340]' | 
|---|
| 692 | Select the cpu type on the target hardware.  This controls which | 
|---|
| 693 | instructions can be assembled. | 
|---|
| 694 |  | 
|---|
| 695 | `-EB' | 
|---|
| 696 | Assemble for a big endian target. | 
|---|
| 697 |  | 
|---|
| 698 | `-EL' | 
|---|
| 699 | Assemble for a little endian target. | 
|---|
| 700 |  | 
|---|
| 701 | See the info pages for documentation of the MMIX-specific options. | 
|---|
| 702 |  | 
|---|
| 703 | The following options are available when as is configured for an | 
|---|
| 704 | Xtensa processor. | 
|---|
| 705 |  | 
|---|
| 706 | `--density | --no-density' | 
|---|
| 707 | Enable or disable use of instructions from the Xtensa code density | 
|---|
| 708 | option.  This is enabled by default when the Xtensa processor | 
|---|
| 709 | supports the code density option. | 
|---|
| 710 |  | 
|---|
| 711 | `--relax | --no-relax' | 
|---|
| 712 | Enable or disable instruction relaxation.  This is enabled by | 
|---|
| 713 | default.  Note: In the current implementation, these options also | 
|---|
| 714 | control whether assembler optimizations are performed, making | 
|---|
| 715 | these options equivalent to `--generics' and `--no-generics'. | 
|---|
| 716 |  | 
|---|
| 717 | `--generics | --no-generics' | 
|---|
| 718 | Enable or disable all assembler transformations of Xtensa | 
|---|
| 719 | instructions.  The default is `--generics'; `--no-generics' should | 
|---|
| 720 | be used only in the rare cases when the instructions must be | 
|---|
| 721 | exactly as specified in the assembly source. | 
|---|
| 722 |  | 
|---|
| 723 | `--text-section-literals | --no-text-section-literals' | 
|---|
| 724 | With `--text-section-literals', literal pools are interspersed in | 
|---|
| 725 | the text section.  The default is `--no-text-section-literals', | 
|---|
| 726 | which places literals in a separate section in the output file. | 
|---|
| 727 |  | 
|---|
| 728 | `--target-align | --no-target-align' | 
|---|
| 729 | Enable or disable automatic alignment to reduce branch penalties | 
|---|
| 730 | at the expense of some code density.  The default is | 
|---|
| 731 | `--target-align'. | 
|---|
| 732 |  | 
|---|
| 733 | `--longcalls | --no-longcalls' | 
|---|
| 734 | Enable or disable transformation of call instructions to allow | 
|---|
| 735 | calls across a greater range of addresses.  The default is | 
|---|
| 736 | `--no-longcalls'. | 
|---|
| 737 |  | 
|---|
| 738 | * Menu: | 
|---|
| 739 |  | 
|---|
| 740 | * Manual::                      Structure of this Manual | 
|---|
| 741 | * GNU Assembler::               The GNU Assembler | 
|---|
| 742 | * Object Formats::              Object File Formats | 
|---|
| 743 | * Command Line::                Command Line | 
|---|
| 744 | * Input Files::                 Input Files | 
|---|
| 745 | * Object::                      Output (Object) File | 
|---|
| 746 | * Errors::                      Error and Warning Messages | 
|---|
| 747 |  | 
|---|
| 748 |  | 
|---|
| 749 | File: as.info,  Node: Manual,  Next: GNU Assembler,  Up: Overview | 
|---|
| 750 |  | 
|---|
| 751 | Structure of this Manual | 
|---|
| 752 | ======================== | 
|---|
| 753 |  | 
|---|
| 754 | This manual is intended to describe what you need to know to use GNU | 
|---|
| 755 | `as'.  We cover the syntax expected in source files, including notation | 
|---|
| 756 | for symbols, constants, and expressions; the directives that `as' | 
|---|
| 757 | understands; and of course how to invoke `as'. | 
|---|
| 758 |  | 
|---|
| 759 | This manual also describes some of the machine-dependent features of | 
|---|
| 760 | various flavors of the assembler. | 
|---|
| 761 |  | 
|---|
| 762 | On the other hand, this manual is _not_ intended as an introduction | 
|---|
| 763 | to programming in assembly language--let alone programming in general! | 
|---|
| 764 | In a similar vein, we make no attempt to introduce the machine | 
|---|
| 765 | architecture; we do _not_ describe the instruction set, standard | 
|---|
| 766 | mnemonics, registers or addressing modes that are standard to a | 
|---|
| 767 | particular architecture.  You may want to consult the manufacturer's | 
|---|
| 768 | machine architecture manual for this information. | 
|---|
| 769 |  | 
|---|
| 770 |  | 
|---|
| 771 | File: as.info,  Node: GNU Assembler,  Next: Object Formats,  Prev: Manual,  Up: Overview | 
|---|
| 772 |  | 
|---|
| 773 | The GNU Assembler | 
|---|
| 774 | ================= | 
|---|
| 775 |  | 
|---|
| 776 | GNU `as' is really a family of assemblers.  If you use (or have | 
|---|
| 777 | used) the GNU assembler on one architecture, you should find a fairly | 
|---|
| 778 | similar environment when you use it on another architecture.  Each | 
|---|
| 779 | version has much in common with the others, including object file | 
|---|
| 780 | formats, most assembler directives (often called "pseudo-ops") and | 
|---|
| 781 | assembler syntax. | 
|---|
| 782 |  | 
|---|
| 783 | `as' is primarily intended to assemble the output of the GNU C | 
|---|
| 784 | compiler `gcc' for use by the linker `ld'.  Nevertheless, we've tried | 
|---|
| 785 | to make `as' assemble correctly everything that other assemblers for | 
|---|
| 786 | the same machine would assemble.  Any exceptions are documented | 
|---|
| 787 | explicitly (*note Machine Dependencies::).  This doesn't mean `as' | 
|---|
| 788 | always uses the same syntax as another assembler for the same | 
|---|
| 789 | architecture; for example, we know of several incompatible versions of | 
|---|
| 790 | 680x0 assembly language syntax. | 
|---|
| 791 |  | 
|---|
| 792 | Unlike older assemblers, `as' is designed to assemble a source | 
|---|
| 793 | program in one pass of the source file.  This has a subtle impact on the | 
|---|
| 794 | `.org' directive (*note `.org': Org.). | 
|---|
| 795 |  | 
|---|
| 796 |  | 
|---|
| 797 | File: as.info,  Node: Object Formats,  Next: Command Line,  Prev: GNU Assembler,  Up: Overview | 
|---|
| 798 |  | 
|---|
| 799 | Object File Formats | 
|---|
| 800 | =================== | 
|---|
| 801 |  | 
|---|
| 802 | The GNU assembler can be configured to produce several alternative | 
|---|
| 803 | object file formats.  For the most part, this does not affect how you | 
|---|
| 804 | write assembly language programs; but directives for debugging symbols | 
|---|
| 805 | are typically different in different file formats.  *Note Symbol | 
|---|
| 806 | Attributes: Symbol Attributes. | 
|---|
| 807 |  | 
|---|
| 808 |  | 
|---|
| 809 | File: as.info,  Node: Command Line,  Next: Input Files,  Prev: Object Formats,  Up: Overview | 
|---|
| 810 |  | 
|---|
| 811 | Command Line | 
|---|
| 812 | ============ | 
|---|
| 813 |  | 
|---|
| 814 | After the program name `as', the command line may contain options | 
|---|
| 815 | and file names.  Options may appear in any order, and may be before, | 
|---|
| 816 | after, or between file names.  The order of file names is significant. | 
|---|
| 817 |  | 
|---|
| 818 | `--' (two hyphens) by itself names the standard input file | 
|---|
| 819 | explicitly, as one of the files for `as' to assemble. | 
|---|
| 820 |  | 
|---|
| 821 | Except for `--' any command line argument that begins with a hyphen | 
|---|
| 822 | (`-') is an option.  Each option changes the behavior of `as'.  No | 
|---|
| 823 | option changes the way another option works.  An option is a `-' | 
|---|
| 824 | followed by one or more letters; the case of the letter is important. | 
|---|
| 825 | All options are optional. | 
|---|
| 826 |  | 
|---|
| 827 | Some options expect exactly one file name to follow them.  The file | 
|---|
| 828 | name may either immediately follow the option's letter (compatible with | 
|---|
| 829 | older assemblers) or it may be the next command argument (GNU | 
|---|
| 830 | standard).  These two command lines are equivalent: | 
|---|
| 831 |  | 
|---|
| 832 | as -o my-object-file.o mumble.s | 
|---|
| 833 | as -omy-object-file.o mumble.s | 
|---|
| 834 |  | 
|---|
| 835 |  | 
|---|
| 836 | File: as.info,  Node: Input Files,  Next: Object,  Prev: Command Line,  Up: Overview | 
|---|
| 837 |  | 
|---|
| 838 | Input Files | 
|---|
| 839 | =========== | 
|---|
| 840 |  | 
|---|
| 841 | We use the phrase "source program", abbreviated "source", to | 
|---|
| 842 | describe the program input to one run of `as'.  The program may be in | 
|---|
| 843 | one or more files; how the source is partitioned into files doesn't | 
|---|
| 844 | change the meaning of the source. | 
|---|
| 845 |  | 
|---|
| 846 | The source program is a concatenation of the text in all the files, | 
|---|
| 847 | in the order specified. | 
|---|
| 848 |  | 
|---|
| 849 | Each time you run `as' it assembles exactly one source program.  The | 
|---|
| 850 | source program is made up of one or more files.  (The standard input is | 
|---|
| 851 | also a file.) | 
|---|
| 852 |  | 
|---|
| 853 | You give `as' a command line that has zero or more input file names. | 
|---|
| 854 | The input files are read (from left file name to right).  A command | 
|---|
| 855 | line argument (in any position) that has no special meaning is taken to | 
|---|
| 856 | be an input file name. | 
|---|
| 857 |  | 
|---|
| 858 | If you give `as' no file names it attempts to read one input file | 
|---|
| 859 | from the `as' standard input, which is normally your terminal.  You may | 
|---|
| 860 | have to type <ctl-D> to tell `as' there is no more program to assemble. | 
|---|
| 861 |  | 
|---|
| 862 | Use `--' if you need to explicitly name the standard input file in | 
|---|
| 863 | your command line. | 
|---|
| 864 |  | 
|---|
| 865 | If the source is empty, `as' produces a small, empty object file. | 
|---|
| 866 |  | 
|---|
| 867 | Filenames and Line-numbers | 
|---|
| 868 | -------------------------- | 
|---|
| 869 |  | 
|---|
| 870 | There are two ways of locating a line in the input file (or files) | 
|---|
| 871 | and either may be used in reporting error messages.  One way refers to | 
|---|
| 872 | a line number in a physical file; the other refers to a line number in a | 
|---|
| 873 | "logical" file.  *Note Error and Warning Messages: Errors. | 
|---|
| 874 |  | 
|---|
| 875 | "Physical files" are those files named in the command line given to | 
|---|
| 876 | `as'. | 
|---|
| 877 |  | 
|---|
| 878 | "Logical files" are simply names declared explicitly by assembler | 
|---|
| 879 | directives; they bear no relation to physical files.  Logical file | 
|---|
| 880 | names help error messages reflect the original source file, when `as' | 
|---|
| 881 | source is itself synthesized from other files.  `as' understands the | 
|---|
| 882 | `#' directives emitted by the `gcc' preprocessor.  See also *Note | 
|---|
| 883 | `.file': File. | 
|---|
| 884 |  | 
|---|
| 885 |  | 
|---|
| 886 | File: as.info,  Node: Object,  Next: Errors,  Prev: Input Files,  Up: Overview | 
|---|
| 887 |  | 
|---|
| 888 | Output (Object) File | 
|---|
| 889 | ==================== | 
|---|
| 890 |  | 
|---|
| 891 | Every time you run `as' it produces an output file, which is your | 
|---|
| 892 | assembly language program translated into numbers.  This file is the | 
|---|
| 893 | object file.  Its default name is `a.out', or `b.out' when `as' is | 
|---|
| 894 | configured for the Intel 80960.  You can give it another name by using | 
|---|
| 895 | the `-o' option.  Conventionally, object file names end with `.o'.  The | 
|---|
| 896 | default name is used for historical reasons: older assemblers were | 
|---|
| 897 | capable of assembling self-contained programs directly into a runnable | 
|---|
| 898 | program.  (For some formats, this isn't currently possible, but it can | 
|---|
| 899 | be done for the `a.out' format.) | 
|---|
| 900 |  | 
|---|
| 901 | The object file is meant for input to the linker `ld'.  It contains | 
|---|
| 902 | assembled program code, information to help `ld' integrate the | 
|---|
| 903 | assembled program into a runnable file, and (optionally) symbolic | 
|---|
| 904 | information for the debugger. | 
|---|
| 905 |  | 
|---|
| 906 |  | 
|---|
| 907 | File: as.info,  Node: Errors,  Prev: Object,  Up: Overview | 
|---|
| 908 |  | 
|---|
| 909 | Error and Warning Messages | 
|---|
| 910 | ========================== | 
|---|
| 911 |  | 
|---|
| 912 | `as' may write warnings and error messages to the standard error | 
|---|
| 913 | file (usually your terminal).  This should not happen when  a compiler | 
|---|
| 914 | runs `as' automatically.  Warnings report an assumption made so that | 
|---|
| 915 | `as' could keep assembling a flawed program; errors report a grave | 
|---|
| 916 | problem that stops the assembly. | 
|---|
| 917 |  | 
|---|
| 918 | Warning messages have the format | 
|---|
| 919 |  | 
|---|
| 920 | file_name:NNN:Warning Message Text | 
|---|
| 921 |  | 
|---|
| 922 | (where NNN is a line number).  If a logical file name has been given | 
|---|
| 923 | (*note `.file': File.) it is used for the filename, otherwise the name | 
|---|
| 924 | of the current input file is used.  If a logical line number was given | 
|---|
| 925 | (*note `.line': Line.)  then it is used to calculate the number printed, | 
|---|
| 926 | otherwise the actual line in the current source file is printed.  The | 
|---|
| 927 | message text is intended to be self explanatory (in the grand Unix | 
|---|
| 928 | tradition). | 
|---|
| 929 |  | 
|---|
| 930 | Error messages have the format | 
|---|
| 931 | file_name:NNN:FATAL:Error Message Text | 
|---|
| 932 | The file name and line number are derived as for warning messages. | 
|---|
| 933 | The actual message text may be rather less explanatory because many of | 
|---|
| 934 | them aren't supposed to happen. | 
|---|
| 935 |  | 
|---|
| 936 |  | 
|---|
| 937 | File: as.info,  Node: Invoking,  Next: Syntax,  Prev: Overview,  Up: Top | 
|---|
| 938 |  | 
|---|
| 939 | Command-Line Options | 
|---|
| 940 | ******************** | 
|---|
| 941 |  | 
|---|
| 942 | This chapter describes command-line options available in _all_ | 
|---|
| 943 | versions of the GNU assembler; *note Machine Dependencies::, for | 
|---|
| 944 | options specific to particular machine architectures. | 
|---|
| 945 |  | 
|---|
| 946 | If you are invoking `as' via the GNU C compiler, you can use the | 
|---|
| 947 | `-Wa' option to pass arguments through to the assembler.  The assembler | 
|---|
| 948 | arguments must be separated from each other (and the `-Wa') by commas. | 
|---|
| 949 | For example: | 
|---|
| 950 |  | 
|---|
| 951 | gcc -c -g -O -Wa,-alh,-L file.c | 
|---|
| 952 |  | 
|---|
| 953 | This passes two options to the assembler: `-alh' (emit a listing to | 
|---|
| 954 | standard output with high-level and assembly source) and `-L' (retain | 
|---|
| 955 | local symbols in the symbol table). | 
|---|
| 956 |  | 
|---|
| 957 | Usually you do not need to use this `-Wa' mechanism, since many | 
|---|
| 958 | compiler command-line options are automatically passed to the assembler | 
|---|
| 959 | by the compiler.  (You can call the GNU compiler driver with the `-v' | 
|---|
| 960 | option to see precisely what options it passes to each compilation | 
|---|
| 961 | pass, including the assembler.) | 
|---|
| 962 |  | 
|---|
| 963 | * Menu: | 
|---|
| 964 |  | 
|---|
| 965 | * a::             -a[cdhlns] enable listings | 
|---|
| 966 | * D::             -D for compatibility | 
|---|
| 967 | * f::             -f to work faster | 
|---|
| 968 | * I::             -I for .include search path | 
|---|
| 969 |  | 
|---|
| 970 | * K::             -K for difference tables | 
|---|
| 971 |  | 
|---|
| 972 | * L::             -L to retain local labels | 
|---|
| 973 | * listing::       --listing-XXX to configure listing output | 
|---|
| 974 | * M::             -M or --mri to assemble in MRI compatibility mode | 
|---|
| 975 | * MD::            --MD for dependency tracking | 
|---|
| 976 | * o::             -o to name the object file | 
|---|
| 977 | * R::             -R to join data and text sections | 
|---|
| 978 | * statistics::    --statistics to see statistics about assembly | 
|---|
| 979 | * traditional-format:: --traditional-format for compatible output | 
|---|
| 980 | * v::             -v to announce version | 
|---|
| 981 | * W::             -W, --no-warn, --warn, --fatal-warnings to control warnings | 
|---|
| 982 | * Z::             -Z to make object file even after errors | 
|---|
| 983 |  | 
|---|
| 984 |  | 
|---|
| 985 | File: as.info,  Node: a,  Next: D,  Up: Invoking | 
|---|
| 986 |  | 
|---|
| 987 | Enable Listings: `-a[cdhlns]' | 
|---|
| 988 | ============================= | 
|---|
| 989 |  | 
|---|
| 990 | These options enable listing output from the assembler.  By itself, | 
|---|
| 991 | `-a' requests high-level, assembly, and symbols listing.  You can use | 
|---|
| 992 | other letters to select specific options for the list: `-ah' requests a | 
|---|
| 993 | high-level language listing, `-al' requests an output-program assembly | 
|---|
| 994 | listing, and `-as' requests a symbol table listing.  High-level | 
|---|
| 995 | listings require that a compiler debugging option like `-g' be used, | 
|---|
| 996 | and that assembly listings (`-al') be requested also. | 
|---|
| 997 |  | 
|---|
| 998 | Use the `-ac' option to omit false conditionals from a listing.  Any | 
|---|
| 999 | lines which are not assembled because of a false `.if' (or `.ifdef', or | 
|---|
| 1000 | any other conditional), or a true `.if' followed by an `.else', will be | 
|---|
| 1001 | omitted from the listing. | 
|---|
| 1002 |  | 
|---|
| 1003 | Use the `-ad' option to omit debugging directives from the listing. | 
|---|
| 1004 |  | 
|---|
| 1005 | Once you have specified one of these options, you can further control | 
|---|
| 1006 | listing output and its appearance using the directives `.list', | 
|---|
| 1007 | `.nolist', `.psize', `.eject', `.title', and `.sbttl'.  The `-an' | 
|---|
| 1008 | option turns off all forms processing.  If you do not request listing | 
|---|
| 1009 | output with one of the `-a' options, the listing-control directives | 
|---|
| 1010 | have no effect. | 
|---|
| 1011 |  | 
|---|
| 1012 | The letters after `-a' may be combined into one option, _e.g._, | 
|---|
| 1013 | `-aln'. | 
|---|
| 1014 |  | 
|---|
| 1015 | Note if the assembler source is coming from the standard input (eg | 
|---|
| 1016 | because it is being created by `gcc' and the `-pipe' command line switch | 
|---|
| 1017 | is being used) then the listing will not contain any comments or | 
|---|
| 1018 | preprocessor directives.  This is because the listing code buffers | 
|---|
| 1019 | input source lines from stdin only after they have been preprocessed by | 
|---|
| 1020 | the assembler.  This reduces memory usage and makes the code more | 
|---|
| 1021 | efficient. | 
|---|
| 1022 |  | 
|---|
| 1023 |  | 
|---|
| 1024 | File: as.info,  Node: D,  Next: f,  Prev: a,  Up: Invoking | 
|---|
| 1025 |  | 
|---|
| 1026 | `-D' | 
|---|
| 1027 | ==== | 
|---|
| 1028 |  | 
|---|
| 1029 | This option has no effect whatsoever, but it is accepted to make it | 
|---|
| 1030 | more likely that scripts written for other assemblers also work with | 
|---|
| 1031 | `as'. | 
|---|
| 1032 |  | 
|---|
| 1033 |  | 
|---|
| 1034 | File: as.info,  Node: f,  Next: I,  Prev: D,  Up: Invoking | 
|---|
| 1035 |  | 
|---|
| 1036 | Work Faster: `-f' | 
|---|
| 1037 | ================= | 
|---|
| 1038 |  | 
|---|
| 1039 | `-f' should only be used when assembling programs written by a | 
|---|
| 1040 | (trusted) compiler.  `-f' stops the assembler from doing whitespace and | 
|---|
| 1041 | comment preprocessing on the input file(s) before assembling them. | 
|---|
| 1042 | *Note Preprocessing: Preprocessing. | 
|---|
| 1043 |  | 
|---|
| 1044 | _Warning:_ if you use `-f' when the files actually need to be | 
|---|
| 1045 | preprocessed (if they contain comments, for example), `as' does | 
|---|
| 1046 | not work correctly. | 
|---|
| 1047 |  | 
|---|
| 1048 |  | 
|---|
| 1049 | File: as.info,  Node: I,  Next: K,  Prev: f,  Up: Invoking | 
|---|
| 1050 |  | 
|---|
| 1051 | `.include' Search Path: `-I' PATH | 
|---|
| 1052 | ================================= | 
|---|
| 1053 |  | 
|---|
| 1054 | Use this option to add a PATH to the list of directories `as' | 
|---|
| 1055 | searches for files specified in `.include' directives (*note | 
|---|
| 1056 | `.include': Include.).  You may use `-I' as many times as necessary to | 
|---|
| 1057 | include a variety of paths.  The current working directory is always | 
|---|
| 1058 | searched first; after that, `as' searches any `-I' directories in the | 
|---|
| 1059 | same order as they were specified (left to right) on the command line. | 
|---|
| 1060 |  | 
|---|
| 1061 |  | 
|---|
| 1062 | File: as.info,  Node: K,  Next: L,  Prev: I,  Up: Invoking | 
|---|
| 1063 |  | 
|---|
| 1064 | Difference Tables: `-K' | 
|---|
| 1065 | ======================= | 
|---|
| 1066 |  | 
|---|
| 1067 | `as' sometimes alters the code emitted for directives of the form | 
|---|
| 1068 | `.word SYM1-SYM2'; *note `.word': Word..  You can use the `-K' option | 
|---|
| 1069 | if you want a warning issued when this is done. | 
|---|
| 1070 |  | 
|---|
| 1071 |  | 
|---|
| 1072 | File: as.info,  Node: L,  Next: listing,  Prev: K,  Up: Invoking | 
|---|
| 1073 |  | 
|---|
| 1074 | Include Local Labels: `-L' | 
|---|
| 1075 | ========================== | 
|---|
| 1076 |  | 
|---|
| 1077 | Labels beginning with `L' (upper case only) are called "local | 
|---|
| 1078 | labels". *Note Symbol Names::.  Normally you do not see such labels when | 
|---|
| 1079 | debugging, because they are intended for the use of programs (like | 
|---|
| 1080 | compilers) that compose assembler programs, not for your notice. | 
|---|
| 1081 | Normally both `as' and `ld' discard such labels, so you do not normally | 
|---|
| 1082 | debug with them. | 
|---|
| 1083 |  | 
|---|
| 1084 | This option tells `as' to retain those `L...' symbols in the object | 
|---|
| 1085 | file.  Usually if you do this you also tell the linker `ld' to preserve | 
|---|
| 1086 | symbols whose names begin with `L'. | 
|---|
| 1087 |  | 
|---|
| 1088 | By default, a local label is any label beginning with `L', but each | 
|---|
| 1089 | target is allowed to redefine the local label prefix.  On the HPPA | 
|---|
| 1090 | local labels begin with `L$'. | 
|---|
| 1091 |  | 
|---|
| 1092 |  | 
|---|
| 1093 | File: as.info,  Node: listing,  Next: M,  Prev: L,  Up: Invoking | 
|---|
| 1094 |  | 
|---|
| 1095 | Configuring listing output: `--listing' | 
|---|
| 1096 | ======================================= | 
|---|
| 1097 |  | 
|---|
| 1098 | The listing feature of the assembler can be enabled via the command | 
|---|
| 1099 | line switch `-a' (*note a::).  This feature combines the input source | 
|---|
| 1100 | file(s) with a hex dump of the corresponding locations in the output | 
|---|
| 1101 | object file, and displays them as a listing file.  The format of this | 
|---|
| 1102 | listing can be controlled by pseudo ops inside the assembler source | 
|---|
| 1103 | (*note List:: *note Title:: *note Sbttl:: *note Psize:: *note Eject::) | 
|---|
| 1104 | and also by the following switches: | 
|---|
| 1105 |  | 
|---|
| 1106 | `--listing-lhs-width=`number'' | 
|---|
| 1107 | Sets the maximum width, in words, of the first line of the hex | 
|---|
| 1108 | byte dump.  This dump appears on the left hand side of the listing | 
|---|
| 1109 | output. | 
|---|
| 1110 |  | 
|---|
| 1111 | `--listing-lhs-width2=`number'' | 
|---|
| 1112 | Sets the maximum width, in words, of any further lines of the hex | 
|---|
| 1113 | byte dump for a given input source line.  If this value is not | 
|---|
| 1114 | specified, it defaults to being the same as the value specified | 
|---|
| 1115 | for `--listing-lhs-width'.  If neither switch is used the default | 
|---|
| 1116 | is to one. | 
|---|
| 1117 |  | 
|---|
| 1118 | `--listing-rhs-width=`number'' | 
|---|
| 1119 | Sets the maximum width, in characters, of the source line that is | 
|---|
| 1120 | displayed alongside the hex dump.  The default value for this | 
|---|
| 1121 | parameter is 100.  The source line is displayed on the right hand | 
|---|
| 1122 | side of the listing output. | 
|---|
| 1123 |  | 
|---|
| 1124 | `--listing-cont-lines=`number'' | 
|---|
| 1125 | Sets the maximum number of continuation lines of hex dump that | 
|---|
| 1126 | will be displayed for a given single line of source input.  The | 
|---|
| 1127 | default value is 4. | 
|---|
| 1128 |  | 
|---|
| 1129 |  | 
|---|
| 1130 | File: as.info,  Node: M,  Next: MD,  Prev: listing,  Up: Invoking | 
|---|
| 1131 |  | 
|---|
| 1132 | Assemble in MRI Compatibility Mode: `-M' | 
|---|
| 1133 | ======================================== | 
|---|
| 1134 |  | 
|---|
| 1135 | The `-M' or `--mri' option selects MRI compatibility mode.  This | 
|---|
| 1136 | changes the syntax and pseudo-op handling of `as' to make it compatible | 
|---|
| 1137 | with the `ASM68K' or the `ASM960' (depending upon the configured | 
|---|
| 1138 | target) assembler from Microtec Research.  The exact nature of the MRI | 
|---|
| 1139 | syntax will not be documented here; see the MRI manuals for more | 
|---|
| 1140 | information.  Note in particular that the handling of macros and macro | 
|---|
| 1141 | arguments is somewhat different.  The purpose of this option is to | 
|---|
| 1142 | permit assembling existing MRI assembler code using `as'. | 
|---|
| 1143 |  | 
|---|
| 1144 | The MRI compatibility is not complete.  Certain operations of the | 
|---|
| 1145 | MRI assembler depend upon its object file format, and can not be | 
|---|
| 1146 | supported using other object file formats.  Supporting these would | 
|---|
| 1147 | require enhancing each object file format individually.  These are: | 
|---|
| 1148 |  | 
|---|
| 1149 | * global symbols in common section | 
|---|
| 1150 |  | 
|---|
| 1151 | The m68k MRI assembler supports common sections which are merged | 
|---|
| 1152 | by the linker.  Other object file formats do not support this. | 
|---|
| 1153 | `as' handles common sections by treating them as a single common | 
|---|
| 1154 | symbol.  It permits local symbols to be defined within a common | 
|---|
| 1155 | section, but it can not support global symbols, since it has no | 
|---|
| 1156 | way to describe them. | 
|---|
| 1157 |  | 
|---|
| 1158 | * complex relocations | 
|---|
| 1159 |  | 
|---|
| 1160 | The MRI assemblers support relocations against a negated section | 
|---|
| 1161 | address, and relocations which combine the start addresses of two | 
|---|
| 1162 | or more sections.  These are not support by other object file | 
|---|
| 1163 | formats. | 
|---|
| 1164 |  | 
|---|
| 1165 | * `END' pseudo-op specifying start address | 
|---|
| 1166 |  | 
|---|
| 1167 | The MRI `END' pseudo-op permits the specification of a start | 
|---|
| 1168 | address.  This is not supported by other object file formats.  The | 
|---|
| 1169 | start address may instead be specified using the `-e' option to | 
|---|
| 1170 | the linker, or in a linker script. | 
|---|
| 1171 |  | 
|---|
| 1172 | * `IDNT', `.ident' and `NAME' pseudo-ops | 
|---|
| 1173 |  | 
|---|
| 1174 | The MRI `IDNT', `.ident' and `NAME' pseudo-ops assign a module | 
|---|
| 1175 | name to the output file.  This is not supported by other object | 
|---|
| 1176 | file formats. | 
|---|
| 1177 |  | 
|---|
| 1178 | * `ORG' pseudo-op | 
|---|
| 1179 |  | 
|---|
| 1180 | The m68k MRI `ORG' pseudo-op begins an absolute section at a given | 
|---|
| 1181 | address.  This differs from the usual `as' `.org' pseudo-op, which | 
|---|
| 1182 | changes the location within the current section.  Absolute | 
|---|
| 1183 | sections are not supported by other object file formats.  The | 
|---|
| 1184 | address of a section may be assigned within a linker script. | 
|---|
| 1185 |  | 
|---|
| 1186 | There are some other features of the MRI assembler which are not | 
|---|
| 1187 | supported by `as', typically either because they are difficult or | 
|---|
| 1188 | because they seem of little consequence.  Some of these may be | 
|---|
| 1189 | supported in future releases. | 
|---|
| 1190 |  | 
|---|
| 1191 | * EBCDIC strings | 
|---|
| 1192 |  | 
|---|
| 1193 | EBCDIC strings are not supported. | 
|---|
| 1194 |  | 
|---|
| 1195 | * packed binary coded decimal | 
|---|
| 1196 |  | 
|---|
| 1197 | Packed binary coded decimal is not supported.  This means that the | 
|---|
| 1198 | `DC.P' and `DCB.P' pseudo-ops are not supported. | 
|---|
| 1199 |  | 
|---|
| 1200 | * `FEQU' pseudo-op | 
|---|
| 1201 |  | 
|---|
| 1202 | The m68k `FEQU' pseudo-op is not supported. | 
|---|
| 1203 |  | 
|---|
| 1204 | * `NOOBJ' pseudo-op | 
|---|
| 1205 |  | 
|---|
| 1206 | The m68k `NOOBJ' pseudo-op is not supported. | 
|---|
| 1207 |  | 
|---|
| 1208 | * `OPT' branch control options | 
|---|
| 1209 |  | 
|---|
| 1210 | The m68k `OPT' branch control options--`B', `BRS', `BRB', `BRL', | 
|---|
| 1211 | and `BRW'--are ignored.  `as' automatically relaxes all branches, | 
|---|
| 1212 | whether forward or backward, to an appropriate size, so these | 
|---|
| 1213 | options serve no purpose. | 
|---|
| 1214 |  | 
|---|
| 1215 | * `OPT' list control options | 
|---|
| 1216 |  | 
|---|
| 1217 | The following m68k `OPT' list control options are ignored: `C', | 
|---|
| 1218 | `CEX', `CL', `CRE', `E', `G', `I', `M', `MEX', `MC', `MD', `X'. | 
|---|
| 1219 |  | 
|---|
| 1220 | * other `OPT' options | 
|---|
| 1221 |  | 
|---|
| 1222 | The following m68k `OPT' options are ignored: `NEST', `O', `OLD', | 
|---|
| 1223 | `OP', `P', `PCO', `PCR', `PCS', `R'. | 
|---|
| 1224 |  | 
|---|
| 1225 | * `OPT' `D' option is default | 
|---|
| 1226 |  | 
|---|
| 1227 | The m68k `OPT' `D' option is the default, unlike the MRI assembler. | 
|---|
| 1228 | `OPT NOD' may be used to turn it off. | 
|---|
| 1229 |  | 
|---|
| 1230 | * `XREF' pseudo-op. | 
|---|
| 1231 |  | 
|---|
| 1232 | The m68k `XREF' pseudo-op is ignored. | 
|---|
| 1233 |  | 
|---|
| 1234 | * `.debug' pseudo-op | 
|---|
| 1235 |  | 
|---|
| 1236 | The i960 `.debug' pseudo-op is not supported. | 
|---|
| 1237 |  | 
|---|
| 1238 | * `.extended' pseudo-op | 
|---|
| 1239 |  | 
|---|
| 1240 | The i960 `.extended' pseudo-op is not supported. | 
|---|
| 1241 |  | 
|---|
| 1242 | * `.list' pseudo-op. | 
|---|
| 1243 |  | 
|---|
| 1244 | The various options of the i960 `.list' pseudo-op are not | 
|---|
| 1245 | supported. | 
|---|
| 1246 |  | 
|---|
| 1247 | * `.optimize' pseudo-op | 
|---|
| 1248 |  | 
|---|
| 1249 | The i960 `.optimize' pseudo-op is not supported. | 
|---|
| 1250 |  | 
|---|
| 1251 | * `.output' pseudo-op | 
|---|
| 1252 |  | 
|---|
| 1253 | The i960 `.output' pseudo-op is not supported. | 
|---|
| 1254 |  | 
|---|
| 1255 | * `.setreal' pseudo-op | 
|---|
| 1256 |  | 
|---|
| 1257 | The i960 `.setreal' pseudo-op is not supported. | 
|---|
| 1258 |  | 
|---|
| 1259 |  | 
|---|
| 1260 |  | 
|---|
| 1261 | File: as.info,  Node: MD,  Next: o,  Prev: M,  Up: Invoking | 
|---|
| 1262 |  | 
|---|
| 1263 | Dependency Tracking: `--MD' | 
|---|
| 1264 | =========================== | 
|---|
| 1265 |  | 
|---|
| 1266 | `as' can generate a dependency file for the file it creates.  This | 
|---|
| 1267 | file consists of a single rule suitable for `make' describing the | 
|---|
| 1268 | dependencies of the main source file. | 
|---|
| 1269 |  | 
|---|
| 1270 | The rule is written to the file named in its argument. | 
|---|
| 1271 |  | 
|---|
| 1272 | This feature is used in the automatic updating of makefiles. | 
|---|
| 1273 |  | 
|---|
| 1274 |  | 
|---|
| 1275 | File: as.info,  Node: o,  Next: R,  Prev: MD,  Up: Invoking | 
|---|
| 1276 |  | 
|---|
| 1277 | Name the Object File: `-o' | 
|---|
| 1278 | ========================== | 
|---|
| 1279 |  | 
|---|
| 1280 | There is always one object file output when you run `as'.  By | 
|---|
| 1281 | default it has the name `a.out' (or `b.out', for Intel 960 targets | 
|---|
| 1282 | only).  You use this option (which takes exactly one filename) to give | 
|---|
| 1283 | the object file a different name. | 
|---|
| 1284 |  | 
|---|
| 1285 | Whatever the object file is called, `as' overwrites any existing | 
|---|
| 1286 | file of the same name. | 
|---|
| 1287 |  | 
|---|
| 1288 |  | 
|---|
| 1289 | File: as.info,  Node: R,  Next: statistics,  Prev: o,  Up: Invoking | 
|---|
| 1290 |  | 
|---|
| 1291 | Join Data and Text Sections: `-R' | 
|---|
| 1292 | ================================= | 
|---|
| 1293 |  | 
|---|
| 1294 | `-R' tells `as' to write the object file as if all data-section data | 
|---|
| 1295 | lives in the text section.  This is only done at the very last moment: | 
|---|
| 1296 | your binary data are the same, but data section parts are relocated | 
|---|
| 1297 | differently.  The data section part of your object file is zero bytes | 
|---|
| 1298 | long because all its bytes are appended to the text section.  (*Note | 
|---|
| 1299 | Sections and Relocation: Sections.) | 
|---|
| 1300 |  | 
|---|
| 1301 | When you specify `-R' it would be possible to generate shorter | 
|---|
| 1302 | address displacements (because we do not have to cross between text and | 
|---|
| 1303 | data section).  We refrain from doing this simply for compatibility with | 
|---|
| 1304 | older versions of `as'.  In future, `-R' may work this way. | 
|---|
| 1305 |  | 
|---|
| 1306 | When `as' is configured for COFF or ELF output, this option is only | 
|---|
| 1307 | useful if you use sections named `.text' and `.data'. | 
|---|
| 1308 |  | 
|---|
| 1309 | `-R' is not supported for any of the HPPA targets.  Using `-R' | 
|---|
| 1310 | generates a warning from `as'. | 
|---|
| 1311 |  | 
|---|
| 1312 |  | 
|---|
| 1313 | File: as.info,  Node: statistics,  Next: traditional-format,  Prev: R,  Up: Invoking | 
|---|
| 1314 |  | 
|---|
| 1315 | Display Assembly Statistics: `--statistics' | 
|---|
| 1316 | =========================================== | 
|---|
| 1317 |  | 
|---|
| 1318 | Use `--statistics' to display two statistics about the resources | 
|---|
| 1319 | used by `as': the maximum amount of space allocated during the assembly | 
|---|
| 1320 | (in bytes), and the total execution time taken for the assembly (in CPU | 
|---|
| 1321 | seconds). | 
|---|
| 1322 |  | 
|---|
| 1323 |  | 
|---|
| 1324 | File: as.info,  Node: traditional-format,  Next: v,  Prev: statistics,  Up: Invoking | 
|---|
| 1325 |  | 
|---|
| 1326 | Compatible Output: `--traditional-format' | 
|---|
| 1327 | ========================================= | 
|---|
| 1328 |  | 
|---|
| 1329 | For some targets, the output of `as' is different in some ways from | 
|---|
| 1330 | the output of some existing assembler.  This switch requests `as' to | 
|---|
| 1331 | use the traditional format instead. | 
|---|
| 1332 |  | 
|---|
| 1333 | For example, it disables the exception frame optimizations which | 
|---|
| 1334 | `as' normally does by default on `gcc' output. | 
|---|
| 1335 |  | 
|---|
| 1336 |  | 
|---|
| 1337 | File: as.info,  Node: v,  Next: W,  Prev: traditional-format,  Up: Invoking | 
|---|
| 1338 |  | 
|---|
| 1339 | Announce Version: `-v' | 
|---|
| 1340 | ====================== | 
|---|
| 1341 |  | 
|---|
| 1342 | You can find out what version of as is running by including the | 
|---|
| 1343 | option `-v' (which you can also spell as `-version') on the command | 
|---|
| 1344 | line. | 
|---|
| 1345 |  | 
|---|
| 1346 |  | 
|---|
| 1347 | File: as.info,  Node: W,  Next: Z,  Prev: v,  Up: Invoking | 
|---|
| 1348 |  | 
|---|
| 1349 | Control Warnings: `-W', `--warn', `--no-warn', `--fatal-warnings' | 
|---|
| 1350 | ================================================================= | 
|---|
| 1351 |  | 
|---|
| 1352 | `as' should never give a warning or error message when assembling | 
|---|
| 1353 | compiler output.  But programs written by people often cause `as' to | 
|---|
| 1354 | give a warning that a particular assumption was made.  All such | 
|---|
| 1355 | warnings are directed to the standard error file. | 
|---|
| 1356 |  | 
|---|
| 1357 | If you use the `-W' and `--no-warn' options, no warnings are issued. | 
|---|
| 1358 | This only affects the warning messages: it does not change any | 
|---|
| 1359 | particular of how `as' assembles your file.  Errors, which stop the | 
|---|
| 1360 | assembly, are still reported. | 
|---|
| 1361 |  | 
|---|
| 1362 | If you use the `--fatal-warnings' option, `as' considers files that | 
|---|
| 1363 | generate warnings to be in error. | 
|---|
| 1364 |  | 
|---|
| 1365 | You can switch these options off again by specifying `--warn', which | 
|---|
| 1366 | causes warnings to be output as usual. | 
|---|
| 1367 |  | 
|---|
| 1368 |  | 
|---|
| 1369 | File: as.info,  Node: Z,  Prev: W,  Up: Invoking | 
|---|
| 1370 |  | 
|---|
| 1371 | Generate Object File in Spite of Errors: `-Z' | 
|---|
| 1372 | ============================================= | 
|---|
| 1373 |  | 
|---|
| 1374 | After an error message, `as' normally produces no output.  If for | 
|---|
| 1375 | some reason you are interested in object file output even after `as' | 
|---|
| 1376 | gives an error message on your program, use the `-Z' option.  If there | 
|---|
| 1377 | are any errors, `as' continues anyways, and writes an object file after | 
|---|
| 1378 | a final warning message of the form `N errors, M warnings, generating | 
|---|
| 1379 | bad object file.' | 
|---|
| 1380 |  | 
|---|
| 1381 |  | 
|---|
| 1382 | File: as.info,  Node: Syntax,  Next: Sections,  Prev: Invoking,  Up: Top | 
|---|
| 1383 |  | 
|---|
| 1384 | Syntax | 
|---|
| 1385 | ****** | 
|---|
| 1386 |  | 
|---|
| 1387 | This chapter describes the machine-independent syntax allowed in a | 
|---|
| 1388 | source file.  `as' syntax is similar to what many other assemblers use; | 
|---|
| 1389 | it is inspired by the BSD 4.2 assembler, except that `as' does not | 
|---|
| 1390 | assemble Vax bit-fields. | 
|---|
| 1391 |  | 
|---|
| 1392 | * Menu: | 
|---|
| 1393 |  | 
|---|
| 1394 | * Preprocessing::              Preprocessing | 
|---|
| 1395 | * Whitespace::                  Whitespace | 
|---|
| 1396 | * Comments::                    Comments | 
|---|
| 1397 | * Symbol Intro::                Symbols | 
|---|
| 1398 | * Statements::                  Statements | 
|---|
| 1399 | * Constants::                   Constants | 
|---|
| 1400 |  | 
|---|
| 1401 |  | 
|---|
| 1402 | File: as.info,  Node: Preprocessing,  Next: Whitespace,  Up: Syntax | 
|---|
| 1403 |  | 
|---|
| 1404 | Preprocessing | 
|---|
| 1405 | ============= | 
|---|
| 1406 |  | 
|---|
| 1407 | The `as' internal preprocessor: | 
|---|
| 1408 | * adjusts and removes extra whitespace.  It leaves one space or tab | 
|---|
| 1409 | before the keywords on a line, and turns any other whitespace on | 
|---|
| 1410 | the line into a single space. | 
|---|
| 1411 |  | 
|---|
| 1412 | * removes all comments, replacing them with a single space, or an | 
|---|
| 1413 | appropriate number of newlines. | 
|---|
| 1414 |  | 
|---|
| 1415 | * converts character constants into the appropriate numeric values. | 
|---|
| 1416 |  | 
|---|
| 1417 | It does not do macro processing, include file handling, or anything | 
|---|
| 1418 | else you may get from your C compiler's preprocessor.  You can do | 
|---|
| 1419 | include file processing with the `.include' directive (*note | 
|---|
| 1420 | `.include': Include.).  You can use the GNU C compiler driver to get | 
|---|
| 1421 | other "CPP" style preprocessing by giving the input file a `.S' suffix. | 
|---|
| 1422 | *Note Options Controlling the Kind of Output: (gcc.info)Overall | 
|---|
| 1423 | Options. | 
|---|
| 1424 |  | 
|---|
| 1425 | Excess whitespace, comments, and character constants cannot be used | 
|---|
| 1426 | in the portions of the input text that are not preprocessed. | 
|---|
| 1427 |  | 
|---|
| 1428 | If the first line of an input file is `#NO_APP' or if you use the | 
|---|
| 1429 | `-f' option, whitespace and comments are not removed from the input | 
|---|
| 1430 | file.  Within an input file, you can ask for whitespace and comment | 
|---|
| 1431 | removal in specific portions of the by putting a line that says `#APP' | 
|---|
| 1432 | before the text that may contain whitespace or comments, and putting a | 
|---|
| 1433 | line that says `#NO_APP' after this text.  This feature is mainly | 
|---|
| 1434 | intend to support `asm' statements in compilers whose output is | 
|---|
| 1435 | otherwise free of comments and whitespace. | 
|---|
| 1436 |  | 
|---|
| 1437 |  | 
|---|
| 1438 | File: as.info,  Node: Whitespace,  Next: Comments,  Prev: Preprocessing,  Up: Syntax | 
|---|
| 1439 |  | 
|---|
| 1440 | Whitespace | 
|---|
| 1441 | ========== | 
|---|
| 1442 |  | 
|---|
| 1443 | "Whitespace" is one or more blanks or tabs, in any order. | 
|---|
| 1444 | Whitespace is used to separate symbols, and to make programs neater for | 
|---|
| 1445 | people to read.  Unless within character constants (*note Character | 
|---|
| 1446 | Constants: Characters.), any whitespace means the same as exactly one | 
|---|
| 1447 | space. | 
|---|
| 1448 |  | 
|---|