Skip to content

Commit 7d56552

Browse files
authored
llvm-mc: add page (#15356)
1 parent c52053b commit 7d56552

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pages/common/llvm-mc.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# llvm-mc
2+
3+
> LLVM Machine Code Playground. It provides a set of tools for working with LLVM machine code.
4+
> Part of LLVM.
5+
> More information: <https://llvm.org/docs/CommandGuide/llvm-mc.html>.
6+
7+
- Assemble assembly code file into object file with machine code:
8+
9+
`llvm-mc --filetype=obj -o {{path/to/output.o}} {{path/to/input.s}}`
10+
11+
- Disassemble object file with machine code into assembly code file:
12+
13+
`llvm-mc --disassemble -o {{path/to/output.s}} {{path/to/input.o}}`
14+
15+
- Compile LLVM bit code file into assembly code:
16+
17+
`llvm-mc -o {{path/to/output.s}} {{path/to/input.bc}}`
18+
19+
- Assemble assembly code from standard input stream and show encoding to standard output stream:
20+
21+
`echo "{{addl %eax, %ebx}}" | llvm-mc -show-encoding -show-inst`
22+
23+
- Disassemble machine code from standard input stream for specified triple:
24+
25+
`echo "{{0xCD 0x21}}" | llvm-mc --disassemble -triple={{target_name}}`

0 commit comments

Comments
 (0)