File: Extensions.html

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb10u4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,418,792 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (720 lines) | stat: -rw-r--r-- 55,342 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720


<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>LLVM Extensions &#8212; LLVM 13 documentation</title>
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="FaultMaps and implicit checks" href="FaultMaps.html" />
    <link rel="prev" title="Exception Handling in LLVM" href="ExceptionHandling.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head><body>
<div class="logo">
  <a href="index.html">
    <img src="_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="FaultMaps.html" title="FaultMaps and implicit checks"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ExceptionHandling.html" title="Exception Handling in LLVM"
             accesskey="P">previous</a> |</li>
  <li><a href="https://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>

          <li class="nav-item nav-item-1"><a href="Reference.html" accesskey="U">Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">LLVM Extensions</a></li> 
      </ul>
    </div>

      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">

<h3>Documentation</h3>

<ul class="want-points">
    <li><a href="https://llvm.org/docs/GettingStartedTutorials.html">Getting Started/Tutorials</a></li>
    <li><a href="https://llvm.org/docs/UserGuides.html">User Guides</a></li>
    <li><a href="https://llvm.org/docs/Reference.html">Reference</a></li>
</ul>

<h3>Getting Involved</h3>

<ul class="want-points">
    <li><a href="https://llvm.org/docs/Contributing.html">Contributing to LLVM</a></li>
    <li><a href="https://llvm.org/docs/HowToSubmitABug.html">Submitting Bug Reports</a></li>
    <li><a href="https://llvm.org/docs/GettingInvolved.html#mailing-lists">Mailing Lists</a></li>
    <li><a href="https://llvm.org/docs/GettingInvolved.html#irc">IRC</a></li>
    <li><a href="https://llvm.org/docs/GettingInvolved.html#meetups-and-social-events">Meetups and Social Events</a></li>
</ul>

<h3>Additional Links</h3>

<ul class="want-points">
    <li><a href="https://llvm.org/docs/FAQ.html">FAQ</a></li>
    <li><a href="https://llvm.org/docs/Lexicon.html">Glossary</a></li>
    <li><a href="https://llvm.org/pubs">Publications</a></li>
    <li><a href="https://github.com/llvm/llvm-project//">Github Repository</a></li>
</ul>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/Extensions.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="llvm-extensions">
<h1>LLVM Extensions<a class="headerlink" href="#llvm-extensions" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#introduction" id="id5">Introduction</a></p></li>
<li><p><a class="reference internal" href="#general-assembly-syntax" id="id6">General Assembly Syntax</a></p>
<ul>
<li><p><a class="reference internal" href="#c99-style-hexadecimal-floating-point-constants" id="id7">C99-style Hexadecimal Floating-point Constants</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#machine-specific-assembly-syntax" id="id8">Machine-specific Assembly Syntax</a></p>
<ul>
<li><p><a class="reference internal" href="#x86-coff-dependent" id="id9">X86/COFF-Dependent</a></p>
<ul>
<li><p><a class="reference internal" href="#relocations" id="id10">Relocations</a></p></li>
<li><p><a class="reference internal" href="#linkonce-directive" id="id11"><code class="docutils literal notranslate"><span class="pre">.linkonce</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#section-directive" id="id12"><code class="docutils literal notranslate"><span class="pre">.section</span></code> Directive</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#arm64-coff-dependent" id="id13">ARM64/COFF-Dependent</a></p>
<ul>
<li><p><a class="reference internal" href="#id1" id="id14">Relocations</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#elf-dependent" id="id15">ELF-Dependent</a></p>
<ul>
<li><p><a class="reference internal" href="#id2" id="id16"><code class="docutils literal notranslate"><span class="pre">.section</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#linker-options-section-linker-options" id="id17"><code class="docutils literal notranslate"><span class="pre">.linker-options</span></code> Section (linker options)</a></p></li>
<li><p><a class="reference internal" href="#sht-llvm-dependent-libraries-section-dependent-libraries" id="id18"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_DEPENDENT_LIBRARIES</span></code> Section (Dependent Libraries)</a></p></li>
<li><p><a class="reference internal" href="#sht-llvm-call-graph-profile-section-call-graph-profile" id="id19"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_CALL_GRAPH_PROFILE</span></code> Section (Call Graph Profile)</a></p></li>
<li><p><a class="reference internal" href="#sht-llvm-addrsig-section-address-significance-table" id="id20"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_ADDRSIG</span></code> Section (address-significance table)</a></p></li>
<li><p><a class="reference internal" href="#sht-llvm-sympart-section-symbol-partition-specification" id="id21"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_SYMPART</span></code> Section (symbol partition specification)</a></p></li>
<li><p><a class="reference internal" href="#sht-llvm-bb-addr-map-section-basic-block-address-map" id="id22"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_BB_ADDR_MAP</span></code> Section (basic block address map)</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#codeview-dependent" id="id23">CodeView-Dependent</a></p>
<ul>
<li><p><a class="reference internal" href="#cv-file-directive" id="id24"><code class="docutils literal notranslate"><span class="pre">.cv_file</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-func-id-directive" id="id25"><code class="docutils literal notranslate"><span class="pre">.cv_func_id</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-inline-site-id-directive" id="id26"><code class="docutils literal notranslate"><span class="pre">.cv_inline_site_id</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-loc-directive" id="id27"><code class="docutils literal notranslate"><span class="pre">.cv_loc</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-linetable-directive" id="id28"><code class="docutils literal notranslate"><span class="pre">.cv_linetable</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-inline-linetable-directive" id="id29"><code class="docutils literal notranslate"><span class="pre">.cv_inline_linetable</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-def-range-directive" id="id30"><code class="docutils literal notranslate"><span class="pre">.cv_def_range</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-stringtable-directive" id="id31"><code class="docutils literal notranslate"><span class="pre">.cv_stringtable</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-filechecksums-directive" id="id32"><code class="docutils literal notranslate"><span class="pre">.cv_filechecksums</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-filechecksumoffset-directive" id="id33"><code class="docutils literal notranslate"><span class="pre">.cv_filechecksumoffset</span></code> Directive</a></p></li>
<li><p><a class="reference internal" href="#cv-fpo-data-directive" id="id34"><code class="docutils literal notranslate"><span class="pre">.cv_fpo_data</span></code> Directive</a></p></li>
</ul>
</li>
</ul>
</li>
<li><p><a class="reference internal" href="#target-specific-behaviour" id="id35">Target Specific Behaviour</a></p>
<ul>
<li><p><a class="reference internal" href="#x86" id="id36">X86</a></p>
<ul>
<li><p><a class="reference internal" href="#id3" id="id37">Relocations</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#windows-on-arm" id="id38">Windows on ARM</a></p>
<ul>
<li><p><a class="reference internal" href="#stack-probe-emission" id="id39">Stack Probe Emission</a></p></li>
<li><p><a class="reference internal" href="#variable-length-arrays" id="id40">Variable Length Arrays</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#windows-on-arm64" id="id41">Windows on ARM64</a></p>
<ul>
<li><p><a class="reference internal" href="#id4" id="id42">Stack Probe Emission</a></p></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="toctree-wrapper compound">
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id5">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>This document describes extensions to tools and formats LLVM seeks compatibility
with.</p>
</div>
<div class="section" id="general-assembly-syntax">
<h2><a class="toc-backref" href="#id6">General Assembly Syntax</a><a class="headerlink" href="#general-assembly-syntax" title="Permalink to this headline">¶</a></h2>
<div class="section" id="c99-style-hexadecimal-floating-point-constants">
<h3><a class="toc-backref" href="#id7">C99-style Hexadecimal Floating-point Constants</a><a class="headerlink" href="#c99-style-hexadecimal-floating-point-constants" title="Permalink to this headline">¶</a></h3>
<p>LLVM’s assemblers allow floating-point constants to be written in C99’s
hexadecimal format instead of decimal if desired.</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">.data</span>
<span class="na">.float</span> <span class="mi">0x1c2</span><span class="no">.2ap3</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="machine-specific-assembly-syntax">
<h2><a class="toc-backref" href="#id8">Machine-specific Assembly Syntax</a><a class="headerlink" href="#machine-specific-assembly-syntax" title="Permalink to this headline">¶</a></h2>
<div class="section" id="x86-coff-dependent">
<h3><a class="toc-backref" href="#id9">X86/COFF-Dependent</a><a class="headerlink" href="#x86-coff-dependent" title="Permalink to this headline">¶</a></h3>
<div class="section" id="relocations">
<h4><a class="toc-backref" href="#id10">Relocations</a><a class="headerlink" href="#relocations" title="Permalink to this headline">¶</a></h4>
<p>The following additional relocation types are supported:</p>
<p><strong>&#64;IMGREL</strong> (AT&amp;T syntax only) generates an image-relative relocation that
corresponds to the COFF relocation types <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_I386_DIR32NB</span></code> (32-bit) or
<code class="docutils literal notranslate"><span class="pre">IMAGE_REL_AMD64_ADDR32NB</span></code> (64-bit).</p>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>.text
fun:
  mov foo@IMGREL(%ebx, %ecx, 4), %eax

.section .pdata
  .long fun@IMGREL
  .long (fun@imgrel + 0x3F)
  .long $unwind$fun@imgrel
</pre></div>
</div>
<p><strong>.secrel32</strong> generates a relocation that corresponds to the COFF relocation
types <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_I386_SECREL</span></code> (32-bit) or <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_AMD64_SECREL</span></code> (64-bit).</p>
<p><strong>.secidx</strong> relocation generates an index of the section that contains
the target.  It corresponds to the COFF relocation types
<code class="docutils literal notranslate"><span class="pre">IMAGE_REL_I386_SECTION</span></code> (32-bit) or <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_AMD64_SECTION</span></code> (64-bit).</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>.section .debug$S,&quot;rn&quot;
  .long 4
  .long 242
  .long 40
  .secrel32 _function_name + 0
  .secidx   _function_name
  ...
</pre></div>
</div>
</div>
<div class="section" id="linkonce-directive">
<h4><a class="toc-backref" href="#id11"><code class="docutils literal notranslate"><span class="pre">.linkonce</span></code> Directive</a><a class="headerlink" href="#linkonce-directive" title="Permalink to this headline">¶</a></h4>
<p>Syntax:</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">.linkonce</span> <span class="pre">[</span> <span class="pre">comdat</span> <span class="pre">type</span> <span class="pre">]</span></code></p>
</div></blockquote>
<p>Supported COMDAT types:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">discard</span></code></dt><dd><p>Discards duplicate sections with the same COMDAT symbol. This is the default
if no type is specified.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">one_only</span></code></dt><dd><p>If the symbol is defined multiple times, the linker issues an error.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">same_size</span></code></dt><dd><p>Duplicates are discarded, but the linker issues an error if any have
different sizes.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">same_contents</span></code></dt><dd><p>Duplicates are discarded, but the linker issues an error if any duplicates
do not have exactly the same content.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">largest</span></code></dt><dd><p>Links the largest section from among the duplicates.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">newest</span></code></dt><dd><p>Links the newest section from among the duplicates.</p>
</dd>
</dl>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">.text$foo</span>
<span class="na">.linkonce</span>
  <span class="na">...</span>
</pre></div>
</div>
</div>
<div class="section" id="section-directive">
<h4><a class="toc-backref" href="#id12"><code class="docutils literal notranslate"><span class="pre">.section</span></code> Directive</a><a class="headerlink" href="#section-directive" title="Permalink to this headline">¶</a></h4>
<p>MC supports passing the information in <code class="docutils literal notranslate"><span class="pre">.linkonce</span></code> at the end of
<code class="docutils literal notranslate"><span class="pre">.section</span></code>. For example,  these two codes are equivalent</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">&quot;dr&quot;</span><span class="p">,</span> <span class="no">discard</span><span class="p">,</span> <span class="s">&quot;Symbol1&quot;</span>
<span class="na">.globl</span> <span class="no">Symbol1</span>
<span class="nl">Symbol1:</span>
<span class="na">.long</span> <span class="mi">1</span>
</pre></div>
</div>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">&quot;dr&quot;</span>
<span class="na">.linkonce</span> <span class="no">discard</span>
<span class="na">.globl</span> <span class="no">Symbol1</span>
<span class="nl">Symbol1:</span>
<span class="na">.long</span> <span class="mi">1</span>
</pre></div>
</div>
<p>Note that in the combined form the COMDAT symbol is explicit. This
extension exists to support multiple sections with the same name in
different COMDATs:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">&quot;dr&quot;</span><span class="p">,</span> <span class="no">discard</span><span class="p">,</span> <span class="s">&quot;Symbol1&quot;</span>
<span class="na">.globl</span> <span class="no">Symbol1</span>
<span class="nl">Symbol1:</span>
<span class="na">.long</span> <span class="mi">1</span>

<span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">&quot;dr&quot;</span><span class="p">,</span> <span class="no">discard</span><span class="p">,</span> <span class="s">&quot;Symbol2&quot;</span>
<span class="na">.globl</span> <span class="no">Symbol2</span>
<span class="nl">Symbol2:</span>
<span class="na">.long</span> <span class="mi">1</span>
</pre></div>
</div>
<p>In addition to the types allowed with <code class="docutils literal notranslate"><span class="pre">.linkonce</span></code>, <code class="docutils literal notranslate"><span class="pre">.section</span></code> also accepts
<code class="docutils literal notranslate"><span class="pre">associative</span></code>. The meaning is that the section is linked  if a certain other
COMDAT section is linked. This other section is indicated by the comdat symbol
in this directive. It can be any symbol defined in the associated section, but
is usually the associated section’s comdat.</p>
<blockquote>
<div><p>The following restrictions apply to the associated section:</p>
<ol class="arabic simple">
<li><p>It must be a COMDAT section.</p></li>
<li><p>It cannot be another associative COMDAT section.</p></li>
</ol>
</div></blockquote>
<p>In the following example the symbol <code class="docutils literal notranslate"><span class="pre">sym</span></code> is the comdat symbol of <code class="docutils literal notranslate"><span class="pre">.foo</span></code>
and <code class="docutils literal notranslate"><span class="pre">.bar</span></code> is associated to <code class="docutils literal notranslate"><span class="pre">.foo</span></code>.</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span>        <span class="no">.foo</span><span class="p">,</span><span class="s">&quot;bw&quot;</span><span class="p">,</span><span class="no">discard</span><span class="p">,</span> <span class="s">&quot;sym&quot;</span>
<span class="na">.section</span>        <span class="no">.bar</span><span class="p">,</span><span class="s">&quot;rd&quot;</span><span class="p">,</span><span class="no">associative</span><span class="p">,</span> <span class="s">&quot;sym&quot;</span>
</pre></div>
</div>
<p>MC supports these flags in the COFF <code class="docutils literal notranslate"><span class="pre">.section</span></code> directive:</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">b</span></code>: BSS section (<code class="docutils literal notranslate"><span class="pre">IMAGE_SCN_CNT_INITIALIZED_DATA</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">d</span></code>: Data section (<code class="docutils literal notranslate"><span class="pre">IMAGE_SCN_CNT_UNINITIALIZED_DATA</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">n</span></code>: Section is not loaded (<code class="docutils literal notranslate"><span class="pre">IMAGE_SCN_LNK_REMOVE</span></code>)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">r</span></code>: Read-only</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">s</span></code>: Shared section</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">w</span></code>: Writable</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">x</span></code>: Executable section</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">y</span></code>: Not readable</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">D</span></code>: Discardable (<code class="docutils literal notranslate"><span class="pre">IMAGE_SCN_MEM_DISCARDABLE</span></code>)</p></li>
</ul>
</div></blockquote>
<p>These flags are all compatible with gas, with the exception of the <code class="docutils literal notranslate"><span class="pre">D</span></code> flag,
which gnu as does not support. For gas compatibility, sections with a name
starting with “.debug” are implicitly discardable.</p>
</div>
</div>
<div class="section" id="arm64-coff-dependent">
<h3><a class="toc-backref" href="#id13">ARM64/COFF-Dependent</a><a class="headerlink" href="#arm64-coff-dependent" title="Permalink to this headline">¶</a></h3>
<div class="section" id="id1">
<h4><a class="toc-backref" href="#id14">Relocations</a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h4>
<p>The following additional symbol variants are supported:</p>
<p><strong>:secrel_lo12:</strong> generates a relocation that corresponds to the COFF relocation
types <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_ARM64_SECREL_LOW12A</span></code> or <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_ARM64_SECREL_LOW12L</span></code>.</p>
<p><strong>:secrel_hi12:</strong> generates a relocation that corresponds to the COFF relocation
type <code class="docutils literal notranslate"><span class="pre">IMAGE_REL_ARM64_SECREL_HIGH12A</span></code>.</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="nf">add</span> <span class="no">x0</span><span class="p">,</span> <span class="no">x0</span><span class="p">,</span> <span class="p">:</span><span class="no">secrel_hi12</span><span class="p">:</span><span class="no">symbol</span>
<span class="nf">ldr</span> <span class="no">x0</span><span class="p">,</span> <span class="p">[</span><span class="no">x0</span><span class="p">,</span> <span class="p">:</span><span class="no">secrel_lo12</span><span class="p">:</span><span class="no">symbol</span><span class="p">]</span>

<span class="nf">add</span> <span class="no">x1</span><span class="p">,</span> <span class="no">x1</span><span class="p">,</span> <span class="p">:</span><span class="no">secrel_hi12</span><span class="p">:</span><span class="no">symbol</span>
<span class="nf">add</span> <span class="no">x1</span><span class="p">,</span> <span class="no">x1</span><span class="p">,</span> <span class="p">:</span><span class="no">secrel_lo12</span><span class="p">:</span><span class="no">symbol</span>
<span class="na">...</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="elf-dependent">
<h3><a class="toc-backref" href="#id15">ELF-Dependent</a><a class="headerlink" href="#elf-dependent" title="Permalink to this headline">¶</a></h3>
<div class="section" id="id2">
<h4><a class="toc-backref" href="#id16"><code class="docutils literal notranslate"><span class="pre">.section</span></code> Directive</a><a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h4>
<p>In order to support creating multiple sections with the same name and comdat,
it is possible to add an unique number at the end of the <code class="docutils literal notranslate"><span class="pre">.section</span></code> directive.
For example, the following code creates two sections named <code class="docutils literal notranslate"><span class="pre">.text</span></code>.</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span>        <span class="no">.text</span><span class="p">,</span><span class="s">&quot;ax&quot;</span><span class="p">,</span><span class="na">@progbits</span><span class="p">,</span><span class="no">unique</span><span class="p">,</span><span class="mi">1</span>
<span class="nf">nop</span>

<span class="na">.section</span>        <span class="no">.text</span><span class="p">,</span><span class="s">&quot;ax&quot;</span><span class="p">,</span><span class="na">@progbits</span><span class="p">,</span><span class="no">unique</span><span class="p">,</span><span class="mi">2</span>
<span class="nf">nop</span>
</pre></div>
</div>
<p>The unique number is not present in the resulting object at all. It is just used
in the assembler to differentiate the sections.</p>
<p>The ‘o’ flag is mapped to SHF_LINK_ORDER. If it is present, a symbol
must be given that identifies the section to be placed is the
.sh_link.</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">.foo</span><span class="p">,</span><span class="s">&quot;a&quot;</span><span class="p">,</span><span class="na">@progbits</span>
<span class="nl">.Ltmp:</span>
<span class="na">.section</span> <span class="no">.bar</span><span class="p">,</span><span class="s">&quot;ao&quot;</span><span class="p">,</span><span class="na">@progbits</span><span class="p">,.</span><span class="no">Ltmp</span>
</pre></div>
</div>
<p>which is equivalent to just</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="no">.foo</span><span class="p">,</span><span class="s">&quot;a&quot;</span><span class="p">,</span><span class="na">@progbits</span>
<span class="na">.section</span> <span class="no">.bar</span><span class="p">,</span><span class="s">&quot;ao&quot;</span><span class="p">,</span><span class="na">@progbits</span><span class="p">,.</span><span class="no">foo</span>
</pre></div>
</div>
</div>
<div class="section" id="linker-options-section-linker-options">
<h4><a class="toc-backref" href="#id17"><code class="docutils literal notranslate"><span class="pre">.linker-options</span></code> Section (linker options)</a><a class="headerlink" href="#linker-options-section-linker-options" title="Permalink to this headline">¶</a></h4>
<p>In order to support passing linker options from the frontend to the linker, a
special section of type <code class="docutils literal notranslate"><span class="pre">SHT_LLVM_LINKER_OPTIONS</span></code> (usually named
<code class="docutils literal notranslate"><span class="pre">.linker-options</span></code> though the name is not significant as it is identified by
the type).  The contents of this section is a simple pair-wise encoding of
directives for consideration by the linker.  The strings are encoded as standard
null-terminated UTF-8 strings.  They are emitted inline to avoid having the
linker traverse the object file for retrieving the value.  The linker is
permitted to not honour the option and instead provide a warning/error to the
user that the requested option was not honoured.</p>
<p>The section has type <code class="docutils literal notranslate"><span class="pre">SHT_LLVM_LINKER_OPTIONS</span></code> and has the <code class="docutils literal notranslate"><span class="pre">SHF_EXCLUDE</span></code>
flag to ensure that the section is treated as opaque by linkers which do not
support the feature and will not be emitted into the final linked binary.</p>
<p>This would be equivalent to the follow raw assembly:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="s">&quot;.linker-options&quot;</span><span class="p">,</span><span class="s">&quot;e&quot;</span><span class="p">,</span><span class="na">@llvm_linker_options</span>
<span class="na">.asciz</span> <span class="s">&quot;option 1&quot;</span>
<span class="na">.asciz</span> <span class="s">&quot;value 1&quot;</span>
<span class="na">.asciz</span> <span class="s">&quot;option 2&quot;</span>
<span class="na">.asciz</span> <span class="s">&quot;value 2&quot;</span>
</pre></div>
</div>
<p>The following directives are specified:</p>
<blockquote>
<div><ul>
<li><p>lib</p>
<p>The parameter identifies a library to be linked against.  The library will
be looked up in the default and any specified library search paths
(specified to this point).</p>
</li>
<li><p>libpath</p>
<p>The parameter identifies an additional library search path to be considered
when looking up libraries after the inclusion of this option.</p>
</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="sht-llvm-dependent-libraries-section-dependent-libraries">
<h4><a class="toc-backref" href="#id18"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_DEPENDENT_LIBRARIES</span></code> Section (Dependent Libraries)</a><a class="headerlink" href="#sht-llvm-dependent-libraries-section-dependent-libraries" title="Permalink to this headline">¶</a></h4>
<p>This section contains strings specifying libraries to be added to the link by
the linker.</p>
<p>The section should be consumed by the linker and not written to the output.</p>
<p>The strings are encoded as standard null-terminated UTF-8 strings.</p>
<p>For example:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="s">&quot;.deplibs&quot;</span><span class="p">,</span><span class="s">&quot;MS&quot;</span><span class="p">,</span><span class="na">@llvm_dependent_libraries</span><span class="p">,</span><span class="mi">1</span>
<span class="na">.asciz</span> <span class="s">&quot;library specifier 1&quot;</span>
<span class="na">.asciz</span> <span class="s">&quot;library specifier 2&quot;</span>
</pre></div>
</div>
<p>The interpretation of the library specifiers is defined by the consuming linker.</p>
</div>
<div class="section" id="sht-llvm-call-graph-profile-section-call-graph-profile">
<h4><a class="toc-backref" href="#id19"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_CALL_GRAPH_PROFILE</span></code> Section (Call Graph Profile)</a><a class="headerlink" href="#sht-llvm-call-graph-profile-section-call-graph-profile" title="Permalink to this headline">¶</a></h4>
<p>This section is used to pass a call graph profile to the linker which can be
used to optimize the placement of sections.  It contains a sequence of
(from symbol, to symbol, weight) tuples.</p>
<p>It shall have a type of <code class="docutils literal notranslate"><span class="pre">SHT_LLVM_CALL_GRAPH_PROFILE</span></code> (0x6fff4c02), shall
have the <code class="docutils literal notranslate"><span class="pre">SHF_EXCLUDE</span></code> flag set, the <code class="docutils literal notranslate"><span class="pre">sh_link</span></code> member shall hold the section
header index of the associated symbol table, and shall have a <code class="docutils literal notranslate"><span class="pre">sh_entsize</span></code> of
16.  It should be named <code class="docutils literal notranslate"><span class="pre">.llvm.call-graph-profile</span></code>.</p>
<p>The contents of the section shall be a sequence of <code class="docutils literal notranslate"><span class="pre">Elf_CGProfile</span></code> entries.</p>
<div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">typedef</span> <span class="k">struct</span> <span class="p">{</span>
  <span class="n">Elf_Word</span> <span class="n">cgp_from</span><span class="p">;</span>
  <span class="n">Elf_Word</span> <span class="n">cgp_to</span><span class="p">;</span>
  <span class="n">Elf_Xword</span> <span class="n">cgp_weight</span><span class="p">;</span>
<span class="p">}</span> <span class="n">Elf_CGProfile</span><span class="p">;</span>
</pre></div>
</div>
<dl class="simple">
<dt>cgp_from</dt><dd><p>The symbol index of the source of the edge.</p>
</dd>
<dt>cgp_to</dt><dd><p>The symbol index of the destination of the edge.</p>
</dd>
<dt>cgp_weight</dt><dd><p>The weight of the edge.</p>
</dd>
</dl>
<p>This is represented in assembly as:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.cg_profile</span> <span class="no">from</span><span class="p">,</span> <span class="no">to</span><span class="p">,</span> <span class="mi">42</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">.cg_profile</span></code> directives are processed at the end of the file.  It is an error
if either <code class="docutils literal notranslate"><span class="pre">from</span></code> or <code class="docutils literal notranslate"><span class="pre">to</span></code> are undefined temporary symbols.  If either symbol
is a temporary symbol, then the section symbol is used instead.  If either
symbol is undefined, then that symbol is defined as if <code class="docutils literal notranslate"><span class="pre">.weak</span> <span class="pre">symbol</span></code> has been
written at the end of the file.  This forces the symbol to show up in the symbol
table.</p>
</div>
<div class="section" id="sht-llvm-addrsig-section-address-significance-table">
<h4><a class="toc-backref" href="#id20"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_ADDRSIG</span></code> Section (address-significance table)</a><a class="headerlink" href="#sht-llvm-addrsig-section-address-significance-table" title="Permalink to this headline">¶</a></h4>
<p>This section is used to mark symbols as address-significant, i.e. the address
of the symbol is used in a comparison or leaks outside the translation unit. It
has the same meaning as the absence of the LLVM attributes <code class="docutils literal notranslate"><span class="pre">unnamed_addr</span></code>
and <code class="docutils literal notranslate"><span class="pre">local_unnamed_addr</span></code>.</p>
<p>Any sections referred to by symbols that are not marked as address-significant
in any object file may be safely merged by a linker without breaking the
address uniqueness guarantee provided by the C and C++ language standards.</p>
<p>The contents of the section are a sequence of ULEB128-encoded integers
referring to the symbol table indexes of the address-significant symbols.</p>
<p>There are two associated assembly directives:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.addrsig</span>
</pre></div>
</div>
<p>This instructs the assembler to emit an address-significance table. Without
this directive, all symbols are considered address-significant.</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.addrsig_sym</span> <span class="no">sym</span>
</pre></div>
</div>
<p>This marks <code class="docutils literal notranslate"><span class="pre">sym</span></code> as address-significant.</p>
</div>
<div class="section" id="sht-llvm-sympart-section-symbol-partition-specification">
<h4><a class="toc-backref" href="#id21"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_SYMPART</span></code> Section (symbol partition specification)</a><a class="headerlink" href="#sht-llvm-sympart-section-symbol-partition-specification" title="Permalink to this headline">¶</a></h4>
<p>This section is used to mark symbols with the <a class="reference external" href="https://lld.llvm.org/Partitions.html">partition</a> that they
belong to. An <code class="docutils literal notranslate"><span class="pre">.llvm_sympart</span></code> section consists of a null-terminated string
specifying the name of the partition followed by a relocation referring to
the symbol that belongs to the partition. It may be constructed as follows:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span> <span class="s">&quot;.llvm_sympart&quot;</span><span class="p">,</span><span class="s">&quot;&quot;</span><span class="p">,</span><span class="na">@llvm_sympart</span>
<span class="na">.asciz</span> <span class="s">&quot;libpartition.so&quot;</span>
<span class="na">.word</span> <span class="no">symbol_in_partition</span>
</pre></div>
</div>
</div>
<div class="section" id="sht-llvm-bb-addr-map-section-basic-block-address-map">
<h4><a class="toc-backref" href="#id22"><code class="docutils literal notranslate"><span class="pre">SHT_LLVM_BB_ADDR_MAP</span></code> Section (basic block address map)</a><a class="headerlink" href="#sht-llvm-bb-addr-map-section-basic-block-address-map" title="Permalink to this headline">¶</a></h4>
<p>This section stores the binary address of basic blocks along with other related
metadata. This information can be used to map binary profiles (like perf
profiles) directly to machine basic blocks.
This section is emitted with <code class="docutils literal notranslate"><span class="pre">-basic-block-sections=labels</span></code> and will contain
a BB address map table for every function which may be constructed as follows:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="na">.section</span>  <span class="s">&quot;.llvm_bb_addr_map&quot;</span><span class="p">,</span><span class="s">&quot;&quot;</span><span class="p">,</span><span class="na">@llvm_bb_addr_map</span>
<span class="na">.quad</span>     <span class="no">.Lfunc_begin0</span>                 <span class="c1"># address of the function</span>
<span class="na">.byte</span>     <span class="mi">2</span>                             <span class="c1"># number of basic blocks</span>
<span class="c1"># BB record for BB_0</span>
 <span class="na">.uleb128</span>  <span class="no">.Lfunc_beign0-.Lfunc_begin0</span>  <span class="c1"># BB_0 offset relative to function entry (always zero)</span>
 <span class="na">.uleb128</span>  <span class="no">.LBB_END0_0-.Lfunc_begin0</span>    <span class="c1"># BB_0 size</span>
 <span class="na">.byte</span>     <span class="no">x</span>                            <span class="c1"># BB_0 metadata</span>
<span class="c1"># BB record for BB_1</span>
 <span class="na">.uleb128</span>  <span class="no">.LBB0_1-.Lfunc_begin0</span>        <span class="c1"># BB_1 offset relative to function entry</span>
 <span class="na">.uleb128</span>  <span class="no">.LBB_END0_1-.Lfunc_begin0</span>    <span class="c1"># BB_1 size</span>
 <span class="na">.byte</span>     <span class="no">y</span>                            <span class="c1"># BB_1 metadata</span>
</pre></div>
</div>
<p>This creates a BB address map table for a function with two basic blocks.</p>
</div>
</div>
<div class="section" id="codeview-dependent">
<h3><a class="toc-backref" href="#id23">CodeView-Dependent</a><a class="headerlink" href="#codeview-dependent" title="Permalink to this headline">¶</a></h3>
<div class="section" id="cv-file-directive">
<h4><a class="toc-backref" href="#id24"><code class="docutils literal notranslate"><span class="pre">.cv_file</span></code> Directive</a><a class="headerlink" href="#cv-file-directive" title="Permalink to this headline">¶</a></h4>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_file</span></code> <em>FileNumber FileName</em> [ <em>checksum</em> ] [ <em>checksumkind</em> ]</p>
</dd>
</dl>
</div>
<div class="section" id="cv-func-id-directive">
<h4><a class="toc-backref" href="#id25"><code class="docutils literal notranslate"><span class="pre">.cv_func_id</span></code> Directive</a><a class="headerlink" href="#cv-func-id-directive" title="Permalink to this headline">¶</a></h4>
<p>Introduces a function ID that can be used with <code class="docutils literal notranslate"><span class="pre">.cv_loc</span></code>.</p>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_func_id</span></code> <em>FunctionId</em></p>
</dd>
</dl>
</div>
<div class="section" id="cv-inline-site-id-directive">
<h4><a class="toc-backref" href="#id26"><code class="docutils literal notranslate"><span class="pre">.cv_inline_site_id</span></code> Directive</a><a class="headerlink" href="#cv-inline-site-id-directive" title="Permalink to this headline">¶</a></h4>
<p>Introduces a function ID that can be used with <code class="docutils literal notranslate"><span class="pre">.cv_loc</span></code>. Includes
<code class="docutils literal notranslate"><span class="pre">inlined</span> <span class="pre">at</span></code> source location information for use in the line table of the
caller, whether the caller is a real function or another inlined call site.</p>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_inline_site_id</span></code> <em>FunctionId</em> <code class="docutils literal notranslate"><span class="pre">within</span></code> <em>Function</em> <code class="docutils literal notranslate"><span class="pre">inlined_at</span></code> <em>FileNumber Line</em> [ <em>Column</em> ]</p>
</dd>
</dl>
</div>
<div class="section" id="cv-loc-directive">
<h4><a class="toc-backref" href="#id27"><code class="docutils literal notranslate"><span class="pre">.cv_loc</span></code> Directive</a><a class="headerlink" href="#cv-loc-directive" title="Permalink to this headline">¶</a></h4>
<p>The first number is a file number, must have been previously assigned with a
<code class="docutils literal notranslate"><span class="pre">.file</span></code> directive, the second number is the line number and optionally the
third number is a column position (zero if not specified).  The remaining
optional items are <code class="docutils literal notranslate"><span class="pre">.loc</span></code> sub-directives.</p>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_loc</span></code> <em>FunctionId FileNumber</em> [ <em>Line</em> ] [ <em>Column</em> ] [ <em>prologue_end</em> ] [ <code class="docutils literal notranslate"><span class="pre">is_stmt</span></code> <em>value</em> ]</p>
</dd>
</dl>
</div>
<div class="section" id="cv-linetable-directive">
<h4><a class="toc-backref" href="#id28"><code class="docutils literal notranslate"><span class="pre">.cv_linetable</span></code> Directive</a><a class="headerlink" href="#cv-linetable-directive" title="Permalink to this headline">¶</a></h4>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_linetable</span></code> <em>FunctionId</em> <code class="docutils literal notranslate"><span class="pre">,</span></code> <em>FunctionStart</em> <code class="docutils literal notranslate"><span class="pre">,</span></code> <em>FunctionEnd</em></p>
</dd>
</dl>
</div>
<div class="section" id="cv-inline-linetable-directive">
<h4><a class="toc-backref" href="#id29"><code class="docutils literal notranslate"><span class="pre">.cv_inline_linetable</span></code> Directive</a><a class="headerlink" href="#cv-inline-linetable-directive" title="Permalink to this headline">¶</a></h4>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_inline_linetable</span></code> <em>PrimaryFunctionId</em> <code class="docutils literal notranslate"><span class="pre">,</span></code> <em>FileNumber Line FunctionStart FunctionEnd</em></p>
</dd>
</dl>
</div>
<div class="section" id="cv-def-range-directive">
<h4><a class="toc-backref" href="#id30"><code class="docutils literal notranslate"><span class="pre">.cv_def_range</span></code> Directive</a><a class="headerlink" href="#cv-def-range-directive" title="Permalink to this headline">¶</a></h4>
<p>The <em>GapStart</em> and <em>GapEnd</em> options may be repeated as needed.</p>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_def_range</span></code> <em>RangeStart RangeEnd</em> [ <em>GapStart GapEnd</em> ] <code class="docutils literal notranslate"><span class="pre">,</span></code> <em>bytes</em></p>
</dd>
</dl>
</div>
<div class="section" id="cv-stringtable-directive">
<h4><a class="toc-backref" href="#id31"><code class="docutils literal notranslate"><span class="pre">.cv_stringtable</span></code> Directive</a><a class="headerlink" href="#cv-stringtable-directive" title="Permalink to this headline">¶</a></h4>
</div>
<div class="section" id="cv-filechecksums-directive">
<h4><a class="toc-backref" href="#id32"><code class="docutils literal notranslate"><span class="pre">.cv_filechecksums</span></code> Directive</a><a class="headerlink" href="#cv-filechecksums-directive" title="Permalink to this headline">¶</a></h4>
</div>
<div class="section" id="cv-filechecksumoffset-directive">
<h4><a class="toc-backref" href="#id33"><code class="docutils literal notranslate"><span class="pre">.cv_filechecksumoffset</span></code> Directive</a><a class="headerlink" href="#cv-filechecksumoffset-directive" title="Permalink to this headline">¶</a></h4>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_filechecksumoffset</span></code> <em>FileNumber</em></p>
</dd>
</dl>
</div>
<div class="section" id="cv-fpo-data-directive">
<h4><a class="toc-backref" href="#id34"><code class="docutils literal notranslate"><span class="pre">.cv_fpo_data</span></code> Directive</a><a class="headerlink" href="#cv-fpo-data-directive" title="Permalink to this headline">¶</a></h4>
<dl class="simple">
<dt>Syntax:</dt><dd><p><code class="docutils literal notranslate"><span class="pre">.cv_fpo_data</span></code> <em>procsym</em></p>
</dd>
</dl>
</div>
</div>
</div>
<div class="section" id="target-specific-behaviour">
<h2><a class="toc-backref" href="#id35">Target Specific Behaviour</a><a class="headerlink" href="#target-specific-behaviour" title="Permalink to this headline">¶</a></h2>
<div class="section" id="x86">
<h3><a class="toc-backref" href="#id36">X86</a><a class="headerlink" href="#x86" title="Permalink to this headline">¶</a></h3>
<div class="section" id="id3">
<h4><a class="toc-backref" href="#id37">Relocations</a><a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h4>
<p><code class="docutils literal notranslate"><span class="pre">&#64;ABS8</span></code> can be applied to symbols which appear as immediate operands to
instructions that have an 8-bit immediate form for that operand. It causes
the assembler to use the 8-bit form and an 8-bit relocation (e.g. <code class="docutils literal notranslate"><span class="pre">R_386_8</span></code>
or <code class="docutils literal notranslate"><span class="pre">R_X86_64_8</span></code>) for the symbol.</p>
<p>For example:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="nf">cmpq</span> <span class="no">$foo@ABS8</span><span class="p">,</span> <span class="nv">%rdi</span>
</pre></div>
</div>
<p>This causes the assembler to select the form of the 64-bit <code class="docutils literal notranslate"><span class="pre">cmpq</span></code> instruction
that takes an 8-bit immediate operand that is sign extended to 64 bits, as
opposed to <code class="docutils literal notranslate"><span class="pre">cmpq</span> <span class="pre">$foo,</span> <span class="pre">%rdi</span></code> which takes a 32-bit immediate operand. This
is also not the same as <code class="docutils literal notranslate"><span class="pre">cmpb</span> <span class="pre">$foo,</span> <span class="pre">%dil</span></code>, which is an 8-bit comparison.</p>
</div>
</div>
<div class="section" id="windows-on-arm">
<h3><a class="toc-backref" href="#id38">Windows on ARM</a><a class="headerlink" href="#windows-on-arm" title="Permalink to this headline">¶</a></h3>
<div class="section" id="stack-probe-emission">
<h4><a class="toc-backref" href="#id39">Stack Probe Emission</a><a class="headerlink" href="#stack-probe-emission" title="Permalink to this headline">¶</a></h4>
<p>The reference implementation (Microsoft Visual Studio 2012) emits stack probes
in the following fashion:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="nf">movw</span> <span class="no">r4</span><span class="p">,</span> <span class="c1">#constant</span>
<span class="nf">bl</span> <span class="no">__chkstk</span>
<span class="nf">sub.w</span> <span class="no">sp</span><span class="p">,</span> <span class="no">sp</span><span class="p">,</span> <span class="no">r4</span>
</pre></div>
</div>
<p>However, this has the limitation of 32 MiB (±16MiB).  In order to accommodate
larger binaries, LLVM supports the use of <code class="docutils literal notranslate"><span class="pre">-mcmodel=large</span></code> to allow a 4GiB
range via a slight deviation.  It will generate an indirect jump as follows:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="nf">movw</span> <span class="no">r4</span><span class="p">,</span> <span class="c1">#constant</span>
<span class="nf">movw</span> <span class="no">r12</span><span class="p">,</span> <span class="p">:</span><span class="no">lower16</span><span class="p">:</span><span class="no">__chkstk</span>
<span class="nf">movt</span> <span class="no">r12</span><span class="p">,</span> <span class="p">:</span><span class="no">upper16</span><span class="p">:</span><span class="no">__chkstk</span>
<span class="nf">blx</span> <span class="no">r12</span>
<span class="nf">sub.w</span> <span class="no">sp</span><span class="p">,</span> <span class="no">sp</span><span class="p">,</span> <span class="no">r4</span>
</pre></div>
</div>
</div>
<div class="section" id="variable-length-arrays">
<h4><a class="toc-backref" href="#id40">Variable Length Arrays</a><a class="headerlink" href="#variable-length-arrays" title="Permalink to this headline">¶</a></h4>
<p>The reference implementation (Microsoft Visual Studio 2012) does not permit the
emission of Variable Length Arrays (VLAs).</p>
<p>The Windows ARM Itanium ABI extends the base ABI by adding support for emitting
a dynamic stack allocation.  When emitting a variable stack allocation, a call
to <code class="docutils literal notranslate"><span class="pre">__chkstk</span></code> is emitted unconditionally to ensure that guard pages are setup
properly.  The emission of this stack probe emission is handled similar to the
standard stack probe emission.</p>
<p>The MSVC environment does not emit code for VLAs currently.</p>
</div>
</div>
<div class="section" id="windows-on-arm64">
<h3><a class="toc-backref" href="#id41">Windows on ARM64</a><a class="headerlink" href="#windows-on-arm64" title="Permalink to this headline">¶</a></h3>
<div class="section" id="id4">
<h4><a class="toc-backref" href="#id42">Stack Probe Emission</a><a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h4>
<p>The reference implementation (Microsoft Visual Studio 2017) emits stack probes
in the following fashion:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="nf">mov</span> <span class="no">x15</span><span class="p">,</span> <span class="c1">#constant</span>
<span class="nf">bl</span> <span class="no">__chkstk</span>
<span class="nf">sub</span> <span class="no">sp</span><span class="p">,</span> <span class="no">sp</span><span class="p">,</span> <span class="no">x15</span><span class="p">,</span> <span class="no">lsl</span> <span class="mi">#4</span>
</pre></div>
</div>
<p>However, this has the limitation of 256 MiB (±128MiB).  In order to accommodate
larger binaries, LLVM supports the use of <code class="docutils literal notranslate"><span class="pre">-mcmodel=large</span></code> to allow a 8GiB
(±4GiB) range via a slight deviation.  It will generate an indirect jump as
follows:</p>
<div class="highlight-gas notranslate"><div class="highlight"><pre><span></span><span class="nf">mov</span> <span class="no">x15</span><span class="p">,</span> <span class="c1">#constant</span>
<span class="nf">adrp</span> <span class="no">x16</span><span class="p">,</span> <span class="no">__chkstk</span>
<span class="nf">add</span> <span class="no">x16</span><span class="p">,</span> <span class="no">x16</span><span class="p">,</span> <span class="p">:</span><span class="no">lo12</span><span class="p">:</span><span class="no">__chkstk</span>
<span class="nf">blr</span> <span class="no">x16</span>
<span class="nf">sub</span> <span class="no">sp</span><span class="p">,</span> <span class="no">sp</span><span class="p">,</span> <span class="no">x15</span><span class="p">,</span> <span class="no">lsl</span> <span class="mi">#4</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="FaultMaps.html" title="FaultMaps and implicit checks"
             >next</a> |</li>
        <li class="right" >
          <a href="ExceptionHandling.html" title="Exception Handling in LLVM"
             >previous</a> |</li>
  <li><a href="https://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>

          <li class="nav-item nav-item-1"><a href="Reference.html" >Reference</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">LLVM Extensions</a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2003-2021, LLVM Project.
      Last updated on 2021-09-18.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.4.
    </div>
  </body>
</html>