brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.5 KiB · 8d6346f Raw
173 lines · plain
1llvm-mc - LLVM Machine Code Playground2======================================3 4.. program:: llvm-mc5 6SYNOPSIS7--------8 9:program:`llvm-mc` [*options*] [*filename*]10 11DESCRIPTION12-----------13 14The :program:`llvm-mc` command takes assembly code for a specified architecture15as input and generates an object file or executable.16 17:program:`llvm-mc` provides a set of tools for working with machine code,18such as encoding instructions and displaying internal representations,19disassembling strings to bytes, etc.20 21The choice of architecture for the output assembly code is automatically22determined from the input file, unless the :option:`--arch` option is used to23override the default.24 25OPTIONS26-------27 28If the :option:`-o` option is omitted, then :program:`llvm-mc` will send its29output to standard output if the input is from standard input.  If the30:option:`-o` option specifies "``-``", then the output will also be sent to31standard output.32 33If no :option:`-o` option is specified and an input file other than "``-``" is34specified, then :program:`llvm-mc` creates the output filename by taking the35input filename, removing any existing ``.s`` extension, and adding a ``.o``36suffix.37 38Other :program:`llvm-mc` options are described below.39 40End-user Options41~~~~~~~~~~~~~~~~42 43.. option:: --help44 45 Display available options (--help-hidden for more).46 47.. option:: -o <filename>48 49 Use ``<filename>`` as the output filename. See the summary above for more50 details.51 52.. option:: --arch=<string>53 54 Target arch to assemble for, see -version for available targets.55 56.. option:: --as-lex57 58 Apply the assemblers "lexer" to break the input into tokens and print each of59 them out. This is intended to help develop and test an assembler60 implementation.61 62.. option:: --assemble63 64 Assemble assembly file (default), and print the result to assembly. This is65 useful to design and test instruction parsers, and can be a useful tool when66 combined with other llvm-mc flags. For example, this option may be useful to67 transcode assembly from different dialects, e.g. on Intel where you can use68 -output-asm-variant=1 to translate from AT&T to Intel assembly syntax. It can69 also be combined with --show-encoding to understand how instructions are70 encoded.71 72.. option:: --disassemble73 74 Parse a series of hex bytes, and print the result out as assembly syntax.75 76.. option:: --mdis77 78 Marked up disassembly of string of hex bytes.79 80.. option:: --cdis81 82 Colored disassembly of string of hex bytes.83 84.. option:: --filetype=[asm,null,obj]85 86 Sets the output filetype. Setting this flag to `asm` will make the tool output87 text assembly. Setting this flag to `obj` will make the tool output an object88 file. Setting it to `null` causes no output to be created and can be used for89 timing purposes. The default value is `asm`.90 91.. option:: -g92 93 Generate DWARF debugging info for assembly source files.94 95.. option:: --hex96 97 Take raw hexadecimal bytes as input for disassembly. Whitespace is ignored.98 99.. option:: --large-code-model100 101 Create CFI directives that assume the code might be more than 2 GB.102 103.. option:: --main-file-name=<string>104 105 Specify the name we should consider the input file.106 107 108.. option:: --masm-hexfloats109 110 Enable MASM-style hex float initializers (3F800000r).111 112 113.. option:: -mattr=a1,+a2,-a3,...114 Target specific attributes (-mattr=help for details).115 116.. option:: --mcpu=<cpu-name>117 118 Target a specific cpu type (-mcpu=help for details).119 120.. option::   --triple=<string>121 122 Target triple to assemble for, see -version for available targets.123 124.. option::  --split-dwarf-file=<filename>125 126 DWO output filename.127 128.. option:: --show-inst-operands129 130 Show instructions operands as parsed.131 132.. option:: --show-inst133 134 Show internal instruction representation.135 136.. option::  --show-encoding137 138 Show instruction encodings.139 140.. option:: --save-temp-labels141 142 Don't discard temporary labels.143 144.. option::   --relax-relocations145 146 Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL.147 148.. option:: --print-imm-hex149 150 Prefer hex format for immediate values.151 152.. option::  --preserve-comments153 154 Preserve Comments in outputted assembly.155 156.. option:: --output-asm-variant=<uint>157 158 Syntax variant to use for output printing. For example, on x86 targets159 --output-asm-variant=0 prints in AT&T syntax, and --output-asm-variant=1160 prints in Intel/MASM syntax.161 162.. option:: --compress-debug-sections=[none|zlib|zstd]163 164 Choose DWARF debug sections compression.165 166 167EXIT STATUS168-----------169 170If :program:`llvm-mc` succeeds, it will exit with 0.  Otherwise, if an error171occurs, it will exit with a non-zero value.172 173