LLVM-MC(1)

πŸ’… LLVM-MC(1) β€” the LLVM Machine Code Playground, bestie edition ✨

okay so first things first, this whole page is from the LLVM manual set, and the star of the show is llvm-mc, aka the LLVM Machine Code Playground 🎠 β€” like, literally that's its government name.


🌸 NAME

llvm-mc β€” LLVM Machine Code Playground πŸŽ€


✨ SYNOPSIS

llvm-mc [options] [filename]

πŸ’– DESCRIPTION

so llvm-mc takes assembly code for a specified architecture as input and generates an object file or executable. slay. πŸ’…

it also gives you a whole little toolkit for working with machine code, like encoding instructions, displaying internal representations, disassembling strings to bytes, etc. it's giving swiss army knife, fr fr πŸ”₯

and the architecture for the output assembly code? it's automatically determined from the input file, unless you use the --arch option to override the default. so like, it just knows β€” unless you tell it otherwise, obviously. πŸ‘‘


πŸŽ€ OPTIONS

okay quick housekeeping before the list, this part matters:

  • if the -o option is omitted, then llvm-mc will send its output to standard output if the input is from standard input.
  • if the -o option specifies "-", then the output will also be sent to standard output.
  • if no -o option is specified and an input file other than "-" is specified, then llvm-mc creates the output filename by taking the input filename, removing any existing .s extension, and adding a .o suffix. iconic auto-naming behavior, honestly.

other llvm-mc options are described below, bestie. buckle up πŸ¦‹


🌈 End-user Options

  • --help β€” Display available options (--help-hidden for more). the "there's more in the back" energy, iykyk.
  • -o <filename> β€” Use <filename> as the output filename. See the summary above for more details. that summary is the bit we literally just did, so congrats, you're already ahead πŸ’…
  • --arch=<string> β€” Target arch to assemble for, see -version for available targets.
  • --as-lex β€” Apply the assemblers "lexer" to break the input into tokens and print each of them out. This is intended to help develop and test an assembler implementation. lowkey a dev-tool flex 🧚
  • --assemble β€” Assemble assembly file (default), and print the result to assembly. This is useful to design and test instruction parsers, and can be a useful tool when combined with other llvm-mc flags. For example, this option may be useful to transcode assembly from different dialects, e.g. on Intel where you can use -output-asm-variant=1 to translate from AT&T to Intel assembly syntax. It can also be combined with --show-encoding to understand how instructions are encoded. okay that's a lot of crossover potential β€” main character option honestly πŸ‘‘
  • --disassemble β€” Parse a series of hex bytes, and print the result out as assembly syntax.
  • --mdis β€” Marked up disassembly of string of hex bytes.
  • --cdis β€” Colored disassembly of string of hex bytes. πŸ’…βœ¨ aesthetic AND functional.
  • --filetype=[asm,null,obj] β€” Sets the output filetype. Setting this flag to asm will make the tool output text assembly. Setting this flag to obj will make the tool output an object file. Setting it to null causes no output to be created and can be used for timing purposes. The default value is asm. (yes, null is real, it's the "do nothing, just vibe" mode πŸ’€)
  • -g β€” Generate DWARF debugging info for assembly source files.
  • --hex β€” Take raw hexadecimal bytes as input for disassembly. Whitespace is ignored. so go ahead and format it however, it does not care 🫢
  • --large-code-model β€” Create CFI directives that assume the code might be more than 2 GB. big code, big energy.
  • --main-file-name=<string> β€” Specify the name we should consider the input file.
  • --masm-hexfloats β€” Enable MASM-style hex float initializers (3F800000r). note that little r at the end, it's doing the work.
  • -mattr=a1,+a2,-a3,... β€” Target specific attributes (-mattr=help for details).
  • --mcpu=<cpu-name> β€” Target a specific cpu type (-mcpu=help for details).
  • --triple=<string> β€” Target triple to assemble for, see -version for available targets.
  • --split-dwarf-file=<filename> β€” DWO output filename.
  • --show-inst-operands β€” Show instructions operands as parsed.
  • --show-inst β€” Show internal instruction representation.
  • --show-encoding β€” Show instruction encodings.
  • --save-temp-labels β€” Don't discard temporary labels. keep the little guys πŸ₯Ή
  • --relax-relocations β€” Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL. extremely specific, extremely valid.
  • --print-imm-hex β€” Prefer hex format for immediate values.
  • --preserve-comments β€” Preserve Comments in outputted assembly. yes queen, your comments survive the journey πŸ’–
  • --output-asm-variant=<uint> β€” Syntax variant to use for output printing. For example, on x86 targets --output-asm-variant=0 prints in AT&T syntax, and --output-asm-variant=1 prints in Intel/MASM syntax.
  • --compress-debug-sections=[none|zlib|zstd] β€” Choose DWARF debug sections compression.

⭐ EXIT STATUS

If llvm-mc succeeds, it will exit with 0. Otherwise, if an error occurs, it will exit with a non-zero value. so like, 0 = we ate, non-zero = something's up 😭


🫢 Author

Maintained by the LLVM Team (https://llvm.org/).

2003-2026, LLVM Project


okay that's the whole page, no cap. this one's LLVM-MC(1) from the LLVM manual, dated 23 / 2026-10-20 β€” mwah, go assemble something gorgeous πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from
  • arch rolling: llvm 23.1.4-1 Β· Apache-2.0 WITH LLVM-exception
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms