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
-ooption is omitted, thenllvm-mcwill send its output to standard output if the input is from standard input. - if the
-ooption specifies"-", then the output will also be sent to standard output. - if no
-ooption is specified and an input file other than"-"is specified, thenllvm-mccreates the output filename by taking the input filename, removing any existing.sextension, and adding a.osuffix. iconic auto-naming behavior, honestly.
other llvm-mc options are described below, bestie. buckle up π¦
π End-user Options
--helpβ Display available options (--help-hiddenfor 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-versionfor 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 otherllvm-mcflags. For example, this option may be useful to transcode assembly from different dialects, e.g. on Intel where you can use-output-asm-variant=1to translate from AT&T to Intel assembly syntax. It can also be combined with--show-encodingto 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 toasmwill make the tool output text assembly. Setting this flag toobjwill make the tool output an object file. Setting it tonullcauses no output to be created and can be used for timing purposes. The default value isasm. (yes,nullis 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 littlerat the end, it's doing the work.-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, see-versionfor 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β EmitR_X86_64_GOTPCRELXinstead ofR_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=0prints in AT&T syntax, and--output-asm-variant=1prints 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/).
π Copyright
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