as
Quick Reference
Command Name:
as
Category:
programming
Platform:
linux
Basic Usage:
Common Use Cases
Syntax
as [options] -o objfile file.s
Options
Option | Description |
---|---|
-a[cdghlmns] | Turn on listings (combinations of: c=omit false conditionals, d=debug, g=general info, h=include high-level source, l=assembly, m=macros, n=forms processing, s=symbols) |
--alternate | Use alternative macro syntax |
-D | Produce assembler debugging information |
--debug-prefix-map=old=new | Map debug information paths |
--defsym SYM=VAL | Define symbol SYM to value VAL |
-f | Skip whitespace and comment preprocessing |
-g/--gen-debug | Generate debugging information |
--gstabs | Generate STABS debugging information |
--gdwarf-2 | Generate DWARF2 debugging information |
--help | Show help message and exit |
-I PATH | Add PATH to include file search path |
-J | Don't warn about signed overflow |
-K | Warn when differences altered for long displacements |
-L/--keep-locals | Keep local symbols (e.g., starting with 'L') |
--listing-lhs-width=NUM | Set width in columns of listing hex output |
--listing-cont-lines=NUM | Set maximum number of continuation lines |
--listing-lhs-width-alternate=NUM | Set alternate width in columns for listing hex output |
-march=CPU | Set architecture (e.g., i686, armv7-a) |
--32/--64 | Generate 32-bit/64-bit code |
-n | Do not optimize code alignment |
-o OBJFILE | Name the output file |
-R | Fold data section into text section |
--statistics | Print statistics about the assembly |
--strip-local-absolute | Strip local absolute symbols |
--version | Print assembler version |
-W/--no-warn | Suppress/enable warnings |
--warn | Enable warnings |
--fatal-warnings | Treat warnings as errors |
--target-help | Show target-specific options |
--size-check=[error|warning] | Issue error or warning for invalid size modifiers |
Examples
How to Use These Examples
The examples below show common ways to use the as
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Assemble a source file into an object file as -o hello.o hello.s
Advanced Examples:
# Assemble for a specific architecture as -march=armv7-a -o arm_code.o arm_code.s