LLVM-MC(1)
π LLVM-MC(1) β the LLVM Machine Code Playground, bestie edition π
okay so. this is a page from the LLVM manual set, and it's literally the glow-up era of assembly tooling. welcome to the playground, babe π
β¨ NAME β¨
llvm-mc β LLVM Machine Code Playground π
πΈ SYNOPSIS πΈ
llvm-mc [options] [filename]
π¦ DESCRIPTION π¦
So llvm-mc takes assembly code for an architecture you pick, and it makes an object file or an executable out of it. That's the whole vibe. π«Ά
It's basically a little toolkit for machine code β encoding instructions, showing you the internal representations, disassembling strings into bytes, all of that. It's giving "backstage pass to the assembler." π
And here's the cute part: which architecture it targets for the output assembly is figured out automatically from your input file. Unless you use the --arch option to override the default, in which case you're the main character and you decide. β¨
π₯ OPTIONS π₯
First, the output tea β β because this part matters:
- If you leave out the
-ooption,llvm-mcsends its output to standard output when the input is from standard input. - If
-ois set to"-", the output also goes to standard output. periodt. - If there's no
-ooption and you gave an input file that isn't"-", thenllvm-mcbuilds the output filename like this: take the input filename, strip any existing.sextension, and slap a.oon the end. iconic behavior fr fr. π§
And all the other llvm-mc options are down below, bestie. β¬οΈ
π End-user Options π
--helpβ shows you all the available options. Add--help-hiddenif you want more. π-o <filename>β use <filename> as the output filename. scroll up to the summary if you want the deets. π--arch=<string>β the target arch you're assembling for. run-versionto see which targets are actually available. π--as-lexβ applies the assembler's "lexer" to chop your input into tokens and print each one out. this one's for developing and testing an assembler implementation, iykyk. π€--assembleβ assemble the assembly file (this is the default!), and print the result out as assembly. super useful for designing and testing instruction parsers, and it's lowkey a great tool when you pair it with otherllvm-mcflags. for example, it's handy for transcoding assembly between different dialects β like on Intel, where you can use-output-asm-variant=1to translate from AT&T to Intel assembly syntax. you can also combine it with--show-encodingto understand how instructions are encoded. ate. π--disassembleβ parses a series of hex bytes and prints the result out as assembly syntax. hex in, assembly out, slay. π¦--mdisβ marked up disassembly of a string of hex bytes. fancy. β¨--cdisβ colored disassembly of a string of hex bytes. it's giving rainbow π--filetype=[asm,null,obj]β sets the output filetype.asmmakes the tool output text assembly.objmakes the tool output an object file.nullmeans no output gets created at all, which is great for timing purposes. the default value isasm. π-gβ generate DWARF debugging info for assembly source files. π--hexβ takes raw hexadecimal bytes as input for disassembly. whitespace gets ignored, no stress. π--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. π·οΈ--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>β the target triple to assemble for. run-versionto see the available targets. β--split-dwarf-file=<filename>β DWO output filename. ποΈ--show-inst-operandsβ shows instruction operands as they're parsed. π--show-instβ shows the internal instruction representation. π--show-encodingβ shows instruction encodings. π’--save-temp-labelsβ don't discard temporary labels. keep them, they're precious. π₯Ί--relax-relocationsβ emitR_X86_64_GOTPCRELXinstead ofR_X86_64_GOTPCREL. glow-up for your relocations. β¨--print-imm-hexβ prefers hex format for immediate values. π‘--preserve-commentsβ preserves comments in the outputted assembly. your thoughts stay valid, bestie. π¬--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 DWARF debug sections compression. zip zip. π€
π EXIT STATUS π
If llvm-mc succeeds, it exits with 0. π
Otherwise, if an error happens, it exits with a non-zero value. π
π«Ά AUTHOR π«Ά
Maintained by the LLVM Team (https://llvm.org/). they're the blueprint, honestly. π
π COPYRIGHT π
2003-2026, LLVM Project
and that's the whole page, bestie β no cap, every flag accounted for. πβ¨
cute little sign-off for the footer tea: this page is from the LLVM source, dated 2026-07-22, sitting in the LLVM-MC(1) slot of the manual. mwah π ππ¦
π¦ where this page comes from
- epel 10: llvm21 21.1.8-8.el10_3 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm 21.1.8-6.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm 21.1.8-6.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms