LLVM-MC(1)
π LLVM-MC(1) β the LLVM Machine Code Playground, bestie edition π
okay so. hi. you're looking at the manual for llvm-mc from the LLVM fam, and honestly? she's a whole vibe. let's get into it. π¦
β¨ NAME β¨
llvm-mc β literally the LLVM Machine Code Playground. that's it. that's the name. iconic. π
πΈ SYNOPSIS πΈ
llvm-mc [options] [filename]
π DESCRIPTION π
so what does she even do. llvm-mc takes assembly code for a specified architecture as input and generates an object file or executable. periodt. π
she's basically a lil toolbox for working with machine code β encoding instructions, showing you the internal representations of stuff, disassembling strings into bytes, all of it. she's giving swiss army knife, she's giving main character energy. β¨
and the architecture for the output assembly code? she figures that out automatically from the input file. no cap. the only time she doesn't is when you use the --arch option to override the default. then you're the boss. π«Ά
π₯ OPTIONS π₯
first, the housekeeping on output, because this part is actually important:
- if you skip the
-ooption,llvm-mcsends its output to standard output when the input is coming from standard input. makes sense, right? - if
-ois set to"-", the output also goes to standard output. same energy. - if there's no
-oand the input file is something other than"-", thenllvm-mcmakes the output filename for you: it takes the input filename, removes any existing.sextension, and adds a.osuffix. so likething.sβthing.o. cute, efficient, no notes. π
the rest of the options are below. strap in.
π§ End-user Options π§
--helpβ display the available options. (there's also--help-hiddenfor more, if you're nosy. and honestly? be nosy. π)-o <filename>β use<filename>as the output filename. see the summary above for the deets.--arch=<string>β the target arch to assemble for. check-versionfor the available targets, bestie.--as-lexβ apply the assembler's "lexer" to break the input into tokens and print each one out. this is here to help develop and test an assembler implementation. it's giving "peek behind the curtain". β¨--assembleβ assemble the assembly file (this is the default), and print the result to assembly. this is useful for designing and testing instruction parsers, and it's a genuinely useful tool when you combine it with otherllvm-mcflags. for example, this option may be useful to transcode assembly from different dialects β like on Intel, where you can use-output-asm-variant=1to translate from AT&T to Intel assembly syntax. you can also pair it with--show-encodingto understand how instructions are encoded. combo moves!! π₯--disassembleβ parse a series of hex bytes, and print the result out as assembly syntax. reverse uno card. π--mdisβ marked up disassembly of a string of hex bytes.--cdisβ colored disassembly of a string of hex bytes. π (the aesthetic option, obviously.)--filetype=[asm,null,obj]β sets the output filetype. set it toasmand the tool outputs text assembly. set it toobjand the tool outputs an object file. set it tonulland no output is created at all β which you can use 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.--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).-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 instruction operands as parsed.--show-instβ show internal instruction representation.--show-encodingβ show instruction encodings.--save-temp-labelsβ don't discard temporary labels. keep them. they're valid. π₯Ί--relax-relocationsβ emitR_X86_64_GOTPCRELXinstead ofR_X86_64_GOTPCREL.--print-imm-hexβ prefer hex format for immediate values. hex girlies, this one's for you. π--preserve-commentsβ preserve comments in outputted assembly. (yes, your little; hinotes. they live on. π«Ά)--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.--compress-debug-sections=[none|zlib|zstd]β choose DWARF debug sections compression. squish. ποΈ
π EXIT STATUS π
if llvm-mc succeeds, she exits with 0. otherwise, if an error occurs, she exits with a non-zero value. simple as. β¨
π AUTHOR π
maintained by the LLVM Team (https://llvm.org/). the whole squad. π
β COPYRIGHT β
2003-2025, LLVM Project
ok and that's the whole page!! no cap, you read all of it, I'm so proud of you bestie π₯Ήπ
LLVM Β· version 20 Β· dated 2025-09-03 Β· mwah, go assemble something iconic π β¨
π¦ where this page comes from
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 43: llvm20 20.1.8-2.fc43 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- fedora 44: llvm20 20.1.8-2.fc44 Β· 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