info > AS

AS(1) GNU Development Tools AS(1)

📖 NAME

AS - the portable GNU assembler.

🚀 Quick Reference

Use CaseCommandDescription
Assemble a source fileas -o output.o input.s🧩 Assemble one or more input files into an object file
Assemble with debug infoas -g -o output.o input.s🔍 Generate debugging information (STABS, DWARF, etc.)
Generate listing with assemblyas -alh -o output.o input.s📋 Output a listing to stdout with high-level and assembly source
Specify target architectureas -march=armv8-a -o output.o input.sđŸŽ¯ Restrict instructions to a specific architecture
Define a symbol valueas --defsym sym=0x100 -o output.o input.sđŸ”ĸ Define a symbol before assembly
Compress debug sectionsas --compress-debug-sections -o output.o input.sđŸ—œī¸ Compress DWARF debug sections with zlib
Read options from fileas @options.txt📄 Read command-line options from a file
Fast assembly (skip preprocessing)as -f -o output.o input.s⚡ Assume source is compiler output, skip whitespace/comment preprocessing
Keep local symbolsas -L -o output.o input.sđŸˇī¸ Retain local symbols (e.g., .L labels) in symbol table
Generate position-independent code (RISC-V/ARC)as -fpic -o output.o input.s🔗 Generate PIC code

📋 SYNOPSIS

as [-a[cdghlns][=file]] [--alternate] [-D]
 [--compress-debug-sections]  [--nocompress-debug-sections]
 [--debug-prefix-map old=new]
 [--defsym sym=val] [-f] [-g] [--gstabs]
 [--gstabs+] [--gdwarf-<N>] [--gdwarf-sections]
 [--gdwarf-cie-version=VERSION]
 [--help] [-I dir] [-J]
 [-K] [-L] [--listing-lhs-width=NUM]
 [--listing-lhs-width2=NUM] [--listing-rhs-width=NUM]
 [--listing-cont-lines=NUM] [--keep-locals]
 [--no-pad-sections]
 [-o objfile] [-R]
 [--statistics]
 [-v] [-version] [--version]
 [-W] [--warn] [--fatal-warnings] [-w] [-x]
 [-Z] [@FILE]
 [--sectname-subst] [--size-check=[error|warning]]
 [--elf-stt-common=[no|yes]]
 [--generate-missing-build-notes=[no|yes]]
 [--multibyte-handling=[allow|warn|warn-sym-only]]
 [--target-help] [target-options]
 [--|files ...]

đŸŽ¯ TARGET

đŸ–Ĩī¸ AArch64 options

đŸ–Ĩī¸ Alpha options

đŸ–Ĩī¸ ARC options

đŸ–Ĩī¸ ARM options

đŸ–Ĩī¸ Blackfin options

đŸ–Ĩī¸ BPF options

đŸ–Ĩī¸ CRIS options

đŸ–Ĩī¸ C-SKY options

đŸ–Ĩī¸ D10V options

đŸ–Ĩī¸ D30V options

đŸ–Ĩī¸ Epiphany options

đŸ–Ĩī¸ H8/300 options

đŸ–Ĩī¸ i386 options

đŸ–Ĩī¸ IA-64 options

đŸ–Ĩī¸ IP2K options

đŸ–Ĩī¸ M32C options

đŸ–Ĩī¸ M32R options

đŸ–Ĩī¸ M680X0 options

đŸ–Ĩī¸ M68HC11 options

đŸ–Ĩī¸ MCORE options

đŸ–Ĩī¸ Meta options

đŸ–Ĩī¸ MicroBlaze options

No specific options listed in this man page.

đŸ–Ĩī¸ MIPS options

đŸ–Ĩī¸ MMIX options

đŸ–Ĩī¸ Nios II options

đŸ–Ĩī¸ NDS32 options

đŸ–Ĩī¸ PDP11 options

đŸ–Ĩī¸ picoJava options

đŸ–Ĩī¸ PowerPC options

đŸ–Ĩī¸ PRU options

đŸ–Ĩī¸ RISC-V options

đŸ–Ĩī¸ RL78 options

đŸ–Ĩī¸ RX options

đŸ–Ĩī¸ s390 options

đŸ–Ĩī¸ SCORE options

đŸ–Ĩī¸ SPARC options

đŸ–Ĩī¸ TIC54X options

đŸ–Ĩī¸ TIC6X options

đŸ–Ĩī¸ TILE-Gx options

đŸ–Ĩī¸ Visium options

đŸ–Ĩī¸ Xtensa options

đŸ–Ĩī¸ Z80 options

📝 DESCRIPTION

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.

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.

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.)

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.

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.

Use -- if you need to explicitly name the standard input file in your command line.

If the source is empty, as produces a small, empty object file.

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.

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:

gcc -c -g -O -Wa,-alh,-L file.c

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).

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.)

âš™ī¸ OPTIONS

📚 SEE ALSO

gcc(1), ld(1), and the Info entries for binutils and ld.

ÂŠī¸ COPYRIGHT

Copyright (c) 1991-2022 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 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".

binutils-2.38 2025-12-03 AS(1)

AS
📖 NAME 🚀 Quick Reference 📋 SYNOPSIS đŸŽ¯ TARGET
đŸ–Ĩī¸ AArch64 options đŸ–Ĩī¸ Alpha options đŸ–Ĩī¸ ARC options đŸ–Ĩī¸ ARM options đŸ–Ĩī¸ Blackfin options đŸ–Ĩī¸ BPF options đŸ–Ĩī¸ CRIS options đŸ–Ĩī¸ C-SKY options đŸ–Ĩī¸ D10V options đŸ–Ĩī¸ D30V options đŸ–Ĩī¸ Epiphany options đŸ–Ĩī¸ H8/300 options đŸ–Ĩī¸ i386 options đŸ–Ĩī¸ IA-64 options đŸ–Ĩī¸ IP2K options đŸ–Ĩī¸ M32C options đŸ–Ĩī¸ M32R options đŸ–Ĩī¸ M680X0 options đŸ–Ĩī¸ M68HC11 options đŸ–Ĩī¸ MCORE options đŸ–Ĩī¸ Meta options đŸ–Ĩī¸ MicroBlaze options đŸ–Ĩī¸ MIPS options đŸ–Ĩī¸ MMIX options đŸ–Ĩī¸ Nios II options đŸ–Ĩī¸ NDS32 options đŸ–Ĩī¸ PDP11 options đŸ–Ĩī¸ picoJava options đŸ–Ĩī¸ PowerPC options đŸ–Ĩī¸ PRU options đŸ–Ĩī¸ RISC-V options đŸ–Ĩī¸ RL78 options đŸ–Ĩī¸ RX options đŸ–Ĩī¸ s390 options đŸ–Ĩī¸ SCORE options đŸ–Ĩī¸ SPARC options đŸ–Ĩī¸ TIC54X options đŸ–Ĩī¸ TIC6X options đŸ–Ĩī¸ TILE-Gx options đŸ–Ĩī¸ Visium options đŸ–Ĩī¸ Xtensa options đŸ–Ĩī¸ Z80 options
📝 DESCRIPTION âš™ī¸ OPTIONS 📚 SEE ALSO ÂŠī¸ COPYRIGHT

Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-16 09:26 @2600:1f28:365:80b0:7cb9:fb:26c1:e368
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!