0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 ===============
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 LLVM Extensions
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 ===============
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 .. contents::
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 :local:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 .. toctree::
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 :hidden:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 Introduction
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 ============
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 This document describes extensions to tools and formats LLVM seeks compatibility
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 with.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 General Assembly Syntax
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 ===========================
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 C99-style Hexadecimal Floating-point Constants
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 ----------------------------------------------
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
22
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 LLVM's assemblers allow floating-point constants to be written in C99's
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
24 hexadecimal format instead of decimal if desired.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
25
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 .. code-block:: gas
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
27
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 .section .data
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 .float 0x1c2.2ap3
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 Machine-specific Assembly Syntax
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 ================================
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 X86/COFF-Dependent
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 ------------------
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
36
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 Relocations
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 ^^^^^^^^^^^
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39
|
77
|
40 The following additional relocation types are supported:
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
41
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
42 **@IMGREL** (AT&T syntax only) generates an image-relative relocation that
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
43 corresponds to the COFF relocation types ``IMAGE_REL_I386_DIR32NB`` (32-bit) or
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
44 ``IMAGE_REL_AMD64_ADDR32NB`` (64-bit).
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
45
|
120
|
46 .. code-block:: text
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
47
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
48 .text
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
49 fun:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
50 mov foo@IMGREL(%ebx, %ecx, 4), %eax
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
51
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
52 .section .pdata
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
53 .long fun@IMGREL
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
54 .long (fun@imgrel + 0x3F)
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
55 .long $unwind$fun@imgrel
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
56
|
77
|
57 **.secrel32** generates a relocation that corresponds to the COFF relocation
|
|
58 types ``IMAGE_REL_I386_SECREL`` (32-bit) or ``IMAGE_REL_AMD64_SECREL`` (64-bit).
|
|
59
|
|
60 **.secidx** relocation generates an index of the section that contains
|
|
61 the target. It corresponds to the COFF relocation types
|
|
62 ``IMAGE_REL_I386_SECTION`` (32-bit) or ``IMAGE_REL_AMD64_SECTION`` (64-bit).
|
|
63
|
121
|
64 .. code-block:: none
|
77
|
65
|
|
66 .section .debug$S,"rn"
|
|
67 .long 4
|
|
68 .long 242
|
|
69 .long 40
|
121
|
70 .secrel32 _function_name + 0
|
77
|
71 .secidx _function_name
|
|
72 ...
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
73
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
74 ``.linkonce`` Directive
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
75 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
76
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
77 Syntax:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
78
|
77
|
79 ``.linkonce [ comdat type ]``
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
80
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
81 Supported COMDAT types:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
82
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
83 ``discard``
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
84 Discards duplicate sections with the same COMDAT symbol. This is the default
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
85 if no type is specified.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
86
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
87 ``one_only``
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 If the symbol is defined multiple times, the linker issues an error.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 ``same_size``
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 Duplicates are discarded, but the linker issues an error if any have
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 different sizes.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 ``same_contents``
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 Duplicates are discarded, but the linker issues an error if any duplicates
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 do not have exactly the same content.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
98 ``largest``
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
99 Links the largest section from among the duplicates.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 ``newest``
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 Links the newest section from among the duplicates.
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
104
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
105 .. code-block:: gas
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
106
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 .section .text$foo
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 .linkonce
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 ...
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 ``.section`` Directive
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 MC supports passing the information in ``.linkonce`` at the end of
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 ``.section``. For example, these two codes are equivalent
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 .. code-block:: gas
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 .section secName, "dr", discard, "Symbol1"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 .globl Symbol1
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
121 Symbol1:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
122 .long 1
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124 .. code-block:: gas
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
125
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
126 .section secName, "dr"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
127 .linkonce discard
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
128 .globl Symbol1
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
129 Symbol1:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
130 .long 1
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
131
|
77
|
132 Note that in the combined form the COMDAT symbol is explicit. This
|
|
133 extension exists to support multiple sections with the same name in
|
|
134 different COMDATs:
|
0
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
135
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
136
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
137 .. code-block:: gas
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
138
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
139 .section secName, "dr", discard, "Symbol1"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
140 .globl Symbol1
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
141 Symbol1:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
142 .long 1
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
143
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
144 .section secName, "dr", discard, "Symbol2"
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
145 .globl Symbol2
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
146 Symbol2:
|
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
147 .long 1
|
77
|
148
|
|
149 In addition to the types allowed with ``.linkonce``, ``.section`` also accepts
|
|
150 ``associative``. The meaning is that the section is linked if a certain other
|
|
151 COMDAT section is linked. This other section is indicated by the comdat symbol
|
|
152 in this directive. It can be any symbol defined in the associated section, but
|
|
153 is usually the associated section's comdat.
|
|
154
|
|
155 The following restrictions apply to the associated section:
|
|
156
|
|
157 1. It must be a COMDAT section.
|
|
158 2. It cannot be another associative COMDAT section.
|
|
159
|
|
160 In the following example the symobl ``sym`` is the comdat symbol of ``.foo``
|
|
161 and ``.bar`` is associated to ``.foo``.
|
|
162
|
|
163 .. code-block:: gas
|
|
164
|
|
165 .section .foo,"bw",discard, "sym"
|
|
166 .section .bar,"rd",associative, "sym"
|
|
167
|
120
|
168 MC supports these flags in the COFF ``.section`` directive:
|
|
169
|
|
170 - ``b``: BSS section (``IMAGE_SCN_CNT_INITIALIZED_DATA``)
|
|
171 - ``d``: Data section (``IMAGE_SCN_CNT_UNINITIALIZED_DATA``)
|
|
172 - ``n``: Section is not loaded (``IMAGE_SCN_LNK_REMOVE``)
|
|
173 - ``r``: Read-only
|
|
174 - ``s``: Shared section
|
|
175 - ``w``: Writable
|
|
176 - ``x``: Executable section
|
|
177 - ``y``: Not readable
|
|
178 - ``D``: Discardable (``IMAGE_SCN_MEM_DISCARDABLE``)
|
|
179
|
|
180 These flags are all compatible with gas, with the exception of the ``D`` flag,
|
|
181 which gnu as does not support. For gas compatibility, sections with a name
|
|
182 starting with ".debug" are implicitly discardable.
|
|
183
|
95
|
184
|
|
185 ELF-Dependent
|
|
186 -------------
|
|
187
|
|
188 ``.section`` Directive
|
|
189 ^^^^^^^^^^^^^^^^^^^^^^
|
|
190
|
|
191 In order to support creating multiple sections with the same name and comdat,
|
|
192 it is possible to add an unique number at the end of the ``.seciton`` directive.
|
|
193 For example, the following code creates two sections named ``.text``.
|
|
194
|
|
195 .. code-block:: gas
|
|
196
|
|
197 .section .text,"ax",@progbits,unique,1
|
|
198 nop
|
|
199
|
|
200 .section .text,"ax",@progbits,unique,2
|
|
201 nop
|
|
202
|
|
203
|
|
204 The unique number is not present in the resulting object at all. It is just used
|
|
205 in the assembler to differentiate the sections.
|
|
206
|
121
|
207 The 'o' flag is mapped to SHF_LINK_ORDER. If it is present, a symbol
|
|
208 must be given that identifies the section to be placed is the
|
|
209 .sh_link.
|
|
210
|
|
211 .. code-block:: gas
|
|
212
|
|
213 .section .foo,"a",@progbits
|
|
214 .Ltmp:
|
|
215 .section .bar,"ao",@progbits,.Ltmp
|
|
216
|
|
217 which is equivalent to just
|
|
218
|
|
219 .. code-block:: gas
|
|
220
|
|
221 .section .foo,"a",@progbits
|
|
222 .section .bar,"ao",@progbits,.foo
|
|
223
|
134
|
224 ``.linker-options`` Section (linker options)
|
|
225 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
226
|
|
227 In order to support passing linker options from the frontend to the linker, a
|
|
228 special section of type ``SHT_LLVM_LINKER_OPTIONS`` (usually named
|
|
229 ``.linker-options`` though the name is not significant as it is identified by
|
|
230 the type). The contents of this section is a simple pair-wise encoding of
|
|
231 directives for consideration by the linker. The strings are encoded as standard
|
|
232 null-terminated UTF-8 strings. They are emitted inline to avoid having the
|
|
233 linker traverse the object file for retrieving the value. The linker is
|
|
234 permitted to not honour the option and instead provide a warning/error to the
|
|
235 user that the requested option was not honoured.
|
|
236
|
|
237 The section has type ``SHT_LLVM_LINKER_OPTIONS`` and has the ``SHF_EXCLUDE``
|
|
238 flag to ensure that the section is treated as opaque by linkers which do not
|
|
239 support the feature and will not be emitted into the final linked binary.
|
|
240
|
|
241 This would be equivalent to the follow raw assembly:
|
|
242
|
|
243 .. code-block:: gas
|
|
244
|
|
245 .section ".linker-options","e",@llvm_linker_options
|
|
246 .asciz "option 1"
|
|
247 .asciz "value 1"
|
|
248 .asciz "option 2"
|
|
249 .asciz "value 2"
|
|
250
|
|
251 The following directives are specified:
|
|
252
|
|
253 - lib
|
|
254
|
|
255 The parameter identifies a library to be linked against. The library will
|
|
256 be looked up in the default and any specified library search paths
|
|
257 (specified to this point).
|
|
258
|
|
259 - libpath
|
|
260
|
|
261 The paramter identifies an additional library search path to be considered
|
|
262 when looking up libraries after the inclusion of this option.
|
121
|
263
|
77
|
264 Target Specific Behaviour
|
|
265 =========================
|
|
266
|
121
|
267 X86
|
|
268 ---
|
|
269
|
|
270 Relocations
|
|
271 ^^^^^^^^^^^
|
|
272
|
|
273 ``@ABS8`` can be applied to symbols which appear as immediate operands to
|
|
274 instructions that have an 8-bit immediate form for that operand. It causes
|
|
275 the assembler to use the 8-bit form and an 8-bit relocation (e.g. ``R_386_8``
|
|
276 or ``R_X86_64_8``) for the symbol.
|
|
277
|
|
278 For example:
|
|
279
|
|
280 .. code-block:: gas
|
|
281
|
|
282 cmpq $foo@ABS8, %rdi
|
|
283
|
|
284 This causes the assembler to select the form of the 64-bit ``cmpq`` instruction
|
|
285 that takes an 8-bit immediate operand that is sign extended to 64 bits, as
|
|
286 opposed to ``cmpq $foo, %rdi`` which takes a 32-bit immediate operand. This
|
|
287 is also not the same as ``cmpb $foo, %dil``, which is an 8-bit comparison.
|
|
288
|
77
|
289 Windows on ARM
|
|
290 --------------
|
|
291
|
|
292 Stack Probe Emission
|
|
293 ^^^^^^^^^^^^^^^^^^^^
|
|
294
|
|
295 The reference implementation (Microsoft Visual Studio 2012) emits stack probes
|
|
296 in the following fashion:
|
|
297
|
|
298 .. code-block:: gas
|
|
299
|
|
300 movw r4, #constant
|
|
301 bl __chkstk
|
|
302 sub.w sp, sp, r4
|
|
303
|
|
304 However, this has the limitation of 32 MiB (±16MiB). In order to accommodate
|
|
305 larger binaries, LLVM supports the use of ``-mcode-model=large`` to allow a 4GiB
|
|
306 range via a slight deviation. It will generate an indirect jump as follows:
|
|
307
|
|
308 .. code-block:: gas
|
|
309
|
|
310 movw r4, #constant
|
|
311 movw r12, :lower16:__chkstk
|
|
312 movt r12, :upper16:__chkstk
|
|
313 blx r12
|
|
314 sub.w sp, sp, r4
|
|
315
|
|
316 Variable Length Arrays
|
|
317 ^^^^^^^^^^^^^^^^^^^^^^
|
|
318
|
|
319 The reference implementation (Microsoft Visual Studio 2012) does not permit the
|
|
320 emission of Variable Length Arrays (VLAs).
|
|
321
|
|
322 The Windows ARM Itanium ABI extends the base ABI by adding support for emitting
|
|
323 a dynamic stack allocation. When emitting a variable stack allocation, a call
|
|
324 to ``__chkstk`` is emitted unconditionally to ensure that guard pages are setup
|
|
325 properly. The emission of this stack probe emission is handled similar to the
|
|
326 standard stack probe emission.
|
|
327
|
|
328 The MSVC environment does not emit code for VLAs currently.
|
|
329
|
134
|
330 Windows on ARM64
|
|
331 ----------------
|
|
332
|
|
333 Stack Probe Emission
|
|
334 ^^^^^^^^^^^^^^^^^^^^
|
|
335
|
|
336 The reference implementation (Microsoft Visual Studio 2017) emits stack probes
|
|
337 in the following fashion:
|
|
338
|
|
339 .. code-block:: gas
|
|
340
|
|
341 mov x15, #constant
|
|
342 bl __chkstk
|
|
343 sub sp, sp, x15, lsl #4
|
|
344
|
|
345 However, this has the limitation of 256 MiB (±128MiB). In order to accommodate
|
|
346 larger binaries, LLVM supports the use of ``-mcode-model=large`` to allow a 8GiB
|
|
347 (±4GiB) range via a slight deviation. It will generate an indirect jump as
|
|
348 follows:
|
|
349
|
|
350 .. code-block:: gas
|
|
351
|
|
352 mov x15, #constant
|
|
353 adrp x16, __chkstk
|
|
354 add x16, x16, :lo12:__chkstk
|
|
355 blr x16
|
|
356 sub sp, sp, x15, lsl #4
|
|
357
|