AS(1)

๐Ÿ“ฆ version 2.45, in ubuntu questing

โœจ AS(1) โ€” GNU Development Tools โœจ

Okay bestie, this is the manual for as, the GNU assembler ๐Ÿ’– It lives in the GNU Development Tools family, and it's the one that's built to be portable across a bunch of different chip architectures ๐Ÿงš

๐ŸŒธ NAME ๐ŸŒธ

AS is the portable GNU assembler, and honestly it's giving "works everywhere" energy โœจ

๐Ÿ’… SYNOPSIS ๐Ÿ’…

Here's the full lineup of ways you can call it. Don't panic, most of these are optional ๐Ÿ™ˆ

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

๐Ÿฆ‹ TARGET ๐Ÿฆ‹

Okay so here's the thing: every chip family has its own extra options ๐Ÿ’œ The ones below only matter when you're targeting that specific architecture, so pick your chip and go, no cap โœจ

๐ŸŒˆ Target AArch64 options

[-EB|-EL]
[-mabi=ABI]

๐Ÿ“ Target Alpha options

[-mcpu]
[-mdebug | -no-mdebug]
[-replace | -noreplace]
[-relax] [-g] [-Gsize]
[-F] [-32addr]

๐Ÿงš Target ARC options

[-mcpu=cpu]
[-mA6|-mARC600|-mARC601|-mA7|-mARC700|-mEM|-mHS]
[-mcode-density]
[-mrelax]
[-EB|-EL]

๐Ÿซถ Target ARM options

[-mcpu=processor[+extension...]]
[-march=architecture[+extension...]]
[-mfpu=floating-point-format]
[-mfloat-abi=abi]
[-meabi=ver]
[-mthumb]
[-EB|-EL]
[-mapcs-32|-mapcs-26|-mapcs-float|
 -mapcs-reentrant]
[-mthumb-interwork] [-k]

๐ŸŽ€ DESCRIPTION ๐ŸŽ€

okay so GNU as is really a whole family of assemblers ๐Ÿ’… if you've used the GNU assembler on one architecture, you'll feel right at home on another one โœจ each version shares a ton with the others, like object file formats, most assembler directives (aka pseudo-ops) and the general assembler syntax ๐Ÿฆ‹

as is mainly built to assemble the output of the GNU C compiler, gcc, so the linker, ld, can use it ๐Ÿซถ that said, we really tried to make as assemble correctly everything that other assemblers for the same machine would assemble. any exceptions are written down explicitly, so no surprises ๐Ÿ™ˆ BUT it doesn't mean as always uses the exact same syntax as another assembler for the same architecture. for example, we know of several incompatible versions of 680x0 assembly language syntax. chaotic, I know ๐Ÿ’€

each time you run as, it assembles exactly one source program ๐ŸŒธ that program is made up of one or more files. (the standard input counts as a file too, btw ๐Ÿงš)

you give as a command line with zero or more input file names. the input files get read from left to right ๐Ÿ‘‘ any command-line argument (in any position) that doesn't have a special meaning gets treated as an input file name โœจ

if you don't give as any file names, it tries to read one input file from the as standard input, which is normally your terminal ๐Ÿ’ป you might have to type ctl-D to tell as there's no more program to assemble ๐Ÿ˜ญ

if you need to explicitly name the standard input file on your command line, use -- ๐Ÿ“

if the source is empty, as produces a small, empty object file. tiny, but valid ๐Ÿฅบ

as may write warnings and error messages to the standard error file (usually your terminal too) ๐Ÿ”ฅ this shouldn't happen when a compiler runs as automatically ๐Ÿ’… warnings tell you about an assumption as made so it could keep assembling a flawed program. errors tell you about a grave problem that stops the assembly dead ๐Ÿ’€

if you're invoking as through the GNU C compiler, you can use the -Wa option to pass arguments through to the assembler ๐Ÿฆ‹ the assembler arguments have to be separated from each other (and from the -Wa) by commas, no spaces โœจ 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 don't need the -Wa thing, because the compiler automatically passes lots of its own command-line options along to the assembler for you ๐Ÿซถ if you're curious, you can call the GNU compiler driver with the -v option to see exactly what options it passes to each compilation pass, including the assembler ๐Ÿ”


โœจ OPTIONS โœจ

  • @file โ€” okay so this one reads command-line options from file ๐Ÿ“œ the options it reads get slotted in right where the original @file option was. if file doesn't exist or can't be read, then the option gets treated literally and doesn't get removed ๐Ÿ™ˆ

options inside file are separated by whitespace ๐Ÿซง if you need a whitespace character inside an option, wrap the whole option in single or double quotes. any character (including a backslash) can be included by putting a backslash in front of it ๐Ÿฆ‹ the file can even contain more @file options of its own, and those get processed recursively ๐ŸŒ€

  • -a[cdghilmns] โ€” turns on listings, in any of a bunch of different ways ๐Ÿ“
    • -ac omits false conditionals
    • -ad omits debugging directives
    • -ag includes general information, like the as version and the options passed
    • -ah includes high-level source
    • -al includes assembly
    • -ali includes assembly with ginsn
    • -am includes macro expansions
    • -an omits forms processing
    • -as includes symbols
    • =file sets the name of the listing file

you can mix these together! for example, -aln gives you an assembly listing without forms processing ๐Ÿ’… the =file option, if you use it, has to be the last one ๐ŸŽ€ and by itself, -a defaults to -ahls ๐Ÿ’–

  • --alternate โ€” begins in alternate macro mode ๐ŸŒธ
  • --compress-debug-sections โ€” compresses DWARF debug sections using zlib with SHF_COMPRESSED from the ELF ABI ๐Ÿ—œ๏ธ heads up: the resulting object file might not be compatible with older linkers and object file utilities ๐Ÿ’€ also, if compression would make a given section larger, it doesn't get compressed. smart ๐Ÿง 
  • --compress-debug-sections=none, --compress-debug-sections=zlib, --compress-debug-sections=zlib-gnu, --compress-debug-sections=zlib-gabi, --compress-debug-sections=zstd โ€” these control how DWARF debug sections get compressed ๐ŸŽ€
    • --compress-debug-sections=none is the same as --nocompress-debug-sections
    • --compress-debug-sections=zlib and --compress-debug-sections=zlib-gabi are the same as plain --compress-debug-sections
    • --compress-debug-sections=zlib-gnu compresses DWARF debug sections using the obsoleted zlib-gnu format ๐Ÿฅ€ the debug sections get renamed so they begin with .zdebug
    • --compress-debug-sections=zstd compresses DWARF debug sections using zstd โšก
note: if compression would actually make a section larger, then it's not compressed nor renamed ๐Ÿ‘€
  • --nocompress-debug-sections โ€” does not compress DWARF debug sections ๐Ÿ™…โ€โ™€๏ธ this is usually the default for all targets except x86/x86_64, but a configure time option can be used to override that โš™๏ธ
  • -D โ€” enables debugging in target specific backends, if they support it ๐Ÿ”ง otherwise it's ignored. even if it's ignored, this option is still accepted, for script compatibility with calls to other assemblers ๐Ÿซถ
  • --debug-prefix-map old=new โ€” when assembling files in directory old, debugging information describing them gets recorded as if they were in new instead ๐Ÿ—บ๏ธ
  • --defsym sym=value โ€” defines the symbol sym to be value before the input file gets assembled โœจ value has to be an integer constant. just like in C, a leading 0x means hexadecimal and a leading 0 means octal ๐Ÿ”ข you can override the symbol's value inside a source file with the .set pseudo-op ๐Ÿ’…
  • --dump-config โ€” displays how the assembler is configured, and then exits ๐Ÿงพ
  • --elf-stt-common=no, --elf-stt-common=yes โ€” these control whether the ELF assembler should generate common symbols with the STT_COMMON type ๐Ÿฆ‹ the default can be controlled by the --enable-elf-stt-common configure option ๐Ÿ› ๏ธ
  • --emit-local-absolute โ€” emits even pre-defined (local) absolute symbols to the outgoing symbol table ๐Ÿ“ค heads up: this isn't the exact opposite of --strip-local-absolute, so don't treat them as mirror images ๐Ÿ™ƒ
  • --emulation=name โ€” if the assembler is configured to support multiple different target configurations, this option lets you pick the one you want ๐ŸŽฏ
  • -f โ€” "fast"! ๐ŸŽ๏ธ skips whitespace and comment preprocessing, assuming the source is compiler output ๐Ÿค–
  • -g, --gen-debug โ€” generates debugging information for each assembler source line, using whichever debug format the target prefers ๐Ÿ› right now that means either STABS, ECOFF or DWARF2 ๐ŸŒˆ when the format is DWARF, a .debug_info and .debug_line section only gets emitted when the assembly file doesn't generate one itself ๐Ÿ’–
  • --gstabs โ€” generates stabs debugging information for each assembler line ๐Ÿ” this might help you debug assembler code, if your debugger can handle it ๐Ÿ™
  • --gstabs+ โ€” generates stabs debugging information for each assembler line too, but with GNU extensions that probably only gdb can handle ๐Ÿ’€ other debuggers might crash or refuse to read your program because of them ๐Ÿ˜ญ this might help debug assembler code. right now, the only GNU extension is the location of the current working directory at assembling time ๐Ÿ“
  • --gdwarf-2 โ€” generates DWARF2 debugging information for each assembler line ๐Ÿฆ‹ this might help debug assembler code, if your debugger can handle it. note: this option is only supported by some targets, not all of them ๐ŸŽฏ
  • --gdwarf-3 โ€” basically the same as --gdwarf-2, except it allows for the possibility of extra debug information as per version 3 of the DWARF specification ๐Ÿ“š heads up: turning this on doesn't guarantee any extra information gets generated. that choice is made per target ๐Ÿคทโ€โ™€๏ธ
  • --gdwarf-4 โ€” basically the same as --gdwarf-2, except it allows for the possibility of extra debug information as per version 4 of the DWARF specification ๐Ÿ“š again, turning this on doesn't guarantee any extra information, since the choice is made on a per target basis ๐ŸŽ€
  • --gdwarf-5 โ€” basically the same as --gdwarf-2, except it allows for the possibility of extra debug information as per version 5 of the DWARF specification ๐Ÿ“š yep, same deal: no guarantees, and it depends on the target ๐Ÿ’…
  • --gdwarf-sections โ€” instead of creating a .debug_line section, this creates a series of .debug_line.foo sections, where foo is the name of the matching code section ๐Ÿงฉ for example, a code section called .text.func gets its DWARF line number information placed into a section called .debug_line.text.func. if the code section is just called .text, the debug line section still gets called just .debug_line, no suffix ๐ŸŒธ
  • --gdwarf-cie-version=version โ€” controls which version of DWARF Common Information Entries (CIEs) get produced ๐Ÿงพ if you don't specify this flag, the default is version 1, though some targets can change that default. other possible values for version are 3 or 4 ๐Ÿ”ข
  • --generate-missing-build-notes=yes, --generate-missing-build-notes=no โ€” these control whether the ELF assembler should generate GNU Build attribute notes when none are in the input sources ๐Ÿ—๏ธ the default can be controlled by the --enable-generate-build-notes configure option โš™๏ธ
  • --gsframe, --gsframe, --gsframe=no, --gsframe=yes โ€” creates a .sframe section from CFI directives ๐Ÿช„ the explicit --gsframe=yes behaves the same as --gsframe, and you can suppress generation with --gsframe=no ๐Ÿ™…โ€โ™€๏ธ
  • --hash-size N โ€” ignored! ๐Ÿซ  it's only supported so the command line stays compatible with other assemblers ๐Ÿซถ
  • --help โ€” prints a summary of the command-line options and then exits ๐Ÿ“‹
  • --target-help โ€” prints a summary of all the target specific options and then exits ๐ŸŽฏ
  • --info โ€” doesn't suppress informational messages ๐Ÿ“ข
  • --no-info โ€” suppresses informational messages ๐Ÿคซ
  • -I dir โ€” adds directory dir to the search list for .include directives ๐Ÿ“‚
  • -J โ€” don't warn about signed overflow ๐Ÿ™ˆ

okay so the options list keeps going, bestie, and it's getting spicy ๐ŸŒถ๏ธโœจ

  • -K โ€” ๐Ÿšจ this one warns you when difference tables get altered for long displacements. Keep an eye out for it ๐Ÿ‘€
  • -L, --keep-locals โ€” keeps local symbols in the symbol table ๐Ÿ—๏ธ These are the ones that start with the system's local label prefix, which is usually .L on ELF systems or L on traditional a.out systems.
  • --listing-lhs-width=number โ€” sets the max width, in words, of the output data column in an assembler listing to number ๐Ÿ“
  • --listing-lhs-width2=number โ€” same vibe as above, but for the continuation lines in a listing ๐Ÿงš
  • --listing-rhs-width=number โ€” caps how wide an input source line can be when it shows up in a listing, at number bytes ๐Ÿ’…
  • --listing-cont-lines=number โ€” limits how many lines get printed in a listing for one line of input. The cap is number + 1 ๐ŸŒธ
  • --multibyte-handling=allow, --multibyte-handling=warn, --multibyte-handling=warn-sym-only, --multibyte-handling=warn_sym_only โ€” decides how the assembler deals with multibyte characters in your input ๐ŸŒˆ Default is allow, which lets them through with zero drama, and you can get that back any time by using allow. warn makes the assembler complain every single time it spots a multibyte character ๐Ÿ˜ญ warn-sym-only is the chill version: it only warns when a symbol gets defined with a multibyte name. (Referencing an undefined symbol won't trigger a warning, fyi.) Note that warn_sym_only is also accepted, just spelled with underscores instead of dashes ๐Ÿซถ
  • --no-pad-sections โ€” tells the assembler to stop padding the ends of output sections out to the section's alignment. Padding is the default, but it can waste space you actually need on targets with tight memory constraints ๐Ÿฅบ
  • -o objfile โ€” names the object-file output from as as objfile ๐ŸŽ€
  • -R โ€” folds the data section into the text section ๐Ÿ“
  • --reduce-memory-overheads โ€” literally does nothing ("ignored") ๐Ÿ™ˆ It's only here so tools that pass the same option to both the assembler and the linker don't get upset.
  • --scfi=experimental โ€” this one is a whole mood ๐Ÿ”ฎ It controls whether the assembler should synthesize CFI for hand-written input. If your input already has some synthesizable CFI directives, the assembler ignores them and emits a warning. Also, --scfi=experimental is NOT meant for compiler-generated code, inline assembly included. It's still work in progress, and only the System V AMD64 ABI is supported right now.

Every input function in assembly has to start with the .type directive, and ideally gets closed off with a .size directive. When you use SCFI, each .type directive makes GAS start a brand new FDE (a.k.a. Function Descriptor Entry). That means each .type basically finalises whatever block of instructions came before it as its own distinct FDE ๐Ÿง โœจ

  • --sectname-subst โ€” honors substitution sequences in section names ๐Ÿ’–
  • --size-check=error, --size-check=warning โ€” throws an error or a warning for an invalid ELF .size directive. Pick your fighter ๐ŸฅŠ
  • --statistics โ€” prints the maximum space (in bytes) and the total time (in seconds) the assembly used ๐Ÿ“Š
  • --strip-local-absolute โ€” removes local absolute symbols from the outgoing symbol table ๐Ÿงน
  • -v, --verbose โ€” prints the as version ๐Ÿฆ‹
  • --version, -version โ€” prints the as version and then exits ๐Ÿ‘‘
  • -W, --no-warn โ€” suppresses warning messages. Shh ๐Ÿคซ
  • --warn โ€” doesn't suppress warnings, and doesn't treat them as errors either. Just vibes ๐ŸŒท
  • --fatal-warnings โ€” treats warnings as errors. No second chances ๐Ÿ’€
  • -w โ€” ignored ๐Ÿ™ƒ
  • -x โ€” also ignored ๐Ÿ™ƒ
  • -Z โ€” generates an object file even after errors. Chaotic good energy ๐ŸŒช๏ธ
  • -- | files ... โ€” the input is either standard input or source files to assemble ๐Ÿ“ฅ

๐ŸŒˆ AArch64 options

These are available when as is configured for the 64-bit mode of the ARM Architecture (AArch64). ARM girlies, this is for you ๐Ÿซถ

  • -EB โ€” marks the output as encoded for a big-endian processor ๐ŸŒŠ
  • -EL โ€” marks the output as encoded for a little-endian processor ๐ŸŒŠ
  • -mabi=abi โ€” tells the assembler which ABI your source code uses. The recognized arguments are "ilp32" and "lp64", which decide whether the generated object file is ELF32 or ELF64. The default is "lp64" ๐Ÿง
  • -mcpu=processor[+extension...] โ€” picks the target processor. If you try to assemble an instruction that won't run on that processor, the assembler will throw an error at you ๐Ÿšซ These processor names are recognized: "cortex-a34", "cortex-a35", "cortex-a53", "cortex-a55", "cortex-a57", "cortex-a65", "cortex-a65ae", "cortex-a72", "cortex-a73", "cortex-a75", "cortex-a76", "cortex-a76ae", "cortex-a77", "cortex-a78", "cortex-a78ae", "cortex-a78c", "cortex-a510", "cortex-a520", "cortex-a710", "cortex-a720", "ares", "exynos-m1", "falkor", "neoverse-n1", "neoverse-n2", "neoverse-e1", "neoverse-v1", "qdf24xx", "saphira", "thunderx", "vulcan", "xgene1", "xgene2", "cortex-r82", "cortex-x1", "cortex-x2", "cortex-x3", and "cortex-x4". The special name "all" lets the assembler accept instructions valid for any supported processor, including every optional extension ๐Ÿคฏ

Beyond the basic instruction set, you can tell the assembler to accept, or restrict, various extension mnemonics that extend the processor โœจ

If some implementations of a processor can have an extension, those extensions get switched on automatically. So you usually won't need to specify extra extensions yourself ๐Ÿ’…

  • -march=architecture[+extension...] โ€” picks the target architecture. Same deal as -mcpu: the assembler errors out if you try to assemble something that won't execute on that architecture ๐Ÿ›‘ These architecture names are recognized: "armv8-a", "armv8.1-a", "armv8.2-a", "armv8.3-a", "armv8.4-a", "armv8.5-a", "armv8.6-a", "armv8.7-a", "armv8.8-a", "armv8.9-a", "armv8-r", "armv9-a", "armv9.1-a", "armv9.2-a", "armv9.3-a", "armv9.4-a", and "armv9.5-a" ๐ŸŒธ

If you specify both -mcpu and -march, the assembler goes with the -mcpu setting. If you specify neither, it defaults to -mcpu=all ๐Ÿซ 

The architecture option can be extended with the same instruction set extension options as -mcpu. The difference is that extensions aren't always enabled by default for -march ๐Ÿฆ‹

  • -mverbose-error โ€” turns on verbose error messages for AArch64 gas. This one is on by default ๐Ÿ“ฃ
  • -mno-verbose-error โ€” turns verbose error messages off for AArch64 gas ๐Ÿค
  • -menable-sysreg-checking โ€” turns on error messages for when you try to assemble a system register access that won't execute on the target architecture ๐Ÿง

๐Ÿ„ Alpha options

These are available when as is configured for an Alpha processor ๐ŸŒ™

  • -mcpu โ€” picks the target processor. If you try to assemble an instruction that won't run on it, the assembler might either expand the instruction as a macro or throw an error. This option is equivalent to the .arch directive ๐Ÿช„ These processor names are recognized: 21064, "21064a", 21066, 21068, 21164, "21164a", "21164pc", 21264, "21264a", "21264b", "ev4", "ev5", "lca45", "ev5", "ev56", "pca56", "ev6", "ev67", and "ev68". The special name "all" lets the assembler accept instructions valid for any Alpha processor ๐ŸŒŸ

Here's the tea โ˜• For existing practice in OSF/1 with respect to .arch, and existing practice within MILO (the Linux ARC bootloader), the numbered processor names (like 21064) enable the processor-specific PALcode instructions. The "electro-vlasic" names (like "ev4") do not ๐Ÿค“

  • -mdebug, -no-mdebug โ€” enables or disables generating .mdebug encapsulation for stabs directives and procedure descriptors. By default .mdebug switches on automatically once the first stabs directive shows up ๐Ÿ”
  • -relax โ€” forces all relocations to be put into the object file, instead of saving space by resolving some of them at assembly time. Heads up: this doesn't propagate all symbol arithmetic into the object file, because not all symbol arithmetic can be represented. It can still be useful in specific applications though ๐Ÿงฉ
  • -replace, -noreplace โ€” enables or disables optimizing procedure calls, both at assemblage and at link time. These are only available for VMS targets, and -replace is the default. See section 1.4.1 of the OpenVMS Linker Utility Manual ๐Ÿ“š
  • -g โ€” used when the compiler generates debug information. When gcc is using mips-tfile to generate debug information for ECOFF, local labels have to get passed through to the object file. Otherwise this option does nothing ๐Ÿคทโ€โ™€๏ธ
  • -Gsize โ€” a local common symbol bigger than size gets placed in ".bss", while smaller ones go into ".sbss" ๐Ÿงธ
  • -F, -32addr โ€” ignored, kept around for backward compatibility ๐Ÿ•ฐ๏ธ

๐ŸŒฟ ARC options

These are available when as is configured for an ARC processor ๐Ÿš

  • -mcpu=cpu โ€” selects the core processor variant ๐Ÿงฌ
  • -EB | -EL โ€” picks big-endian (-EB) or little-endian (-EL) output ๐ŸŒŠ
  • -mcode-density โ€” enables the Code Density extension instructions ๐Ÿฌ

๐Ÿค– ARM options

These are available when as is configured for the ARM processor family ๐Ÿ’œ

  • -mcpu=processor[+extension...] โ€” specifies which ARM processor variant is the target ๐ŸŽฏ
  • -march=architecture[+extension...] โ€” specifies which ARM architecture variant the target uses ๐Ÿ›๏ธ
  • -mfpu=floating-point-format โ€” selects which Floating Point architecture is the target ๐Ÿ”ข
  • -mfloat-abi=abi โ€” selects which floating point ABI is in use ๐Ÿงฎ
  • -mthumb โ€” enables Thumb-only instruction decoding ๐ŸŒ™
  • -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant โ€” selects which procedure calling convention is in use ๐Ÿ“ž
  • -EB | -EL โ€” picks big-endian (-EB) or little-endian (-EL) output ๐ŸŒŠ
  • -mthumb-interwork โ€” says the code was generated with interworking between Thumb and ARM code in mind ๐Ÿค
  • -mccs โ€” turns on CodeComposer Studio assembly syntax compatibility mode ๐ŸŽ›๏ธ
  • -k โ€” specifies that PIC code has been generated ๐Ÿงฉ

The following options are available when as is configured for the Blackfin processor family, so if you're working on Blackfin stuff, these are your besties ๐Ÿ’œ

  • -mcpu=processor[-sirevision] โ€” okay so this picks the target processor ๐ŸŽฏ The optional sirevision part does nothing in the assembler ๐Ÿ™ˆ It's just there so GCC can pass its -mcpu= option straight down without any drama. If you try to assemble an instruction that won't run on your target processor, the assembler will throw an error at you ๐Ÿ’€ These are the processor names it recognises: bf504, bf506, bf512, bf514, bf516, bf518, bf522, bf523, bf524, bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf535 (not implemented yet), bf536, bf537, bf538, bf539, bf542, bf542m, bf544, bf544m, bf547, bf547m, bf548, bf548m, bf549, bf549m, bf561, and bf592 โœจ
  • -mfdpic โ€” assemble for the FDPIC ABI ๐Ÿฆ‹
  • -mno-fdpic, -mnopic โ€” turns -mfdpic off again ๐Ÿ™…โ€โ™€๏ธ

The following options are available when as is configured for the Linux kernel BPF processor family.

@chapter BPF Dependent Features

โœจ BPF Options โœจ

  • -EB โ€” big-endian eBPF output, bestie ๐Ÿ“
  • -EL โ€” little-endian eBPF output ๐Ÿ’œ
  • -mdialect=dialect โ€” picks the assembly language dialect the assembler recognises while it's working ๐Ÿงš It supports normal and pseudoc ๐Ÿซถ
  • -misa-spec=spec โ€” sets the version of the BPF instruction set to use when assembling ๐Ÿ”ฅ The BPF ISA versions it supports are v1 v2, v3 and v4 ๐Ÿ‘‘

The value xbpf can be specified to recognise extra instructions that GCC uses for testing purposes. But beware, this is not valid BPF ๐Ÿ’€

  • -mno-relax โ€” tells the assembler to not relax instructions ๐ŸŒธ

Note that if no endianness option is specified on the command line, the host endianness gets used ๐ŸŒˆ See the info pages for documentation of the CRIS-specific options ๐Ÿ“š

The following options are available when as is configured for the C-SKY processor family.

  • -march=archname โ€” assemble for architecture archname ๐ŸŽ€ The --help option lists valid values for archname ๐Ÿ’…
  • -mcpu=cpuname โ€” assemble for architecture cpuname ๐ŸŽ€ The --help option lists valid values for cpuname โœจ
  • -EL, -mlittle-endian โ€” generates little-endian output ๐Ÿ’–
  • -EB, -mbig-endian โ€” generates big-endian output ๐Ÿ’–
  • -fpic, -pic โ€” generates position-independent code ๐Ÿฆ‹
  • -mljump, -mno-ljump โ€” enables or disables turning the short branch instructions jbf, jbt, and jbr into jmpi ๐Ÿ”ฅ This option is for V2 processors only. It gets ignored on CK801 and CK802 targets, since those don't support the jmpi instruction, and it's enabled by default for other processors ๐Ÿ™ˆ
  • -mbranch-stub, -mno-branch-stub โ€” passes R_CKCORE_PCREL_IMM26BY2 relocations for bsr instructions through to the linker ๐Ÿงš

This option is only available for bare-metal C-SKY V2 ELF targets, where it's enabled by default. It cannot be used in code that will be dynamically linked against shared libraries ๐Ÿ˜ญ

  • -force2bsr, -mforce2bsr, -no-force2bsr, -mno-force2bsr โ€” enables or disables turning jbsr instructions into bsr ๐Ÿ’… This option is always enabled (and -mno-force2bsr gets ignored) for CK801/CK802 targets. It's also always enabled when -mbranch-stub is in effect ๐Ÿ‘‘
  • -jsri2bsr, -mjsri2bsr, -no-jsri2bsr, -mno-jsri2bsr โ€” enables or disables turning jsri instructions into bsr โœจ This one's enabled by default ๐ŸŒˆ
  • -mnolrw, -mno-lrw โ€” enables or disables turning lrw instructions into a movih/ori pair ๐Ÿฆ‹
  • -melrw, -mno-elrw โ€” enables or disables extended lrw instructions ๐Ÿ’œ This option is enabled by default for CK800-series processors ๐Ÿ“
  • -mlaf, -mliterals-after-func, -mno-laf, -mno-literals-after-func โ€” enables or disables placing literal pools after each function ๐ŸŽ€
  • -mlabr, -mliterals-after-br, -mno-labr, -mnoliterals-after-br โ€” enables or disables placing literal pools after unconditional branches ๐ŸŒธ This option is enabled by default ๐Ÿ’–
  • -mistack, -mno-istack โ€” enables or disables interrupt stack instructions โญ This option is enabled by default on CK801, CK802, and CK802 processors ๐Ÿซถ

The following options explicitly enable certain optional instructions. Heads up: these features also get switched on automatically when you use -mcpu= to specify a processor that supports them ๐Ÿซถ

  • -mhard-float โ€” enables hard float instructions ๐Ÿ”ฅ
  • -mmp โ€” enables multiprocessor instructions ๐Ÿ‘‘
  • -mcp โ€” enables coprocessor instructions ๐ŸŒˆ
  • -mcache โ€” enables the cache prefetch instruction ๐Ÿงš
  • -msecurity โ€” enables C-SKY security instructions ๐Ÿ”’
  • -mtrust โ€” enables C-SKY trust instructions ๐Ÿ’œ
  • -mdsp โ€” enables DSP instructions โœจ
  • -medsp โ€” enables enhanced DSP instructions ๐Ÿ’…
  • -mvdsp โ€” enables vector DSP instructions ๐Ÿฆ‹

The following options are available when as is configured for an Epiphany processor.

  • -mepiphany โ€” the both 32 and 16 bit instructions are allowed here ๐ŸŒˆ This is the default behaviour ๐Ÿซถ
  • -mepiphany16 โ€” restricts the permitted instructions to just the 16 bit set ๐Ÿ™ˆ

The following options are available when as is configured for an H8/300 processor. @chapter H8/300 Dependent Features

โœจ Options โœจ

The Renesas H8/300 version of as has one machine-dependent option ๐Ÿ’…

  • -h-tick-hex โ€” supports H'00 style hex constants alongside 0x00 style ๐Ÿ“
  • -mach=name โ€” sets the H8300 machine variant ๐ŸŽ€ The following machine names are recognised: h8300h, h8300hn, h8300s, h8300sn, h8300sx and h8300sxn โœจ

The following options are available when as is configured for an i386 processor.

  • --32 | --x32 | --64 โ€” selects the word size, either 32 bits or 64 bits ๐Ÿ’– --32 implies the Intel i386 architecture, while --x32 and --64 imply the AMD x86-64 architecture with 32-bit or 64-bit word size respectively ๐Ÿฆ‹

These options are only available with the ELF object file format, and they need the necessary BFD support to be included. On a 32-bit platform, you have to add --enable-64-bit-bfd to configure to enable 64-bit usage, and use x86-64 as the target platform ๐Ÿค“

  • -n โ€” by default, x86 GAS swaps out multiple nop instructions used for alignment within code sections for multi-byte nop instructions, like leal 0(%esi,1),%esi ๐ŸŒธ This switch disables that optimisation if a single byte nop (0x90) is explicitly specified as the fill byte for alignment ๐Ÿ™…โ€โ™€๏ธ
  • --divide โ€” on SVR4-derived platforms, the character / is treated as a comment character, so it can't be used in expressions ๐Ÿ˜ญ The --divide option turns / into a normal character ๐ŸŽ€ It doesn't disable / at the beginning of a line starting a comment, and it doesn't affect using # for starting a comment ๐Ÿ’…
  • -march=CPU[+EXTENSION...] โ€” this picks the target processor ๐ŸŽฏ The assembler will throw an error if you try to assemble an instruction that won't run on the target processor ๐Ÿ’€ These processor names are recognised: i8086, i186, i286, i386, i486, i586, i686, pentium, pentiumpro, pentiumii, pentiumiii, pentium4, prescott, nocona, core, core2, corei7, iamcu, k6, k6_2, athlon, opteron, k8, amdfam10, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, znver5, btver1, btver2, generic32 and generic64 โœจ

Besides the basic instruction set, the assembler can be told to accept extra extension mnemonics ๐Ÿงš For example, -march=i686+sse4+vmx extends i686 with sse4 and vmx ๐Ÿ”ฅ These extensions are currently supported: 8087, 287, 387, 687, cmov, fxsr, mmx, sse, sse2, sse3, sse4a, ssse3, sse4.1, sse4.2, sse4, avx, avx2, lahf_sahf, monitor, adx, rdseed, prfchw, smap, mpx, sha, rdpid, ptwrite, cet, gfni, vaes, vpclmulqdq, prefetchwt1, clflushopt, se1, clwb, movdiri, movdir64b, enqcmd, serialize, tsxldtrk, kl, widekl, hreset, avx512f, avx512cd, avx512er, avx512pf, avx512vl, avx512bw, avx512dq, avx512ifma, avx512vbmi, avx512_4fmaps, avx512_4vnniw, avx512_vpopcntdq, avx512_vbmi2, avx512_vnni, avx512_bitalg, avx512_vp2intersect, tdx, avx512_bf16, avx_vnni, avx512_fp16, prefetchi, avx_ifma, avx_vnni_int8, cmpccxadd, wrmsrns, msrlist, avx_ne_convert, rao_int, fred, lkgs, avx_vnni_int16, sha512, sm3, sm4, pbndkb, avx10.1, avx10.1/512, avx10.1/256, avx10.1/128, user_msr, msr_imm, apx_f, avx10.2, avx10.2/512, avx10.2/256, avx10.2/128, movrs, amx_int8, amx_bf16, amx_fp16, amx_complex, amx_transpose, amx_tf32, amx_fp8 amx_movrs, amx_avx512, amx_tile, vmx, vmfunc, smx, xsave, xsaveopt, xsavec, xsaves, aes, pclmul, fsgsbase, rdrnd, f16c, bmi2, fma, movbe, ept, lzcnt, popcnt, hle, rtm, tsx, invpcid, clflush, mwaitx, clzero, wbnoinvd, pconfig, waitpkg, uintr, cldemote, rdpru, mcommit, sev_es, lwp, fma4, xop, cx16, syscall, rdtscp, 3dnow, 3dnowa, sse4a, sse5, snp, invlpgb, tlbsync, rmpquery, rmpread, svme, gmism2, gmiccs, padlockrng2, padlockphe2, padlockxmodx and padlock ๐ŸŒˆ Note that these extension mnemonics can be prefixed with no to revoke the respective (and any dependent) functionality ๐Ÿ’… Also, the suffixes permitted on -march=avx10.<N> enforce a vector length restriction. So even though these are otherwise "enabling" options, using these suffixes will disable all insns with wider vector or mask register operands ๐Ÿ™ˆ

When the .arch directive is used with -march, the .arch directive will take precedent ๐Ÿ‘‘

  • -mtune=CPU โ€” this option picks a processor to optimise for ๐ŸŽฏ When it's used together with the -march option, only instructions of the processor specified by the -march option will be generated ๐Ÿ’–

Valid CPU values are identical to the processor list of -march=CPU ๐Ÿซถ

These flags are where the assembler gets picky about instruction operands, SSE, AVX, and encoding details, so pay attention bestie ๐Ÿฆ‹

  • -moperand-check=none, -moperand-check=warning, -moperand-check=error โ€” These decide whether the assembler bothers checking certain instruction operands or operand combos ๐Ÿ” The classic example is an instruction where the operand size can't be figured out from the operands, and you didn't spell it out with an instruction suffix. none skips the checks entirely. warning (the default โœจ) throws a warning when a check fails. error makes a failed check a full-on error ๐Ÿ™…โ€โ™€๏ธ
  • -msse2avx โ€” Tells the assembler to encode SSE instructions with a VEX prefix, which means AVX has to be available ๐ŸŒˆ SSE instructions that use extended GPRs get encoded with an EVEX prefix instead, and that one needs AVX512 or AVX10 to be available ๐Ÿ’…
  • -muse-unaligned-vector-move โ€” Makes the assembler encode aligned vector moves as unaligned vector moves ๐Ÿซถ
  • -msse-check=none, -msse-check=warning, -msse-check=error โ€” These control whether the assembler checks SSE instructions at all ๐Ÿ‘€ none is the default, so no checking happens unless you ask for it. warning gives you a warning for any SSE instruction, and error gives you an error for any SSE instruction ๐Ÿ’€
  • -mavxscalar=128, -mavxscalar=256 โ€” Decides how scalar AVX instructions get encoded ๐ŸŽ€ 128 (the default) encodes them with a 128-bit vector length, and 256 uses a 256-bit vector length ๐ŸŒธ
WARNING: Don't use this for production code ๐Ÿšจ Because of CPU errata, the resulting code may not work on certain models. Not the vibe for real projects, bestie ๐Ÿ˜ญ
  • -mvexwig=0, -mvexwig=1 โ€” Controls how the assembler encodes VEX.W-ignored (WIG) VEX instructions ๐Ÿฆ‹ 0 (the default) encodes them with vex.w = 0. 1 encodes WIG EVEX instructions with vex.w = 1 ๐Ÿงš
WARNING: Don't use this for production code ๐Ÿšจ Due to CPU errata, the resulting code may not work on certain models. Seriously, keep this one out of your real stuff ๐Ÿ’€
  • -mevexlig=128, -mevexlig=256, -mevexlig=512 โ€” Picks the vector length for length-ignored (LIG) EVEX instructions ๐Ÿ’œ 128 is the default โœจ 256 and 512 encode them with a 256-bit or 512-bit vector length, respectively ๐ŸŒˆ
  • -mevexwig=0, -mevexwig=1 โ€” Controls how the assembler encodes w-ignored (WIG) EVEX instructions ๐Ÿ“ 0 (the default) encodes them with evex.w = 0, and 1 encodes them with evex.w = 1 ๐Ÿซถ
  • -mmnemonic=att, -mmnemonic=intel โ€” Picks the instruction mnemonic used for matching instructions ๐Ÿ”ฅ Heads up: the .att_mnemonic and .intel_mnemonic directives take priority over this flag ๐Ÿ‘‘
  • -msyntax=att, -msyntax=intel โ€” Picks the instruction syntax used when processing instructions ๐Ÿ’… The .att_syntax and .intel_syntax directives win over this one, so keep that in mind ๐Ÿ™ˆ
  • -mnaked-reg โ€” Lets you skip the % prefix on registers ๐ŸŒธ Same deal as before: the .att_syntax and .intel_syntax directives take precedence over it โœจ
  • -madd-bnd-prefix โ€” Forces the assembler to slap a BND prefix on every branch ๐ŸŽ€ Even if you never wrote one in your source code, it's getting added anyway ๐Ÿงš
  • -mno-shared โ€” Okay, this one's a little spicy ๐ŸŒถ๏ธ On ELF targets, the assembler normally optimizes away non-PLT relocations against defined non-weak global branch targets that have default visibility. -mshared tells the assembler to generate code that could end up in a shared library, where those non-weak global branch targets with default visibility can be preempted ๐Ÿฆ‹ The downside is that the resulting code is slightly bigger. And this option only affects branch instructions, nothing else ๐Ÿ’œ
  • -mbig-obj โ€” On PE/COFF targets, this forces the big object file format ๐ŸŒˆ That format lets you have more than 32768 sections, so it's giving "I need a lot of sections" energy ๐Ÿ“ฆ
  • -momit-lock-prefix=no, -momit-lock-prefix=yes โ€” These control how the assembler encodes the lock prefix ๐Ÿ”’ It's really a workaround for processors that choke on the lock prefix ๐Ÿ™ˆ yes omits all lock prefixes, and no encodes the lock prefix as usual (the default โœจ)
WARNING: This option can only be safely used with single-core, single-thread computers ๐Ÿšจ Don't try it on anything fancier, bestie ๐Ÿ˜ญ
  • -mfence-as-lock-add=no, -mfence-as-lock-add=yes โ€” These control how lfence, mfence and sfence get encoded ๐Ÿ“ yes encodes all three as lock addl $0x0, (%rsp) in 64-bit mode and as lock addl $0x0, (%esp) in 32-bit mode ๐Ÿงš no encodes them as usual, which is the default ๐Ÿ’…
  • -mrelax-relocations=no, -mrelax-relocations=yes โ€” Controls whether the assembler generates relax relocations โœจ In 32-bit mode that means R_386_GOT32X, and in 64-bit mode it means R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX ๐ŸŒˆ yes generates relax relocations, and no doesn't ๐Ÿซถ The default can be changed with the configure option --enable-x86-relax-relocations ๐Ÿ”ฅ
  • -mtls-check=no, -mtls-check=yes โ€” Controls whether the assembler checks TLS relocations ๐Ÿ” yes checks them, no skips the check ๐Ÿ™…โ€โ™€๏ธ The default can be set with the configure option --enable-x86-tls-check ๐Ÿ‘‘
  • -malign-branch-boundary=NUM โ€” Decides how the assembler aligns branches that have segment prefixes or NOPs ๐Ÿฆ‹ NUM has to be a power of 2, and it should be 0 or at least 16 ๐Ÿ’œ Branches get aligned within a NUM byte boundary ๐ŸŒธ The default is -malign-branch-boundary=0, which means branches don't get aligned at all ๐Ÿ™ˆ
  • -malign-branch=TYPE[+TYPE...] โ€” Picks which types of branches get aligned ๐Ÿงš TYPE can be a combo of jcc (conditional jumps), fused (fused conditional jumps), jmp (unconditional jumps), call (calls), ret (rets), and indirect (indirect jumps and calls) ๐ŸŽ€ The default is -malign-branch=jcc+fused+jmp โœจ
  • -malign-branch-prefix-size=NUM โ€” Sets the maximum number of prefixes an instruction can have and still get its branch aligned ๐ŸŒˆ NUM should be between 0 and 5, and the default NUM is 5 ๐Ÿ’…
  • -mbranches-within-32B-boundaries โ€” This one's a whole package deal ๐Ÿ“ฆ It aligns conditional jumps, fused conditional jumps and unconditional jumps within a 32 byte boundary, with up to 5 segment prefixes on an instruction ๐Ÿ’– It's equivalent to -malign-branch-boundary=32 -malign-branch=jcc+fused+jmp -malign-branch-prefix-size=5, so you can skip typing all that out ๐Ÿซถ The default doesn't align branches ๐Ÿ™ˆ
  • -mlfence-after-load=no, -mlfence-after-load=yes โ€” Controls whether the assembler generates lfence after load instructions ๐Ÿ”ฅ yes generates it, and no doesn't, which is the default ๐Ÿ’€
  • -mlfence-before-indirect-branch=none, -mlfence-before-indirect-branch=all, -mlfence-before-indirect-branch=register, -mlfence-before-indirect-branch=memory โ€” Controls whether the assembler generates lfence before indirect near branch instructions ๐Ÿ›ก๏ธ all generates lfence before an indirect near branch via register and issues a warning before an indirect near branch via memory ๐Ÿ‘‘ It also implicitly sets -mlfence-before-ret=shl when there's no explicit -mlfence-before-ret= ๐ŸŒˆ register generates lfence before an indirect near branch via register ๐Ÿซถ memory issues a warning before an indirect near branch via memory ๐Ÿ™ˆ none doesn't generate lfence or issue any warning, and it's the default โœจ
Heads up: lfence won't be generated before an indirect near branch via register when you use -mlfence-after-load=yes, since the lfence gets generated after the branch target register is loaded ๐Ÿง 
  • -mlfence-before-ret=none, -mlfence-before-ret=shl, -mlfence-before-ret=or, -mlfence-before-ret=yes, -mlfence-before-ret=not โ€” Controls whether the assembler generates lfence before ret ๐Ÿ’œ or generates an or instruction with lfence ๐ŸŒธ shl and yes both generate a shl instruction with lfence ๐ŸŽ€ not generates a not instruction with lfence ๐Ÿ’… none doesn't generate lfence, and it's the default ๐Ÿฆ‹
  • -mx86-used-note=no, -mx86-used-note=yes โ€” Controls whether the assembler generates the GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_FEATURE_2_USED GNU property notes ๐Ÿงš The default can be controlled with the --enable-x86-used-note configure option โœจ
  • -mevexrcig=rne, -mevexrcig=rd, -mevexrcig=ru, -mevexrcig=rz โ€” These decide how SAE-only EVEX instructions get encoded ๐ŸŒˆ rne encodes the RC bits of the EVEX instruction as 00, and it's the default โœจ rd, ru and rz encode the SAE-only EVEX instructions with 01, 10 and 11 RC bits, respectively ๐Ÿ’–
  • -mamd64, -mintel64 โ€” Tells the assembler to accept only the AMD64 or Intel64 ISA in 64-bit mode ๐Ÿ‘‘ By default, it accepts the common ISA, plus the Intel64 only and AMD64 ISAs ๐Ÿซถ
  • -O0 | -O | -O1 | -O2 | -Os โ€” Optimizes instruction encoding for smaller instruction size ๐Ÿ“ -O and -O1 do a bunch of cute stuff: they encode 64-bit register load instructions with a 64-bit immediate as 32-bit register load instructions with 31-bit or 32-bit immediates ๐Ÿ’… They encode 64-bit register clearing instructions as 32-bit register clearing instructions ๐ŸŒธ They encode 256-bit/512-bit VEX/EVEX vector register clearing instructions as 128-bit VEX vector register clearing instructions ๐Ÿฆ‹ They encode 128-bit/256-bit EVEX vector register load/store instructions as VEX vector register load/store instructions ๐Ÿงš And they encode 128-bit/256-bit EVEX packed integer logical instructions as 128-bit/256-bit VEX packed integer logical instructions ๐Ÿ’œ

-O2 is where things get spicy ๐Ÿ”ฅ It includes everything from -O1 and also encodes 256-bit/512-bit EVEX vector register clearing instructions, plus 128-bit EVEX vector register clearing instructions. In 64-bit mode, VEX encoded instructions with commutative source operands also get their source operands swapped, but only if that lets them use the 2-byte VEX prefix form instead of the 3-byte one ๐Ÿงš Certain forms of AND, plus OR with the same (register) operand specified twice, also get switched over to TEST โœจ

  • -Os โ€” bestie, this one includes -O2 optimization and also encodes 16-bit, 32-bit and 64-bit register tests with an immediate as an 8-bit register test with an immediate ๐Ÿ’… -O0 turns this optimization off ๐Ÿ™ˆ

๐Ÿฆ‹ Ubicom IP2K series

These options show up when as is configured for the Ubicom IP2K series ๐ŸŒธ

  • -mip2022ext โ€” specifies that the extended IP2022 instructions are allowed โœจ
  • -mip2022 โ€” restores the default behaviour, which limits the permitted instructions to just the basic IP2022 ones ๐Ÿ’–

๐ŸŽ€ Renesas M32C and M16C processors

These options show up when as is configured for the Renesas M32C and M16C processors ๐Ÿ’œ

  • -m32c โ€” assemble M32C instructions ๐Ÿ“
  • -m16c โ€” assemble M16C instructions (this is the default) ๐Ÿ‘‘
  • -relax โ€” enables support for link-time relaxations ๐ŸŒˆ
  • -h-tick-hex โ€” supports H'00 style hex constants in addition to 0x00 style ๐Ÿซถ

๐ŸŒธ Renesas M32R (formerly Mitsubishi M32R) series

These options show up when as is configured for the Renesas M32R (formerly Mitsubishi M32R) series ๐Ÿฆ‹

  • --m32rx โ€” specifies which processor in the M32R family is the target ๐Ÿ”ฅ The default is normally the M32R, but this option switches it to the M32RX โœจ
  • --warn-explicit-parallel-conflicts or --Wp โ€” produces warning messages whenever questionable parallel constructs show up ๐Ÿ‘€
  • --no-warn-explicit-parallel-conflicts or --Wnp โ€” does not produce warning messages when questionable parallel constructs show up ๐Ÿ™…โ€โ™€๏ธ

๐Ÿ’… Motorola 68000 series

These options show up when as is configured for the Motorola 68000 series ๐Ÿงš

  • -l โ€” shortens references to undefined symbols to one word instead of two ๐Ÿ’ซ
  • -m68000 | -m68008 | -m68010 | -m68020 | -m68030 | -m68040 | -m68060 | -m68302 | -m68331 | -m68332 | -m68333 | -m68340 | -mcpu32 | -m5200 โ€” specifies which processor in the 68000 family is the target ๐ŸŽ€ The default is normally the 68020, but this can be changed at configuration time โญ
  • -m68881 | -m68882 | -mno-68881 | -mno-68882 โ€” tells it whether the target machine does (or does not) have a floating-point coprocessor ๐ŸŒˆ The default is to assume a coprocessor for the 68020, 68030, and cpu32 ๐Ÿ“ The basic 68000 isn't compatible with the 68881, but you can specify a combo of the two, since it's possible to emulate the coprocessor instructions with the main processor ๐Ÿค“
  • -m68851 | -mno-68851 โ€” tells it whether the target machine does (or does not) have a memory-management unit coprocessor ๐Ÿ’œ The default is to assume an MMU for the 68020 and up โœจ

For details about the PDP-11 machine dependent features options, see PDP-11-Options ๐Ÿ‘€

  • -mpic | -mno-pic โ€” generates position-independent (or position-dependent) code ๐Ÿฆ‹ The default is -mpic ๐Ÿ’–
  • -mall or -mall-extensions โ€” enables all instruction set extensions. This is the default ๐Ÿ”ฅ
  • -mno-extensions โ€” disables all instruction set extensions ๐Ÿ™…โ€โ™€๏ธ
  • -mextension | -mno-extension โ€” enables (or disables) one particular instruction set extension ๐Ÿซถ
  • -mcpu โ€” enables the instruction set extensions supported by a particular CPU, and disables all other extensions ๐Ÿ‘‘
  • -mmachine โ€” enables the instruction set extensions supported by a particular machine model, and disables all other extensions ๐Ÿ’…

๐Ÿงš picoJava processor

These options show up when as is configured for a picoJava processor ๐ŸŒธ

  • -mb โ€” generates "big endian" format output ๐Ÿ“
  • -ml โ€” generates "little endian" format output ๐Ÿ’œ

๐ŸŒˆ PRU processor

These options show up when as is configured for a PRU processor โœจ

  • -mlink-relax โ€” assumes that LD would optimize LDI32 instructions by checking the upper 16 bits of the expression ๐Ÿง If they are all zeros, LD would shorten the LDI32 instruction to a single LDI ๐Ÿ’€ In that case, "as" will output DIFF relocations for diff expressions ๐Ÿซถ
  • -mno-link-relax โ€” assumes that LD would not optimize LDI32 instructions ๐Ÿ™ˆ As a consequence, DIFF relocations will not be emitted ๐Ÿ’”
  • -mno-warn-regname-label โ€” does not warn if a label name matches a register name ๐ŸŽ€ Assembler programmers usually want this warning to be emitted, but C compilers may want to turn it off ๐Ÿ’…

๐Ÿฆ‹ MIPS processor

These options show up when as is configured for a MIPS processor ๐ŸŒˆ

  • -G num โ€” sets the largest size of an object that can be referenced implicitly with the "gp" register ๐Ÿ”ฅ It's only accepted for targets that use ECOFF format, such as a DECstation running Ultrix ๐Ÿ–ฅ๏ธ The default value is 8 โœจ
  • -EB โ€” generates "big endian" format output ๐Ÿ“
  • -EL โ€” generates "little endian" format output ๐Ÿ’œ
  • -mips1 | -mips2 | -mips3 | -mips4 | -mips5 | -mips32 | -mips32r2 | -mips32r3 | -mips32r5 | -mips32r6 | -mips64 | -mips64r2 | -mips64r3 | -mips64r5 | -mips64r6 โ€” generates 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, -mips32r3, -mips32r5, -mips32r6, -mips64, -mips64r2, -mips64r3, -mips64r5, and -mips64r6 correspond to generic MIPS V, MIPS32, MIPS32 Release 2, MIPS32 Release 3, MIPS32 Release 5, MIPS32 Release 6, MIPS64, MIPS64 Release 2, MIPS64 Release 3, MIPS64 Release 5, and MIPS64 Release 6 ISA processors, respectively ๐Ÿคฏ
  • -march=cpu โ€” generates code for a particular MIPS CPU ๐ŸŽ€
  • -mtune=cpu โ€” schedules and tunes for a particular MIPS CPU ๐Ÿง 
  • -mfix7000 | -mno-fix7000 โ€” causes nops to be inserted if the read of the destination register of an mfhi or mflo instruction occurs in the following two instructions ๐Ÿ™ˆ
  • -mfix-rm7000 | -mno-fix-rm7000 โ€” causes nops to be inserted if a dmult or dmultu instruction is followed by a load instruction ๐Ÿซ 
  • -mfix-r5900 | -mno-fix-r5900 โ€” does not try to schedule the preceding instruction into the delay slot of a branch placed at the end of a short loop of six instructions or fewer. It always schedules a "nop" instruction there instead ๐Ÿ›‘ The short loop bug can, under certain conditions, make loops run only once or twice, thanks to a hardware bug in the R5900 chip ๐Ÿ˜ญ
โš ๏ธ The short loop bug is a real hardware issue on the R5900 chip, so keep -mfix-r5900 in mind if your loops are acting weird ๐Ÿ™ƒ
  • -mdebug | -no-mdebug โ€” causes stabs-style debugging output to go into an ECOFF-style .mdebug section instead of the standard ELF .stabs sections ๐Ÿงš
  • -mpdr | -mno-pdr โ€” controls generation of ".pdr" sections ๐Ÿ’…
  • -mgp32 | -mfp32 โ€” 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 ๐Ÿ’œ
  • -mgp64 | -mfp64 โ€” register sizes are normally inferred from the ISA and ABI, but these flags force a certain group of registers to be treated as 64 bits wide at all times ๐Ÿ“ -mgp64 controls the size of general-purpose registers, and -mfp64 controls the size of floating-point registers ๐ŸŒˆ
  • -mfpxx โ€” register sizes are normally inferred from the ISA and ABI, but using this flag in combination with -mabi=32 enables an ABI variant that operates correctly with floating-point registers that are 32 or 64 bits wide ๐Ÿฆ‹
  • -modd-spreg | -mno-odd-spreg โ€” enables use of floating-point operations on odd-numbered single-precision registers when the ISA supports it ๐Ÿ”ฅ -mfpxx implies -mno-odd-spreg, otherwise the default is -modd-spreg โœจ
  • -mips16 | -no-mips16 โ€” generates code for the MIPS 16 processor ๐ŸŽ€ This is equivalent to putting ".module mips16" at the start of the assembly file ๐Ÿ“ -no-mips16 turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mmips16e2 | -mno-mips16e2 โ€” enables the use of MIPS16e2 instructions in MIPS16 mode ๐Ÿ’ซ This is equivalent to putting ".module mips16e2" at the start of the assembly file ๐Ÿ“ -mno-mips16e2 turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mmicromips | -mno-micromips โ€” generates code for the microMIPS processor ๐ŸŒธ This is equivalent to putting ".module micromips" at the start of the assembly file ๐Ÿ“ -mno-micromips turns this option off ๐Ÿ™…โ€โ™€๏ธ This is equivalent to putting ".module nomicromips" at the start of the assembly file ๐Ÿค”
  • -msmartmips | -mno-smartmips โ€” enables the SmartMIPS extension to the MIPS32 instruction set ๐Ÿ’œ This is equivalent to putting ".module smartmips" at the start of the assembly file ๐Ÿ“ -mno-smartmips turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mips3d | -no-mips3d โ€” generates code for the MIPS-3D Application Specific Extension ๐Ÿงš This tells the assembler to accept MIPS-3D instructions ๐Ÿซถ -no-mips3d turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mdmx | -no-mdmx โ€” generates code for the MDMX Application Specific Extension ๐ŸŒˆ This tells the assembler to accept MDMX instructions ๐Ÿซถ -no-mdmx turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mdsp | -mno-dsp โ€” generates code for the DSP Release 1 Application Specific Extension ๐ŸŽ€ This tells the assembler to accept DSP Release 1 instructions ๐Ÿซถ -mno-dsp turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mdspr2 | -mno-dspr2 โ€” generates code for the DSP Release 2 Application Specific Extension โœจ This option implies -mdsp, and it tells the assembler to accept DSP Release 2 instructions ๐Ÿซถ -mno-dspr2 turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mdspr3 | -mno-dspr3 โ€” generates code for the DSP Release 3 Application Specific Extension ๐Ÿ”ฅ This option implies -mdsp and -mdspr2, and it tells the assembler to accept DSP Release 3 instructions ๐Ÿซถ -mno-dspr3 turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mmsa | -mno-msa โ€” generates code for the MIPS SIMD Architecture Extension ๐Ÿฆ‹ This tells the assembler to accept MSA instructions ๐Ÿซถ -mno-msa turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mxpa | -mno-xpa โ€” generates code for the MIPS eXtended Physical Address (XPA) Extension ๐ŸŒธ This tells the assembler to accept XPA instructions ๐Ÿซถ -mno-xpa turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mmt | -mno-mt โ€” generates code for the MT Application Specific Extension ๐Ÿ’– This tells the assembler to accept MT instructions ๐Ÿซถ -mno-mt turns this option off ๐Ÿ™…โ€โ™€๏ธ
  • -mmcu, -mno-mcu โ€” okay so this one turns on the MCU Application Specific Extension ๐Ÿ’–. It tells the assembler to accept MCU instructions, and -mno-mcu turns it back off ๐Ÿ™…โ€โ™€๏ธ
  • -mcrc, -mno-crc โ€” this generates code for the MIPS cyclic redundancy check (CRC) Application Specific Extension โœจ. It tells the assembler to accept CRC instructions, and -mno-crc switches it off ๐Ÿฆ‹
  • -mginv, -mno-ginv โ€” this one is for the Global INValidate (GINV) Application Specific Extension ๐Ÿงš. It tells the assembler to accept GINV instructions, and -mno-ginv turns it off ๐Ÿ’…
  • -mloongson-mmi, -mno-loongson-mmi โ€” this is the Loongson MultiMedia extensions Instructions (MMI) Application Specific Extension ๐ŸŽ€. It tells the assembler to accept MMI instructions, and -mno-loongson-mmi turns it off ๐ŸŒธ
  • -mloongson-cam, -mno-loongson-cam โ€” generates code for the Loongson Content Address Memory (CAM) instructions ๐Ÿ“. It tells the assembler to accept Loongson CAM instructions, and -mno-loongson-cam turns this option off ๐Ÿซถ
  • -mloongson-ext, -mno-loongson-ext โ€” this one covers the Loongson EXTensions (EXT) instructions โญ. It tells the assembler to accept Loongson EXT instructions, and -mno-loongson-ext turns it off ๐Ÿ”ฅ
  • -mloongson-ext2, -mno-loongson-ext2 โ€” this is the Loongson EXTensions R2 (EXT2) instructions ๐Ÿ‘‘. This option implies -mloongson-ext. It tells the assembler to accept Loongson EXT2 instructions, and -mno-loongson-ext2 turns this option off ๐Ÿ’œ
  • -minsn32, -mno-insn32 โ€” okay this one is giving strict ๐Ÿ™ˆ. Only 32-bit instruction encodings get used when generating code for the microMIPS processor, so no 16-bit instructions at all. It's equivalent to putting .set insn32 at the start of the assembly file. -mno-insn32 turns it off, and that's equivalent to putting .set noinsn32 at the start of the assembly file. By default -mno-insn32 is selected, so every instruction is fair game ๐ŸŒˆ
  • --construct-floats, --no-construct-floats โ€” --no-construct-floats disables building 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, so those floating point constants can be constructed โœจ
  • --relax-branch, --no-relax-branch โ€” --relax-branch turns on relaxation of out-of-range branches ๐Ÿฆ„. By default --no-relax-branch is selected, which means any out-of-range branches produce an error ๐Ÿ’€
  • -mignore-branch-isa, -mno-ignore-branch-isa โ€” ignores branch checks for invalid transitions between ISA modes ๐Ÿ™ƒ. The semantics of branches doesn't provide for an ISA mode switch, so in most cases the ISA mode a branch was encoded for has to match the ISA mode of the branch's target label. That's why GAS has checks that verify in branch assembly that the two ISA modes match. -mignore-branch-isa disables these checks. By default -mno-ignore-branch-isa is selected, so any invalid branch that needs a transition between ISA modes produces an error ๐Ÿšซ
  • -mnan=encoding โ€” pick between the IEEE 754-2008 (-mnan=2008) or the legacy (-mnan=legacy) NaN encoding format ๐Ÿง . The latter is the default ๐Ÿ’…
  • --emulation=name โ€” this one used to switch between ELF and ECOFF output on targets like IRIX 5 that supported both ๐Ÿ•ฐ๏ธ. MIPS ECOFF support was removed in GAS 2.24, so the option now serves little purpose. It's kept around for backwards compatibility ๐Ÿซ 

The available configuration names are: mipself, mipslelf and mipsbelf. Choosing mipself has no effect now, since the output is always ELF. mipslelf and mipsbelf select little- and big-endian output respectively, but -EL and -EB are the preferred options instead ๐Ÿ’–

  • -nocpp โ€” as ignores this one ๐Ÿ™„. It's only accepted for compatibility with the native tools ๐Ÿงš
  • --trap, --no-trap, --break, --no-break โ€” these control how to deal with multiplication overflow and division by zero ๐Ÿ’ฅ. --trap or --no-break (which are synonyms) take a trap exception, and they only work for Instruction Set Architecture level 2 and higher. --break or --no-trap (also synonyms, and the default) take a break exception ๐ŸŽ€
  • -n โ€” when you use this, as will issue a warning every time it generates a nop instruction from a macro โš ๏ธ

The following options are available when as is configured for a LoongArch processor. ๐ŸŒธ

  • -fpic, -fPIC โ€” generates position-independent code ๐Ÿฆ‹
  • -fno-pic โ€” doesn't generate position-independent code (this is the default) ๐Ÿ™…โ€โ™€๏ธ

The following options are available when as is configured for a Meta processor. ๐Ÿงš

  • -mcpu=metac11 โ€” generates code for Meta 1.1 โœจ
  • -mcpu=metac12 โ€” generates code for Meta 1.2 ๐Ÿ“
  • -mcpu=metac21 โ€” generates code for Meta 2.1 ๐Ÿ’œ
  • -mfpu=metac21 โ€” lets code use the FPU hardware of Meta 2.1 ๐Ÿ”ฅ

See the info pages for documentation of the MMIX-specific options. ๐Ÿ“š

The following options are available when as is configured for a NDS32 processor. ๐ŸŒˆ

  • -O1 โ€” optimizes for performance ๐ŸŽ๏ธ
  • -Os โ€” optimizes for space ๐Ÿ“ฆ
  • -EL โ€” produces little endian data output ๐Ÿ’ซ
  • -EB โ€” produces little endian data output (yes, the original page says little endian for this one too, so I'm keeping it exactly like that ๐Ÿ™ˆ)
  • -mpic โ€” generates PIC ๐Ÿซถ
  • -mno-fp-as-gp-relax โ€” suppresses fp-as-gp relaxation for this file ๐Ÿšซ
  • -mb2bb-relax โ€” back-to-back branch optimization ๐Ÿ”
  • -mno-all-relax โ€” suppresses all relaxation for this file ๐Ÿ™…โ€โ™€๏ธ
  • -march=<arch name> โ€” assembles for the architecture arch name, which could be v3, v3j, v3m, v3f, v3s, v2, v2j, v2f, or v2s ๐Ÿ›๏ธ
  • -mbaseline=<baseline> โ€” assembles for the baseline baseline, which could be v2, v3, or v3m ๐Ÿงฑ
  • -mfpu-freg=FREG โ€” specifies an FPU configuration ๐ŸŽ›๏ธ
    • 0 โ€” 8 SP / 4 DP registers
    • 1 โ€” 16 SP / 8 DP registers
    • 2 โ€” 32 SP / 16 DP registers
    • 3 โ€” 32 SP / 32 DP registers
  • -mabi=abi โ€” specifies an ABI version, where abi could be v1, v2, v2fp, or v2fpp ๐Ÿ‘‘
  • -m[no-]mac โ€” enables or disables multiply instructions support ๐Ÿ”ข
  • -m[no-]div โ€” enables or disables divide instructions support โž—
  • -m[no-]16bit-ext โ€” enables or disables 16-bit extension ๐Ÿงฉ
  • -m[no-]dx-regs โ€” enables or disables the d0/d1 registers ๐Ÿ—‚๏ธ
  • -m[no-]perf-ext โ€” enables or disables the Performance extension ๐Ÿƒโ€โ™€๏ธ
  • -m[no-]perf2-ext โ€” enables or disables the Performance extension 2 ๐Ÿƒโ€โ™€๏ธ๐Ÿƒโ€โ™€๏ธ
  • -m[no-]string-ext โ€” enables or disables the String extension ๐Ÿงต
  • -m[no-]reduced-regs โ€” enables or disables the Reduced Register configuration (GPR16) option ๐Ÿชถ
  • -m[no-]audio-isa-ext โ€” enables or disables the AUDIO ISA extension ๐ŸŽถ
  • -m[no-]fpu-sp-ext โ€” enables or disables the FPU SP extension ๐Ÿ”ข
  • -m[no-]fpu-dp-ext โ€” enables or disables the FPU DP extension ๐Ÿ”ข๐Ÿ”ข
  • -m[no-]fpu-fma โ€” enables or disables the FPU fused-multiply-add instructions ๐Ÿงฎ
  • -mall-ext โ€” turns on support for all extensions and instructions ๐ŸŒŸ

The following options are available when as is configured for a PowerPC processor. ๐Ÿ’…

  • -a32 โ€” generates ELF32 or XCOFF32 ๐Ÿ“
  • -a64 โ€” generates ELF64 or XCOFF64 ๐Ÿ“
  • -K PIC โ€” sets EF_PPC_RELOCATABLE_LIB in ELF flags ๐Ÿท๏ธ
  • -mpwrx, -mpwr2 โ€” generates code for POWER/2 (RIOS2) ๐Ÿ›ฐ๏ธ
  • -mpwr โ€” generates code for POWER (RIOS1) ๐Ÿš€
  • -m601 โ€” generates code for PowerPC 601 ๐Ÿ•น๏ธ
  • -mppc, -mppc32, -m603, -m604 โ€” generates code for PowerPC 603/604 ๐Ÿ’ฟ
  • -m403, -m405 โ€” generates code for PowerPC 403/405 ๐Ÿ“ผ
  • -m440 โ€” generates code for PowerPC 440, BookE and some 405 instructions ๐Ÿ“€
  • -m464 โ€” generates code for PowerPC 464 ๐ŸŽž๏ธ
  • -m476 โ€” generates code for PowerPC 476 ๐ŸŽฌ
  • -m7400, -m7410, -m7450, -m7455 โ€” generates code for PowerPC 7400/7410/7450/7455 ๐Ÿ“บ
  • -m750cl, -mgekko, -mbroadway โ€” generates code for PowerPC 750CL/Gekko/Broadway ๐ŸŽฎ
  • -m821, -m850, -m860 โ€” generates code for PowerPC 821/850/860 ๐Ÿ–จ๏ธ
  • -mppc64, -m620 โ€” generates code for PowerPC 620/625/630 ๐Ÿง 
  • -me200z2, -me200z4 โ€” generates code for e200 variants, where e200z2 comes with LSP and e200z4 comes with SPE ๐Ÿš—
  • -me300 โ€” generates code for the PowerPC e300 family ๐Ÿš™
  • -me500, -me500x2 โ€” generates code for the Motorola e500 core complex ๐Ÿ๏ธ
  • -me500mc โ€” generates code for the Freescale e500mc core complex ๐Ÿ›ต
  • -me500mc64 โ€” generates code for the Freescale e500mc64 core complex ๐Ÿ›บ
  • -me5500 โ€” generates code for the Freescale e5500 core complex ๐Ÿš
  • -me6500 โ€” generates code for the Freescale e6500 core complex ๐ŸšŒ
  • -mlsp โ€” enables LSP instructions (this disables SPE and SPE2) ๐Ÿ”•
  • -mspe โ€” generates code for Motorola SPE instructions (this disables LSP) ๐Ÿ”‡
  • -mspe2 โ€” generates code for Freescale SPE2 instructions (this disables LSP) ๐Ÿ”‡
  • -mtitan โ€” generates code for the AppliedMicro Titan core complex ๐Ÿ—ป
  • -mppc64bridge โ€” generates code for PowerPC 64, including bridge insns ๐ŸŒ‰
  • -mbooke โ€” generates code for 32-bit BookE ๐Ÿ“–
  • -ma2 โ€” generates code for the A2 architecture ๐Ÿงช
  • -maltivec โ€” generates code for processors with AltiVec instructions ๐ŸŽน
  • -mvle โ€” generates code for Freescale PowerPC VLE instructions ๐Ÿงพ
  • -mvsx โ€” generates code for processors with Vector-Scalar (VSX) instructions ๐Ÿ“ˆ
  • -mhtm โ€” generates code for processors with Hardware Transactional Memory instructions ๐Ÿงพ
  • -mpower4, -mpwr4 โ€” generates code for the Power4 architecture ๐ŸŒ€
  • -mpower5, -mpwr5, -mpwr5x โ€” generates code for the Power5 architecture ๐ŸŒ€๐ŸŒ€
  • -mpower6, -mpwr6 โ€” generates code for the Power6 architecture โšก
  • -mpower7, -mpwr7 โ€” generates code for the Power7 architecture โšกโšก
  • -mpower8, -mpwr8 โ€” generates code for the Power8 architecture ๐ŸŒŸ
  • -mpower9, -mpwr9 โ€” generates code for the Power9 architecture ๐ŸŒŸ๐ŸŒŸ
  • -mpower10, -mpwr10 โ€” generates code for the Power10 architecture ๐Ÿ’ซ
  • -mpower11, -mpwr11 โ€” generates code for the Power11 architecture ๐ŸŒ 
  • -mfuture โ€” generates code for the 'future' architecture ๐Ÿ”ฎ
  • -mcell โ€” generates code for the Cell Broadband Engine architecture ๐ŸŽฑ
  • -mcom โ€” generates code for Power/PowerPC common instructions ๐Ÿค
  • -many โ€” generates code for any architecture (PWR/PWRX/PPC) ๐ŸŒ
  • -mregnames โ€” allows symbolic names for registers ๐Ÿท๏ธ
  • -mno-regnames โ€” does not allow symbolic names for registers ๐Ÿ™…โ€โ™€๏ธ
  • -mrelocatable โ€” supports GCC's -mrelocatable option ๐Ÿงญ
  • -mrelocatable-lib โ€” supports GCC's -mrelocatable-lib option ๐Ÿงญ๐Ÿงญ
  • -memb โ€” sets the PPC_EMB bit in ELF flags ๐Ÿงท
  • -mlittle, -mlittle-endian, -le โ€” generates code for a little endian machine ๐Ÿ’–

Okay, the RISC-V stuff is next, so let's get into it ๐ŸŒˆ

  • -mbig, -mbig-endian, -be โ€” generates code for a big endian machine ๐ŸŒธ
  • -msolaris โ€” generates code for Solaris โœจ
  • -mno-solaris โ€” nope, does NOT generate code for Solaris ๐Ÿ™…โ€โ™€๏ธ
  • -nops=count โ€” if an alignment directive would insert more than count nops, it puts a branch at the beginning so the nops get skipped and never actually run ๐Ÿงš

๐ŸŒˆ RISC-V ๐ŸŒˆ

Okay, these only show up when as is configured for a RISC-V processor, so keep that in mind, bestie ๐Ÿฆ‹

  • -fpic, -fPIC โ€” generates position-independent code ๐Ÿ’–
  • -fno-pic โ€” doesn't generate position-independent code. This is the default ๐Ÿ™ˆ
  • -march=ISA|Profiles|Profiles_ISA โ€” picks the base isa, whether you pass it as ISA, Profiles, or Profies_ISA. For example: -march=rv32ima, -march=RVI20U64, -march=RVI20U64_d. If this option and the architecture attributes aren't set, the assembler checks the default configure setting --with-arch=ISA instead ๐Ÿ”ฅ
  • -misa-spec=ISAspec โ€” picks the default isa spec version. If the ISA version isn't set by -march, the assembler helps out by setting the version based on the default spec it chose. If this option isn't set, the assembler checks the default configure setting --with-isa-spec=ISAspec ๐Ÿ“œ
  • -mpriv-spec=PRIVspec โ€” picks the privileged spec version. This decides whether a CSR is valid or not based on the spec you chose. If this option and the privilege attributes aren't set, the assembler checks the default configure setting --with-priv-spec=PRIVspec ๐Ÿ‘‘
  • -mabi=ABI โ€” selects the ABI, which is either "ilp32" or "lp64". You can optionally tack on "f", "d", or "q" to say you want the single-precision, double-precision, or quad-precision floating-point calling convention. Or you can use none of those, or "e", to get the soft-float calling convention ("e" means a soft-float RVE ABI) ๐Ÿ’…
  • -mrelax โ€” takes advantage of linker relaxations to cut down the number of instructions needed to materialize symbol addresses. This is the default โœจ
  • -mno-relax โ€” no linker relaxations for you ๐Ÿ™…โ€โ™€๏ธ
  • -march-attr โ€” generates the default contents for the riscv elf attribute section, but only if the .attribute directives aren't set. This section records the info a linker or runtime loader needs to check compatibility. That includes the ISA string, the stack alignment requirement, unaligned memory accesses, and the major, minor and revision version of the privileged spec ๐Ÿง 
  • -mno-arch-attr โ€” doesn't generate the default riscv elf attribute section if the .attribute directives aren't set ๐Ÿซถ
  • -mcsr-check โ€” enables CSR checking for the ISA-dependent CRS and the read-only CSR. ISA-dependent CSRs are only valid when the specific ISA is set. Read-only CSRs can't be written by the CSR instructions ๐Ÿ”’
  • -mno-csr-check โ€” no CSR checking, bestie ๐Ÿ™ƒ
  • -mlittle-endian โ€” generates code for a little endian machine ๐ŸŒท
  • -mbig-endian โ€” generates code for a big endian machine ๐ŸŒธ

For the RX-specific options, go check the info pages, because they've got the full tea on those ๐Ÿ“š

๐Ÿงš s390 ๐Ÿงš

These options are available when as is configured for the s390 processor family ๐Ÿ’œ

  • -m31, -m64 โ€” picks the word size, either 31/32 bits or 64 bits ๐Ÿ”ฅ
  • -mesa, -mzarch โ€” picks the architecture mode, either the Enterprise System Architecture (esa) or the z/Architecture mode (zarch) ๐Ÿ›๏ธ
  • -march=processor โ€” tells it which s390 processor variant is the target. You can choose g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec (or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), z13 (or arch11), z14 (or arch12), z15 (or arch13), z16 (or arch14), or z17 (or arch15) โญ
  • -mregnames, -mno-regnames โ€” allows or disallows symbolic names for registers ๐ŸŽ€
  • -mwarn-areg-zero โ€” warns whenever the operand for a base or index register has been specified but evaluates to zero โš ๏ธ
  • -mwarn-regtype-mismatch=strict, -mwarn-regtype-mismatch=relaxed, -mwarn-regtype-mismatch=no, -mno-warn-regtype-mismatch โ€” controls whether the assembler does register name type checks and throws a warning when there's a mismatch with the operand register type. The default, which you can get back with the relaxed argument, does relaxed checks. Those let floating point register (FPR) names %f0 to %f15 be used as arguments for vector register (VR) operands, and vector register (VR) names %v0 to %v15 be used for floating point register (FPR) operands. That's fine because the FPRs are embedded in the lower half of the VR ๐Ÿซง. With the strict argument, the strict register name type checks happen. The no argument, which is the same as -mno-warn-regtype-mismatch, turns off all register name type checks ๐Ÿ™ˆ

๐Ÿฆ‹ TMS320C6000 ๐Ÿฆ‹

These options are available when as is configured for a TMS320C6000 processor ๐Ÿง

  • -march=arch โ€” only enables instructions from architecture arch. By default, all instructions are allowed ๐Ÿ’–

The accepted values of arch are "c62x", "c64x", "c64x+", "c67x", "c67x+", and "c674x" โœจ

  • -mdsbt, -mno-dsbt โ€” the -mdsbt option makes the assembler generate the "Tag_ABI_DSBT" attribute with a value of 1, which means the code uses DSBT addressing. The -mno-dsbt option, the default, makes the tag have a value of 0, which means the code doesn't use DSBT addressing. The linker will warn you if objects of different type (DSBT and non-DSBT) get linked together โš ๏ธ
  • -mpid=no, -mpid=near, -mpid=far โ€” the -mpid= option makes the assembler generate the "Tag_ABI_PID" attribute, with a value showing what kind of data addressing the code uses. -mpid=no, the default, means position-dependent data addressing. -mpid=near means position-independent addressing with GOT accesses using near DP addressing. -mpid=far means position-independent addressing with GOT accesses using far DP addressing. The linker will warn you if objects built with different settings of this option get linked together ๐ŸŒˆ
  • -mpic, -mno-pic โ€” the -mpic option makes the assembler generate the "Tag_ABI_PIC" attribute with a value of 1, meaning the code uses position-independent code addressing. The "-mno-pic" option, the default, gives the tag a value of 0, meaning position-dependent code addressing. The linker will warn you if objects of different type (position-dependent and position-independent) get linked together ๐Ÿ”—
  • -mbig-endian, -mlittle-endian โ€” generates code for the endianness you specify. The default is little-endian ๐ŸŒท

๐Ÿ‰ TILE-Gx ๐Ÿ‰

These options are available when as is configured for a TILE-Gx processor ๐Ÿ’…

  • -m32 | -m64 โ€” picks the word size, either 32 bits or 64 bits ๐Ÿ”ฅ
  • -EB | -EL โ€” picks the endianness, either big-endian (-EB) or little-endian (-EL) ๐Ÿซถ

๐Ÿ›ธ Visium ๐Ÿ›ธ

This option is available when as is configured for a Visium processor ๐Ÿ‘ฝ

  • -mtune=arch โ€” specifies the target architecture. If you try to assemble an instruction that won't execute on the target architecture, the assembler throws an error message at you ๐Ÿ˜ญ

The names it recognizes are "mcm24", "mcm", "gr5", and "gr6" ๐Ÿ’œ

๐ŸŒ™ Xtensa ๐ŸŒ™

These options are available when as is configured for an Xtensa processor ๐ŸŒŸ

  • --text-section-literals, --no-text-section-literals โ€” controls how literal pools get treated. The default is --no-text-section-literals, which puts literals in separate sections in the output file, so the literal pool can live in data RAM/ROM. With --text-section-literals, the literals get interspersed in the text section so they stay as close as possible to their references. You might need this for big assembly files, where the literals would otherwise be out of range of the "L32R" instructions in the text section. Literals get grouped into pools following ".literal_position" directives or right before "ENTRY" instructions. These options only affect literals referenced via PC-relative "L32R" instructions. Literals for absolute mode "L32R" instructions are handled separately ๐Ÿงฉ
  • --auto-litpools, --no-auto-litpools โ€” also controls how literal pools get treated. The default is --no-auto-litpools, which, when --text-section-literals isn't used, puts literals in separate sections in the output file so the literal pool can live in data RAM/ROM. With --auto-litpools, the literals get interspersed in the text section to stay as close as possible to their references, and you don't need explicit ".literal_position" directives. This can be necessary for very large functions, where one literal pool at the beginning of the function might not be reachable by "L32R" instructions at the end. These options only affect literals referenced via PC-relative "L32R" instructions. Literals for absolute mode "L32R" instructions are handled separately. When you use it together with --text-section-literals, --auto-litpools takes precedence ๐Ÿ‘‘
  • --absolute-literals, --no-absolute-literals โ€” tells the assembler whether "L32R" instructions use absolute or PC-relative addressing. If the processor includes the absolute addressing option, the default is to use absolute "L32R" relocations. Otherwise, only the PC-relative "L32R" relocations can be used ๐Ÿ“
  • --target-align, --no-target-align โ€” enables or disables automatic alignment to reduce branch penalties, at some expense in code size. This optimization is on by default. Note that the assembler will always align instructions like "LOOP" that have fixed alignment requirements ๐Ÿƒโ€โ™€๏ธ
  • --longcalls, --no-longcalls โ€” enables or disables transforming call instructions so calls can reach a greater range of addresses. Use this when call targets might be out of range. It may hurt both code size and performance, but the linker can usually optimize away the unnecessary overhead when a call ends up within range. The default is --no-longcalls ๐Ÿ“ž
  • --transform, --no-transform โ€” enables or disables all assembler transformations of Xtensa instructions, including both relaxation and optimization. The default is --transform. Only use --no-transform in the rare cases when the instructions must be exactly as you wrote them in the assembly source. Using --no-transform makes out of range instruction operands into errors ๐Ÿšจ

the rename option: --rename-section oldname=newname. Rename the oldname section to newname, and you can repeat this one as many times as you need to rename several sections. ๐ŸŽ€

  • --trampolines | --no-trampolines: Turns on (or off) rewriting of jump instructions so they can reach a wider range of addresses. Reach for this when jump targets might be out of range. If there are no such jumps, it doesn't change code size or performance at all. The default is --trampolines. ๐Ÿฆ‹
  • --abi-windowed | --abi-call0: Picks the ABI tag that gets written into the .xtensa.info section, which tells everyone what ABI the assembly code uses. The linker will warn you if you try to link object files with mismatched ABI tags, so be careful, bestie ๐Ÿ˜ญ. If you don't choose, the default comes from the Xtensa core configuration. ๐Ÿ’œ

The following options are available when as is configured for a Z80 processor. โœจ

@chapter Z80 Dependent Features

โœจ Command-line Options โœจ

  • -march=CPU[-EXT...][+EXT...]: Picks the target processor. If you try to assemble an instruction that won't run on that processor, the assembler throws an error at you ๐Ÿ’€. These processor names are recognised: "z80", "z180", "ez80", "gbz80", "z80n", "r800". Beyond the basic instruction set, you can also ask for some extension mnemonics. For example, -march=z180+sli+infc extends z180 with SLI instructions and IN F,(C). These extensions are currently supported:
    • "full" (all known instructions)
    • "adl" (ADL CPU mode by default, eZ80 only)
    • "sli" (instruction known as SLI, SLL or SL1)
    • "xyhl" (instructions with halves of index registers: IXL, IXH, IYL, IYH)
    • "xdcb" (instructions like RotOp (II+d),R and BitOp n,(II+d),R)
    • "infc" (instruction IN F,(C) or IN (C))
    • "outc0" (instruction OUT (C),0)

Quick heads up: instead of adding onto a basic set, extensions starting with - revoke that functionality ๐Ÿ™ˆ. For example, -march=z80-full+xyhl first strips out all default extensions, then adds support for index register halves only.

If you don't specify this option, the assembler assumes -march=z80+xyhl+infc. ๐ŸŒธ

  • -local-prefix=prefix: Marks every label starting with the given prefix as local. You can still explicitly mark one of those labels as global in your code, though ๐Ÿงš. This doesn't change the default local label prefix .L, it just adds a new one alongside it.
  • -colonless: Accepts labels without colons. Every symbol at the start of a line gets treated as a label โœจ.
  • -sdcc: Accepts assembler code produced by SDCC ๐Ÿ“.
  • -fp-s=FORMAT: Sets the format for single precision floating point numbers. The default is ieee754 (32 bit).
  • -fp-d=FORMAT: Sets the format for double precision floating point numbers. The default is ieee754 (64 bit).

โœจ SEE ALSO โœจ

gcc(1), ld(1), and the Info entries for binutils and ld. Go poke around those if you want more ๐Ÿ”ฅ.

Copyright (c) 1991-2025 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". ๐Ÿซถ

That's the whole AS page, bestie! You're officially a manual-reading legend now ๐Ÿ‘‘๐Ÿ’… binutils 2.45, December 2025, no cap โœจ๐ŸŒˆ

๐Ÿ“ฆ where this page comes from