1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00

llvm-mc: add page (#15356)

This commit is contained in:
P2Tree 2024-12-31 12:52:59 +08:00 committed by GitHub
parent c52053bcd2
commit 7d565521bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

25
pages/common/llvm-mc.md Normal file
View file

@ -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}}`