AS - the portable GNU assembler.


SUBMITTED BY: Guest

DATE: June 4, 2014, 6:21 a.m.

FORMAT: Text only

SIZE: 25.3 kB

HITS: 5006

  1. NAME
  2. AS - the portable GNU assembler.
  3. SYNOPSIS
  4. as [-a[cdhlns][=file]] [--alternate] [-D]
  5. [--defsym sym=val] [-f] [-g] [--gstabs] [--gstabs+]
  6. [--gdwarf-2] [--help] [-I dir] [-J] [-K] [-L]
  7. [--listing-lhs-width=NUM] [--listing-lhs-width2=NUM]
  8. [--listing-rhs-width=NUM] [--listing-cont-lines=NUM]
  9. [--keep-locals] [-o objfile] [-R] [--statistics] [-v]
  10. [-version] [--version] [-W] [--warn] [--fatal-warnings]
  11. [-w] [-x] [-Z] [--target-help] [target-options]
  12. [--|files ...]
  13. Target Alpha options:
  14. [-mcpu]
  15. [-mdebug | -no-mdebug]
  16. [-relax] [-g] [-Gsize]
  17. [-F] [-32addr]
  18. Target ARC options:
  19. [-marc[5|6|7|8]]
  20. [-EB|-EL]
  21. Target ARM options:
  22. [-mcpu=processor[+extension...]]
  23. [-march=architecture[+extension...]]
  24. [-mfpu=floating-point-format]
  25. [-mfloat-abi=abi]
  26. [-meabi=ver]
  27. [-mthumb]
  28. [-EB|-EL]
  29. [-mapcs-32|-mapcs-26|-mapcs-float|
  30. -mapcs-reentrant]
  31. [-mthumb-interwork] [-moabi] [-k]
  32. Target CRIS options:
  33. [--underscore | --no-underscore]
  34. [--pic] [-N]
  35. [--emulation=criself | --emulation=crisaout]
  36. Target D10V options:
  37. [-O]
  38. Target D30V options:
  39. [-O|-n|-N]
  40. Target i386 options:
  41. [--32|--64] [-n]
  42. Target i960 options:
  43. [-ACA|-ACA_A|-ACB|-ACC|-AKA|-AKB|
  44. -AKC|-AMC]
  45. [-b] [-no-relax]
  46. Target IP2K options:
  47. [-mip2022|-mip2022ext]
  48. Target M32R options:
  49. [--m32rx|--[no-]warn-explicit-parallel-conflicts|
  50. --W[n]p]
  51. Target M680X0 options:
  52. [-l] [-m68000|-m68010|-m68020|...]
  53. Target M68HC11 options:
  54. [-m68hc11|-m68hc12|-m68hcs12]
  55. [-mshort|-mlong]
  56. [-mshort-double|-mlong-double]
  57. [--force-long-branchs] [--short-branchs]
  58. [--strict-direct-mode] [--print-insn-syntax]
  59. [--print-opcodes] [--generate-example]
  60. Target MCORE options:
  61. [-jsri2bsr] [-sifilter] [-relax]
  62. [-mcpu=[210|340]]
  63. Target MIPS options:
  64. [-nocpp] [-EL] [-EB] [-O[optimization level]]
  65. [-g[debug level]] [-G num] [-KPIC] [-call_shared]
  66. [-non_shared] [-xgot]
  67. [-mabi=ABI] [-32] [-n32] [-64] [-mfp32] [-mgp32]
  68. [-march=CPU] [-mtune=CPU] [-mips1] [-mips2]
  69. [-mips3] [-mips4] [-mips5] [-mips32] [-mips32r2]
  70. [-mips64] [-mips64r2]
  71. [-construct-floats] [-no-construct-floats]
  72. [-trap] [-no-break] [-break] [-no-trap]
  73. [-mfix7000] [-mno-fix7000]
  74. [-mips16] [-no-mips16]
  75. [-mips3d] [-no-mips3d]
  76. [-mdmx] [-no-mdmx]
  77. [-mdebug] [-no-mdebug]
  78. [-mpdr] [-mno-pdr]
  79. Target MMIX options:
  80. [--fixed-special-register-names] [--globalize-symbols]
  81. [--gnu-syntax] [--relax] [--no-predefined-symbols]
  82. [--no-expand] [--no-merge-gregs] [-x]
  83. [--linker-allocated-gregs]
  84. Target PDP11 options:
  85. [-mpic|-mno-pic] [-mall] [-mno-extensions]
  86. [-mextension|-mno-extension]
  87. [-mcpu] [-mmachine]
  88. Target picoJava options:
  89. [-mb|-me]
  90. Target PowerPC options:
  91. [-mpwrx|-mpwr2|-mpwr|-m601|-mppc|-mppc32|-m603|-m604|
  92. -m403|-m405|-mppc64|-m620|-mppc64bridge|-mbooke|
  93. -mbooke32|-mbooke64]
  94. [-mcom|-many|-maltivec] [-memb]
  95. [-mregnames|-mno-regnames]
  96. [-mrelocatable|-mrelocatable-lib]
  97. [-mlittle|-mlittle-endian|-mbig|-mbig-endian]
  98. [-msolaris|-mno-solaris]
  99. Target SPARC options:
  100. [-Av6|-Av7|-Av8|-Asparclet|-Asparclite
  101. -Av8plus|-Av8plusa|-Av9|-Av9a]
  102. [-xarch=v8plus|-xarch=v8plusa] [-bump]
  103. [-32|-64]
  104. Target TIC54X options:
  105. [-mcpu=54[123589]|-mcpu=54[56]lp] [-mfar-mode|-mf]
  106. [-merrors-to-file <filename>|-me <filename>]
  107. Target Xtensa options:
  108. [--[no-]density] [--[no-]relax] [--[no-]generics]
  109. [--[no-]text-section-literals]
  110. [--[no-]target-align] [--[no-]longcalls]
  111. DESCRIPTION
  112. GNU as is really a family of assemblers. If you use (or have used) the GNU assembler on one architecture, you should find a fairly similar environment when you use it on another architecture. Each version has much in common with the others, including object file formats, most assembler directives (often called pseudo-ops) and assembler syntax.
  113. as is primarily intended to assemble the output of the GNU C compiler "gcc" for use by the linker "ld". Nevertheless, we've tried to make as assemble correctly everything that other assemblers for the same machine would assemble. Any exceptions are documented explicitly. This doesn't mean as always uses the same syntax as another assembler for the same architecture; for example, we know of several incompatible versions of 680x0 assembly language syntax.
  114. Each time you run as it assembles exactly one source program. The source program is made up of one or more files. (The standard input is also a file.)
  115. You give as a command line that has zero or more input file names. The input files are read (from left file name to right). A command line argument (in any position) that has no special meaning is taken to be an input file name.
  116. If you give as no file names it attempts to read one input file from the as standard input, which is normally your terminal. You may have to type ctl-D to tell as there is no more program to assemble.
  117. Use -- if you need to explicitly name the standard input file in your command line.
  118. If the source is empty, as produces a small, empty object file.
  119. as may write warnings and error messages to the standard error file (usually your terminal). This should not happen when a compiler runs as automatically. Warnings report an assumption made so that as could keep assembling a flawed program; errors report a grave problem that stops the assembly.
  120. If you are invoking as via the GNU C compiler, you can use the -Wa option to pass arguments through to the assembler. The assembler arguments must be separated from each other (and the -Wa) by commas. For example:
  121. gcc -c -g -O -Wa,-alh,-L file.c
  122. This passes two options to the assembler: -alh (emit a listing to standard output with high-level and assembly source) and -L (retain local symbols in the symbol table).
  123. Usually you do not need to use this -Wa mechanism, since many compiler command-line options are automatically passed to the assembler by the compiler. (You can call the GNU compiler driver with the -v option to see precisely what options it passes to each compilation pass, including the assembler.)
  124. OPTIONS
  125. -a[cdhlmns]
  126. Turn on listings, in any of a variety of ways:
  127. -ac
  128. omit false conditionals
  129. -ad
  130. omit debugging directives
  131. -ah
  132. include high-level source
  133. -al
  134. include assembly
  135. -am
  136. include macro expansions
  137. -an
  138. omit forms processing
  139. -as
  140. include symbols
  141. =file
  142. set the name of the listing file
  143. You may combine these options; for example, use -aln for assembly listing without forms processing. The =file option, if used, must be the last one. By itself, -a defaults to -ahls.
  144. --alternate
  145. Begin in alternate macro mode, see @ref{Altmacro,,".altmacro"}.
  146. -D
  147. Ignored. This option is accepted for script compatibility with calls to other assemblers.
  148. --defsym sym=value
  149. Define the symbol sym to be value before assembling the input file. value must be an integer constant. As in C, a leading 0x indicates a hexadecimal value, and a leading 0 indicates an octal value.
  150. -f
  151. ``fast''---skip whitespace and comment preprocessing (assume source is compiler output).
  152. -g
  153. --gen-debug
  154. Generate debugging information for each assembler source line using whichever debug format is preferred by the target. This currently means either STABS, ECOFF or DWARF2.
  155. --gstabs
  156. Generate stabs debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it.
  157. --gstabs+
  158. Generate stabs debugging information for each assembler line, with GNU extensions that probably only gdb can handle, and that could make other debuggers crash or refuse to read your program. This may help debugging assembler code. Currently the only GNU extension is the location of the current working directory at assembling time.
  159. --gdwarf-2
  160. Generate DWARF2 debugging information for each assembler line. This may help debugging assembler code, if the debugger can handle it. Note---this option is only supported by some targets, not all of them.
  161. --help
  162. Print a summary of the command line options and exit.
  163. --target-help
  164. Print a summary of all target specific options and exit.
  165. -I dir
  166. Add directory dir to the search list for ".include" directives.
  167. -J
  168. Don't warn about signed overflow.
  169. -K
  170. Issue warnings when difference tables altered for long displacements.
  171. -L
  172. --keep-locals
  173. Keep (in the symbol table) local symbols. On traditional a.out systems these start with L, but different systems have different local label prefixes.
  174. --listing-lhs-width=number
  175. Set the maximum width, in words, of the output data column for an assembler listing to number.
  176. --listing-lhs-width2=number
  177. Set the maximum width, in words, of the output data column for continuation lines in an assembler listing to number.
  178. --listing-rhs-width=number
  179. Set the maximum width of an input source line, as displayed in a listing, to number bytes.
  180. --listing-cont-lines=number
  181. Set the maximum number of lines printed in a listing for a single line of input to number + 1.
  182. -o objfile
  183. Name the object-file output from as objfile.
  184. -R
  185. Fold the data section into the text section.
  186. --statistics
  187. Print the maximum space (in bytes) and total time (in seconds) used by assembly.
  188. --strip-local-absolute
  189. Remove local absolute symbols from the outgoing symbol table.
  190. -v
  191. -version
  192. Print the as version.
  193. --version
  194. Print the as version and exit.
  195. -W
  196. --no-warn
  197. Suppress warning messages.
  198. --fatal-warnings
  199. Treat warnings as errors.
  200. --warn
  201. Don't suppress warning messages or treat them as errors.
  202. -w
  203. Ignored.
  204. -x
  205. Ignored.
  206. -Z
  207. Generate an object file even after errors.
  208. -- | files ...
  209. Standard input, or source files to assemble.
  210. The following options are available when as is configured for an ARC processor.
  211. -marc[5|6|7|8]
  212. This option selects the core processor variant.
  213. -EB | -EL
  214. Select either big-endian (-EB) or little-endian (-EL) output.
  215. The following options are available when as is configured for the ARM processor family.
  216. -mcpu=processor[+extension...]
  217. Specify which ARM processor variant is the target.
  218. -march=architecture[+extension...]
  219. Specify which ARM architecture variant is used by the target.
  220. -mfpu=floating-point-format
  221. Select which Floating Point architecture is the target.
  222. -mfloat-abi=abi
  223. Select which floating point ABI is in use.
  224. -mthumb
  225. Enable Thumb only instruction decoding.
  226. -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi
  227. Select which procedure calling convention is in use.
  228. -EB | -EL
  229. Select either big-endian (-EB) or little-endian (-EL) output.
  230. -mthumb-interwork
  231. Specify that the code has been generated with interworking between Thumb and ARM code in mind.
  232. -k
  233. Specify that PIC code has been generated.
  234. See the info pages for documentation of the CRIS-specific options.
  235. The following options are available when as is configured for a D10V processor.
  236. -O
  237. Optimize output by parallelizing instructions.
  238. The following options are available when as is configured for a D30V processor.
  239. -O
  240. Optimize output by parallelizing instructions.
  241. -n
  242. Warn when nops are generated.
  243. -N
  244. Warn when a nop after a 32-bit multiply instruction is generated.
  245. The following options are available when as is configured for the Intel 80960 processor.
  246. -ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC
  247. Specify which variant of the 960 architecture is the target.
  248. -b
  249. Add code to collect statistics about branches taken.
  250. -no-relax
  251. Do not alter compare-and-branch instructions for long displacements; error if necessary.
  252. The following options are available when as is configured for the Ubicom IP2K series.
  253. -mip2022ext
  254. Specifies that the extended IP2022 instructions are allowed.
  255. -mip2022
  256. Restores the default behaviour, which restricts the permitted instructions to just the basic IP2022 ones.
  257. The following options are available when as is configured for the Renesas M32R (formerly Mitsubishi M32R) series.
  258. --m32rx
  259. Specify which processor in the M32R family is the target. The default is normally the M32R, but this option changes it to the M32RX.
  260. --warn-explicit-parallel-conflicts or --Wp
  261. Produce warning messages when questionable parallel constructs are encountered.
  262. --no-warn-explicit-parallel-conflicts or --Wnp
  263. Do not produce warning messages when questionable parallel constructs are encountered.
  264. The following options are available when as is configured for the Motorola 68000 series.
  265. -l
  266. Shorten references to undefined symbols, to one word instead of two.
  267. -m68000 | -m68008 | -m68010 | -m68020 | -m68030
  268. | -m68040 | -m68060 | -m68302 | -m68331 | -m68332
  269. | -m68333 | -m68340 | -mcpu32 | -m5200
  270. Specify what processor in the 68000 family is the target. The default is normally the 68020, but this can be changed at configuration time.
  271. -m68881 | -m68882 | -mno-68881 | -mno-68882
  272. The target machine does (or does not) have a floating-point coprocessor. The default is to assume a coprocessor for 68020, 68030, and cpu32. Although the basic 68000 is not compatible with the 68881, a combination of the two can be specified, since it's possible to do emulation of the coprocessor instructions with the main processor.
  273. -m68851 | -mno-68851
  274. The target machine does (or does not) have a memory-management unit coprocessor. The default is to assume an MMU for 68020 and up.
  275. For details about the PDP-11 machine dependent features options, see @ref{PDP-11-Options}.
  276. -mpic | -mno-pic
  277. Generate position-independent (or position-dependent) code. The default is -mpic.
  278. -mall
  279. -mall-extensions
  280. Enable all instruction set extensions. This is the default.
  281. -mno-extensions
  282. Disable all instruction set extensions.
  283. -mextension | -mno-extension
  284. Enable (or disable) a particular instruction set extension.
  285. -mcpu
  286. Enable the instruction set extensions supported by a particular CPU, and disable all other extensions.
  287. -mmachine
  288. Enable the instruction set extensions supported by a particular machine model, and disable all other extensions.
  289. The following options are available when as is configured for a picoJava processor.
  290. -mb
  291. Generate ``big endian'' format output.
  292. -ml
  293. Generate ``little endian'' format output.
  294. The following options are available when as is configured for the Motorola 68HC11 or 68HC12 series.
  295. -m68hc11 | -m68hc12 | -m68hcs12
  296. Specify what processor is the target. The default is defined by the configuration option when building the assembler.
  297. -mshort
  298. Specify to use the 16-bit integer ABI.
  299. -mlong
  300. Specify to use the 32-bit integer ABI.
  301. -mshort-double
  302. Specify to use the 32-bit double ABI.
  303. -mlong-double
  304. Specify to use the 64-bit double ABI.
  305. --force-long-branchs
  306. Relative branches are turned into absolute ones. This concerns conditional branches, unconditional branches and branches to a sub routine.
  307. -S | --short-branchs
  308. Do not turn relative branchs into absolute ones when the offset is out of range.
  309. --strict-direct-mode
  310. Do not turn the direct addressing mode into extended addressing mode when the instruction does not support direct addressing mode.
  311. --print-insn-syntax
  312. Print the syntax of instruction in case of error.
  313. --print-opcodes
  314. print the list of instructions with syntax and then exit.
  315. --generate-example
  316. print an example of instruction for each possible instruction and then exit. This option is only useful for testing as.
  317. The following options are available when as is configured for the SPARC architecture:
  318. -Av6 | -Av7 | -Av8 | -Asparclet | -Asparclite
  319. -Av8plus | -Av8plusa | -Av9 | -Av9a
  320. Explicitly select a variant of the SPARC architecture.
  321. -Av8plus and -Av8plusa select a 32 bit environment. -Av9 and -Av9a select a 64 bit environment.
  322. -Av8plusa and -Av9a enable the SPARC V9 instruction set with UltraSPARC extensions.
  323. -xarch=v8plus | -xarch=v8plusa
  324. For compatibility with the Solaris v9 assembler. These options are equivalent to -Av8plus and -Av8plusa, respectively.
  325. -bump
  326. Warn when the assembler switches to another architecture.
  327. The following options are available when as is configured for the 'c54x architecture.
  328. -mfar-mode
  329. Enable extended addressing mode. All addresses and relocations will assume extended addressing (usually 23 bits).
  330. -mcpu=CPU_VERSION
  331. Sets the CPU version being compiled for.
  332. -merrors-to-file FILENAME
  333. Redirect error output to a file, for broken systems which don't support such behaviour in the shell.
  334. The following options are available when as is configured for a MIPS processor.
  335. -G num
  336. This option sets the largest size of an object that can be referenced implicitly with the "gp" register. It is only accepted for targets that use ECOFF format, such as a DECstation running Ultrix. The default value is 8.
  337. -EB
  338. Generate ``big endian'' format output.
  339. -EL
  340. Generate ``little endian'' format output.
  341. -mips1
  342. -mips2
  343. -mips3
  344. -mips4
  345. -mips5
  346. -mips32
  347. -mips32r2
  348. -mips64
  349. -mips64r2
  350. Generate code for a particular MIPS Instruction Set Architecture level. -mips1 is an alias for -march=r3000, -mips2 is an alias for -march=r6000, -mips3 is an alias for -march=r4000 and -mips4 is an alias for -march=r8000. -mips5, -mips32, -mips32r2, -mips64, and -mips64r2 correspond to generic MIPS V, MIPS32, MIPS32 Release 2, MIPS64, and MIPS64 Release 2 ISA processors, respectively.
  351. -march=CPU
  352. Generate code for a particular MIPS cpu.
  353. -mtune=cpu
  354. Schedule and tune for a particular MIPS cpu.
  355. -mfix7000
  356. -mno-fix7000
  357. Cause nops to be inserted if the read of the destination register of an mfhi or mflo instruction occurs in the following two instructions.
  358. -mdebug
  359. -no-mdebug
  360. Cause stabs-style debugging output to go into an ECOFF-style .mdebug section instead of the standard ELF .stabs sections.
  361. -mpdr
  362. -mno-pdr
  363. Control generation of ".pdr" sections.
  364. -mgp32
  365. -mfp32
  366. The register sizes are normally inferred from the ISA and ABI, but these flags force a certain group of registers to be treated as 32 bits wide at all times. -mgp32 controls the size of general-purpose registers and -mfp32 controls the size of floating-point registers.
  367. -mips16
  368. -no-mips16
  369. Generate code for the MIPS 16 processor. This is equivalent to putting ".set mips16" at the start of the assembly file. -no-mips16 turns off this option.
  370. -mips3d
  371. -no-mips3d
  372. Generate code for the MIPS-3D Application Specific Extension. This tells the assembler to accept MIPS-3D instructions. -no-mips3d turns off this option.
  373. -mdmx
  374. -no-mdmx
  375. Generate code for the MDMX Application Specific Extension. This tells the assembler to accept MDMX instructions. -no-mdmx turns off this option.
  376. --construct-floats
  377. --no-construct-floats
  378. The --no-construct-floats option disables the construction of double width floating point constants by loading the two halves of the value into the two single width floating point registers that make up the double width register. By default --construct-floats is selected, allowing construction of these floating point constants.
  379. --emulation=name
  380. This option causes as to emulate as configured for some other target, in all respects, including output format (choosing between ELF and ECOFF only), handling of pseudo-opcodes which may generate debugging information or store symbol table information, and default endianness. The available configuration names are: mipsecoff, mipself, mipslecoff, mipsbecoff, mipslelf, mipsbelf. The first two do not alter the default endianness from that of the primary target for which the assembler was configured; the others change the default to little- or big-endian as indicated by the b or l in the name. Using -EB or -EL will override the endianness selection in any case.
  381. This option is currently supported only when the primary target as is configured for is a MIPS ELF or ECOFF target. Furthermore, the primary target or others specified with --enable-targets=... at configuration time must include support for the other format, if both are to be available. For example, the Irix 5 configuration includes support for both.
  382. Eventually, this option will support more configurations, with more fine-grained control over the assembler's behavior, and will be supported for more processors.
  383. -nocpp
  384. as ignores this option. It is accepted for compatibility with the native tools.
  385. --trap
  386. --no-trap
  387. --break
  388. --no-break
  389. Control how to deal with multiplication overflow and division by zero. --trap or --no-break (which are synonyms) take a trap exception (and only work for Instruction Set Architecture level 2 and higher); --break or --no-trap (also synonyms, and the default) take a break exception.
  390. -n
  391. When this option is used, as will issue a warning every time it generates a nop instruction from a macro.
  392. The following options are available when as is configured for an MCore processor.
  393. -jsri2bsr
  394. -nojsri2bsr
  395. Enable or disable the JSRI to BSR transformation. By default this is enabled. The command line option -nojsri2bsr can be used to disable it.
  396. -sifilter
  397. -nosifilter
  398. Enable or disable the silicon filter behaviour. By default this is disabled. The default can be overridden by the -sifilter command line option.
  399. -relax
  400. Alter jump instructions for long displacements.
  401. -mcpu=[210|340]
  402. Select the cpu type on the target hardware. This controls which instructions can be assembled.
  403. -EB
  404. Assemble for a big endian target.
  405. -EL
  406. Assemble for a little endian target.
  407. See the info pages for documentation of the MMIX-specific options.
  408. The following options are available when as is configured for an Xtensa processor.
  409. --density | --no-density
  410. Enable or disable use of instructions from the Xtensa code density option. This is enabled by default when the Xtensa processor supports the code density option.
  411. --relax | --no-relax
  412. Enable or disable instruction relaxation. This is enabled by default. Note: In the current implementation, these options also control whether assembler optimizations are performed, making these options equivalent to --generics and --no-generics.
  413. --generics | --no-generics
  414. Enable or disable all assembler transformations of Xtensa instructions. The default is --generics; --no-generics should be used only in the rare cases when the instructions must be exactly as specified in the assembly source.
  415. --text-section-literals | --no-text-section-literals
  416. With --text-section-literals, literal pools are interspersed in the text section. The default is --no-text-section-literals, which places literals in a separate section in the output file.
  417. --target-align | --no-target-align
  418. Enable or disable automatic alignment to reduce branch penalties at the expense of some code density. The default is --target-align.
  419. --longcalls | --no-longcalls
  420. Enable or disable transformation of call instructions to allow calls across a greater range of addresses. The default is --no-longcalls.
  421. SEE ALSO
  422. gcc(1), ld(1), and the Info entries for binutils and ld.
  423. COPYRIGHT
  424. Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002 Free Software Foundation, Inc.
  425. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''.

comments powered by Disqus