Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-mc: add page #15356

Merged
merged 10 commits into from
Dec 31, 2024
25 changes: 25 additions & 0 deletions pages/common/llvm-mc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# llvm-mc

> LLVM Machine Code Playground. It provides a set of tools for working with LLVM machine code.
> Part of LLVM.
> More information: <https://llvm.org/docs/CommandGuide/llvm-mc.html>.

- Assemble assembly code file into object file with machine code:

`llvm-mc --filetype=obj -o {{path/to/output.o}} {{path/to/input.s}}`

- Disassemble object file with machine code into assembly code file:

`llvm-mc --disassemble -o {{path/to/output.s}} {{path/to/input.o}}`

- Compile LLVM bit code file into assembly code:

`llvm-mc -o {{path/to/output.s}} {{path/to/input.bc}}`

- Assemble assembly code from standard input stream and show encoding to standard output stream:

`echo "{{addl %eax, %ebx}}" | llvm-mc -show-encoding -show-inst`

- Disassemble machine code from standard input stream for specified triple:

`echo "{{0xCD 0x21}}" | llvm-mc --disassemble -triple={{target_name}}`
Loading