1LLVM-MC(1)                           LLVM                           LLVM-MC(1)
2
3
4

NAME

6       llvm-mc - LLVM Machine Code Playground
7

SYNOPSIS

9       llvm-mc [options] [filename]
10

DESCRIPTION

12       The llvm-mc command take input as the assembly code for a specified ar‐
13       chitecture and generate object file or executable as  a  output  for  a
14       specified architecture.
15
16       llvm-mc  provide  powerful set of the tool for working with the machine
17       code such as encoding of their instruction and their internal represen‐
18       tation, disassemble string to bytes etc.
19
20       The  choice  of  architecture for the output assembly code is automati‐
21       cally determined from the input file, unless the --arch option is  used
22       to override the default.
23

OPTIONS

25       If the -o option is omitted, then llvm-mc will send its output to stan‐
26       dard output if the input is from standard  input.   If  the  -o  option
27       specifies "-", then the output will also be sent to standard output.
28
29       If no -o option is specified and an input file other than "-" is speci‐
30       fied, then llvm-mc creates the output  filename  by  taking  the  input
31       filename, removing any existing .s extension, and adding a .o suffix.
32
33       Other llvm-mc options are described below.
34
35   End-user Options
36       --help Display available options (--help-hidden for more).
37
38       -o <filename>
39              Use <filename> as the output filename. See the summary above for
40              more details.
41
42       --arch=<string>
43              Target arch to assemble for, see -version for available targets.
44
45       --as-lex
46              Apply the assemblers "lexer" to break the input into tokens  and
47              print  each  of  them out.  This is intended to help develop and
48              test an assembler implementation.
49
50       --assemble
51              Assemble assembly file (default), and print the result to assem‐
52              bly.  This is useful to design and test instruction parsers, and
53              can be a useful tool when combined  with  other  llvm-mc  flags.
54              For  example,  this  option  may be useful to transcode assembly
55              from different dialects, e.g. on Intel where you can  use  -out‐
56              put-asm-variant=1  to translate from AT&T to Intel assembly syn‐
57              tax.  It can also be combined with --show-encoding to understand
58              how instructions are encoded.
59
60       --disassemble
61              Parse  a series of hex bytes, and print the result out as assem‐
62              bly syntax.
63
64       --mdis Marked up disassembly of string of hex bytes.
65
66       --filetype=[asm,null,obj]
67              Sets the output filetype. Setting this flag to asm will make the
68              tool  output  text  assembly. Setting this flag to obj will make
69              the tool output an object file. Setting it  to  null  causes  no
70              output  to  be  created and can be used for timing purposes. The
71              default value is asm.
72
73       -g     Generate DWARF debugging info for assembly source files.
74
75       --large-code-model
76              Create CFI directives that assume the code might be more than  2
77              GB.
78
79       --main-file-name=<string>
80              Specify the name we should consider the input file.
81
82       --masm-hexfloats
83              Enable MASM-style hex float initializers (3F800000r).
84
85       -mattr=a1,+a2,-a3,...
86
87       Target specific attributes (-mattr=help for details).
88
89       --mcpu=<cpu-name>
90              Target a specific cpu type (-mcpu=help for details).
91
92       --triple=<string>
93              Target  triple  to assemble for, see -version for available tar‐
94              gets.
95
96       --split-dwarf-file=<filename>
97              DWO output filename.
98
99       --show-inst-operands
100              Show instructions operands as parsed.
101
102       --show-inst
103              Show internal instruction representation.
104
105       --show-encoding
106              Show instruction encodings.
107
108       --save-temp-labels
109              Don't discard temporary labels.
110
111       --relax-relocations
112              Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL.
113
114       --print-imm-hex
115              Prefer hex format for immediate values.
116
117       --preserve-comments
118              Preserve Comments in outputted assembly.
119
120       --output-asm-variant=<uint>
121              Syntax variant to use for output printing. For example,  on  x86
122              targets --output-asm-variant=0 prints in AT&T syntax, and --out‐
123              put-asm-variant=1 prints in Intel/MASM syntax.
124
125       --compress-debug-sections=[none|zlib|zstd]
126              Choose DWARF debug sections compression.
127

EXIT STATUS

129       If llvm-mc succeeds, it will exit with 0.  Otherwise, if an  error  oc‐
130       curs, it will exit with a non-zero value.
131

AUTHOR

133       Maintained by the LLVM Team (https://llvm.org/).
134
136       2003-2023, LLVM Project
137
138
139
140
14117                                2023-11-28                        LLVM-MC(1)
Impressum