LLVM-MC(1)
π 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-hiddenshows 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 otherllvm-mcflags. like β imagine transcoding assembly between different dialects? on Intel you can use-output-asm-variant=1to translate from AT&T to Intel assembly syntax. and combining it with--show-encodinglets 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 isasm. π-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=helpfor details. π--mcpu=<cpu-name>β target a specific cpu type.-mcpu=helpfor details. π§--triple=<string>β target triple to assemble for. again: see-versionfor 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 +--assembleis a whole vibe β¨--save-temp-labelsβ don't discard temporary labels. keep them!! π€--relax-relocationsβ emitR_X86_64_GOTPCRELXinstead ofR_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=0prints in AT&T syntax, and--output-asm-variant=1prints 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 π«Ά
π§ COPYRIGHT π§
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
- centos-stream 9: llvm 23.1.3-1.el9 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- centos-stream 9: llvm 23.1.3-1.el9 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms