LLVM-MC(1)
π LLVM-MC(1) β the LLVM Machine Code Playground π
okay so bestie, welcome to llvm-mc, literally the LLVM Machine Code Playground β the manual name is LLVM-MC(1) and it's from the LLVM crew, and it's about to become your new obsession β¨
πΈ NAME πΈ
llvm-mc β the LLVM Machine Code Playground, no cap π
π¦ SYNOPSIS π¦
llvm-mc [options] [filename]
β¨ DESCRIPTION β¨
So the llvm-mc command takes input as the assembly code for a specified architecture and generates an object file or executable as an output for a specified architecture. Slay. π
It also provides a powerful set of tools for working with the machine code β like encoding of their instruction and their internal representation, disassembling string to bytes, etc. It's giving Swiss Army knife but make it machine code, fr fr. π₯
The choice of architecture for the output assembly code is automatically determined from the input file, unless the --arch option is used to override the default. Main character energy, honestly. π
π OPTIONS π
If the -o option is omitted, then llvm-mc will send its output to standard output if the input is from standard input. And if the -o option specifies -, then the output will also be sent to standard output. iykyk π«Ά
If no -o option is specified and an input file other than - is specified, then llvm-mc creates the output filename by taking the input filename, removing any existing .s extension, and adding a .o suffix. Cute and efficient, we love to see it. πΈ
Other llvm-mc options are described below, bestie β buckle up:
π End-user Options π
--helpβ Display available options (--help-hiddenfor more). Your go-to when you're like "wait what does anything do" π-o <filename>β Use<filename>as the output filename. See the summary above for more details. Simple, iconic, done. π--arch=<string>β Target arch to assemble for, see-versionfor available targets. Pick your fighter π₯--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. It's literally the vibe check for your tokens. π--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. This option ate and left no crumbs. π₯--disassembleβ Parse a series of hex bytes, and print the result out as assembly syntax. Hex bytes to assembly? It's giving magic trick, ngl. β¨--mdisβ Marked up disassembly of string of hex bytes. A little extra flair on your disassembly, we love a glow-up. π--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. Choose your output era. π-gβ Generate DWARF debugging info for assembly source files. For when you need to know what's really going on, fr fr π΅οΈ--large-code-modelβ Create CFI directives that assume the code might be more than 2 GB. Big code, big energy, no cap. π--main-file-name=<string>β Specify the name we should consider the input file. Just naming things, nbd. π·οΈ--masm-hexfloatsβ Enable MASM-style hex float initializers (3F800000r). Hex floats but make it MASM, we stay cultured. π§-mattr=a1,+a2,-a3,...β Target specific attributes (-mattr=helpfor details). Turn features on and off like a light switch, periodt. π‘--mcpu=<cpu-name>β Target a specific cpu type (-mcpu=helpfor details). It's giving "I know exactly which CPU I want" energy. π--triple=<string>β Target triple to assemble for, see-versionfor available targets. The triple threat of assembly, literally. π―--split-dwarf-file=<filename>β DWO output filename. DWO is short and mysterious and we respect that. π¦--show-inst-operandsβ Show instructions operands as parsed. Peek behind the curtain, bestie. π--show-instβ Show internal instruction representation. The instruction's inner monologue, basically. π--show-encodingβ Show instruction encodings. See exactly how the instructions are encoded, no mystery, no gatekeeping. π--save-temp-labelsβ Don't discard temporary labels. Keep the temp labels, they might be main characters too. π--relax-relocationsβ EmitR_X86_64_GOTPCRELXinstead ofR_X86_64_GOTPCREL. Two relocations walk into a bar and one is way more relaxed. π--print-imm-hexβ Prefer hex format for immediate values. Hex girlies rise. π’--preserve-commentsβ Preserve Comments in outputted assembly. Your comments are safe with us, we would never. π«Ά--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. Pick your syntax flavor. πΆοΈ--compress-debug-sections=[none|zlib|zstd]β Choose DWARF debug sections compression. Zip it, zstd it, or leave it alone β your call, bestie. ποΈ
π 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 if you see 0, you ate. If you see non-zero, something is not giving what it's supposed to give. π
π«Ά AUTHOR π«Ά
Maintained by the LLVM Team (https://llvm.org/). They're the parents of this whole playground, we love them for it. π
β COPYRIGHT β
2003-2023, LLVM Project β iconic longevity, no cap. π
bestie if you're still here, you're literally a machine code scholar now. go assemble something iconic. π¦β¨
~~ with love from the LLVM Project, version 17, dated 2023-12-01 β mwah π ~~
π¦ where this page comes from
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- opensuse-leap 16.0: llvm17 17.0.6-160000.3.1 Β· Apache-2.0 WITH LLVM-exception AND NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms