LLVM-MC(1)

πŸ“¦ version 23.1.3, in centos-stream 9

πŸ’… LLVM-MC(1) β€” the LLVM machine code playground, bestie edition

okay so first things first, the manual name is LLVM and this page is LLVM-MC(1) β€” that's the whole vibe, let's get into it 🫢

✨ NAME ✨

llvm-mc β€” LLVM Machine Code Playground. literally the recess of the assembler world 🎠

🌸 SYNOPSIS 🌸

llvm-mc [options] [filename]

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, llvm-mc takes assembly code for whatever architecture you point it at and turns it into an object file or an executable. that's the whole personality πŸ’…

it also hands you a whole little kit of tools for messing with machine code β€” encoding instructions, showing you the internal representations, disassembling strings into bytes, that kind of thing. it's giving swiss army knife πŸ”₯

which architecture it's targeting for the output assembly? it figures that out automatically from your input file. iconic. the only time it doesn't is when you hit it with --arch to override the default β€” main character override energy πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

okay so before we even get to the list: if you don't pass -o, then llvm-mc sends its output to standard output when the input is from standard input. no cap.

and if -o is set to "-", the output also goes to standard output. cute.

but if there's no -o at all and you gave it an input file that isn't "-", then llvm-mc makes the output filename for you: it takes your input filename, strips any existing .s extension, and slaps a .o suffix on the end. free real estate ✨

the rest of the llvm-mc options are down here, bestie:

πŸ’– End-user Options πŸ’–

  • --help β€” shows you the available options. and if you're nosy, --help-hidden shows you the more. πŸ™ˆ
  • -o <filename> β€” use <filename> as the output filename. see the summary right above for the deets, i'm not retyping it πŸ’€
  • --arch=<string> β€” the target arch to assemble for. want the list of available targets? run -version. 🎯
  • --as-lex β€” applies the assembler's "lexer" to chop your input into tokens and prints every single one of them out. this one's for developing and testing an assembler implementation, so it's kind of an insider thing, iykyk πŸ”
  • --assemble β€” assembles the assembly file (this is the default, btw) and prints the result to assembly. super useful for designing and testing instruction parsers, and honestly a great little tool when you stack it with other llvm-mc flags. like β€” imagine transcoding assembly between different dialects? on Intel you can use -output-asm-variant=1 to translate from AT&T to Intel assembly syntax. and combining it with --show-encoding lets you see how instructions are encoded. obsessed 🧚
  • --disassemble β€” parses a series of hex bytes and prints the result out as assembly syntax. the reverse trick, slay πŸ’«
  • --mdis β€” marked up disassembly of a string of hex bytes.
  • --cdis β€” colored disassembly of a string of hex bytes. aesthetics matter 🌈
  • --filetype=[asm,null,obj] β€” sets the output filetype. asm = the tool outputs text assembly. obj = the tool outputs an object file. null = no output at all gets created, which is handy for timing purposes. the default value is asm. πŸ“
  • -g β€” generate DWARF debugging info for assembly source files. debug girlies rise πŸ›
  • --hex β€” take raw hexadecimal bytes as input for disassembly. whitespace is ignored, she doesn't care πŸ’…
  • --large-code-model β€” creates 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. like a nickname but official.
  • --masm-hexfloats β€” enables MASM-style hex float initializers (3F800000r).
  • -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. again: see -version for available targets. 🌍
  • --split-dwarf-file=<filename> β€” DWO output filename.
  • --show-inst-operands β€” show instruction operands as parsed.
  • --show-inst β€” show the internal instruction representation.
  • --show-encoding β€” show instruction encodings. this one + --assemble is a whole vibe ✨
  • --save-temp-labels β€” don't discard temporary labels. keep them!! 😀
  • --relax-relocations β€” emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL. very specific, very demure πŸ’€
  • --print-imm-hex β€” prefer hex format for immediate values. hex girlies, this is your moment πŸ”’
  • --preserve-comments β€” preserve comments in the outputted assembly. respect the commentary πŸ’¬
  • --output-asm-variant=<uint> β€” the 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. pick your fighter βš”οΈ
  • --compress-debug-sections=[none|zlib|zstd] β€” choose your DWARF debug sections compression. zip zip πŸ—œοΈ

πŸ’€ EXIT STATUS πŸ’€

if llvm-mc succeeds, it exits with 0. if an error happens, it exits with a non-zero value. simple as that, no plot twist 😭

πŸ‘‘ AUTHOR πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). the keepers of the code fr fr 🫢

2003-2026, LLVM Project


okay that's the whole page, mwah πŸ’‹ β€” this was the LLVM manual, LLVM-MC(1), page dated 2026-10-06, version 23. go forth and assemble, bestie, you're gonna ate it 🌟

πŸ“¦ where this page comes from