/usr/share/doc/llvm-3.5-doc/html/Extensions.html is in llvm-3.5-doc 1:3.5-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LLVM Extensions — LLVM 3.5 documentation</title>
<link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '3.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="LLVM 3.5 documentation" href="index.html" />
<link rel="next" title="LLVM Alias Analysis Infrastructure" href="AliasAnalysis.html" />
<link rel="prev" title="LLVM Programmer’s Manual" href="ProgrammersManual.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">
<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="AliasAnalysis.html" title="LLVM Alias Analysis Infrastructure"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="ProgrammersManual.html" title="LLVM Programmer’s Manual"
accesskey="P">previous</a> |</li>
<li><a href="http://llvm.org/">LLVM Home</a> | </li>
<li><a href="index.html">Documentation</a>»</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="body">
<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><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
<li><a class="reference internal" href="#general-assembly-syntax" id="id2">General Assembly Syntax</a><ul>
<li><a class="reference internal" href="#c99-style-hexadecimal-floating-point-constants" id="id3">C99-style Hexadecimal Floating-point Constants</a></li>
</ul>
</li>
<li><a class="reference internal" href="#machine-specific-assembly-syntax" id="id4">Machine-specific Assembly Syntax</a><ul>
<li><a class="reference internal" href="#x86-coff-dependent" id="id5">X86/COFF-Dependent</a><ul>
<li><a class="reference internal" href="#relocations" id="id6">Relocations</a></li>
<li><a class="reference internal" href="#linkonce-directive" id="id7"><tt class="docutils literal"><span class="pre">.linkonce</span></tt> Directive</a></li>
<li><a class="reference internal" href="#section-directive" id="id8"><tt class="docutils literal"><span class="pre">.section</span></tt> Directive</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#target-specific-behaviour" id="id9">Target Specific Behaviour</a><ul>
<li><a class="reference internal" href="#windows-on-arm" id="id10">Windows on ARM</a><ul>
<li><a class="reference internal" href="#stack-probe-emission" id="id11">Stack Probe Emission</a></li>
<li><a class="reference internal" href="#variable-length-arrays" id="id12">Variable Length Arrays</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="toctree-wrapper compound">
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id1">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="#id2">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="#id3">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"><div class="highlight"><pre><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="#id4">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="#id5">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="#id6">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>@IMGREL</strong> (AT&T syntax only) generates an image-relative relocation that
corresponds to the COFF relocation types <tt class="docutils literal"><span class="pre">IMAGE_REL_I386_DIR32NB</span></tt> (32-bit) or
<tt class="docutils literal"><span class="pre">IMAGE_REL_AMD64_ADDR32NB</span></tt> (64-bit).</p>
<div class="highlight-gas"><div class="highlight"><pre>.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 <tt class="docutils literal"><span class="pre">IMAGE_REL_I386_SECREL</span></tt> (32-bit) or <tt class="docutils literal"><span class="pre">IMAGE_REL_AMD64_SECREL</span></tt> (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
<tt class="docutils literal"><span class="pre">IMAGE_REL_I386_SECTION</span></tt> (32-bit) or <tt class="docutils literal"><span class="pre">IMAGE_REL_AMD64_SECTION</span></tt> (64-bit).</p>
<div class="highlight-gas"><div class="highlight"><pre><span class="na">.section</span> <span class="no">.debug$S</span><span class="p">,</span><span class="s">"rn"</span>
<span class="na">.long</span> <span class="mi">4</span>
<span class="na">.long</span> <span class="mi">242</span>
<span class="na">.long</span> <span class="mi">40</span>
<span class="na">.secrel32</span> <span class="no">_function_name</span>
<span class="na">.secidx</span> <span class="no">_function_name</span>
<span class="na">...</span>
</pre></div>
</div>
</div>
<div class="section" id="linkonce-directive">
<h4><a class="toc-backref" href="#id7"><tt class="docutils literal"><span class="pre">.linkonce</span></tt> Directive</a><a class="headerlink" href="#linkonce-directive" title="Permalink to this headline">¶</a></h4>
<p>Syntax:</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">.linkonce</span> <span class="pre">[</span> <span class="pre">comdat</span> <span class="pre">type</span> <span class="pre">]</span></tt></div></blockquote>
<p>Supported COMDAT types:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">discard</span></tt></dt>
<dd>Discards duplicate sections with the same COMDAT symbol. This is the default
if no type is specified.</dd>
<dt><tt class="docutils literal"><span class="pre">one_only</span></tt></dt>
<dd>If the symbol is defined multiple times, the linker issues an error.</dd>
<dt><tt class="docutils literal"><span class="pre">same_size</span></tt></dt>
<dd>Duplicates are discarded, but the linker issues an error if any have
different sizes.</dd>
<dt><tt class="docutils literal"><span class="pre">same_contents</span></tt></dt>
<dd>Duplicates are discarded, but the linker issues an error if any duplicates
do not have exactly the same content.</dd>
<dt><tt class="docutils literal"><span class="pre">largest</span></tt></dt>
<dd>Links the largest section from among the duplicates.</dd>
<dt><tt class="docutils literal"><span class="pre">newest</span></tt></dt>
<dd>Links the newest section from among the duplicates.</dd>
</dl>
<div class="highlight-gas"><div class="highlight"><pre><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="#id8"><tt class="docutils literal"><span class="pre">.section</span></tt> Directive</a><a class="headerlink" href="#section-directive" title="Permalink to this headline">¶</a></h4>
<p>MC supports passing the information in <tt class="docutils literal"><span class="pre">.linkonce</span></tt> at the end of
<tt class="docutils literal"><span class="pre">.section</span></tt>. For example, these two codes are equivalent</p>
<div class="highlight-gas"><div class="highlight"><pre><span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">"dr"</span><span class="p">,</span> <span class="no">discard</span><span class="p">,</span> <span class="s">"Symbol1"</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"><div class="highlight"><pre><span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">"dr"</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"><div class="highlight"><pre><span class="na">.section</span> <span class="no">secName</span><span class="p">,</span> <span class="s">"dr"</span><span class="p">,</span> <span class="no">discard</span><span class="p">,</span> <span class="s">"Symbol1"</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">"dr"</span><span class="p">,</span> <span class="no">discard</span><span class="p">,</span> <span class="s">"Symbol2"</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 <tt class="docutils literal"><span class="pre">.linkonce</span></tt>, <tt class="docutils literal"><span class="pre">.section</span></tt> also accepts
<tt class="docutils literal"><span class="pre">associative</span></tt>. 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>It must be a COMDAT section.</li>
<li>It cannot be another associative COMDAT section.</li>
</ol>
</div></blockquote>
<p>In the following example the symobl <tt class="docutils literal"><span class="pre">sym</span></tt> is the comdat symbol of <tt class="docutils literal"><span class="pre">.foo</span></tt>
and <tt class="docutils literal"><span class="pre">.bar</span></tt> is associated to <tt class="docutils literal"><span class="pre">.foo</span></tt>.</p>
<div class="highlight-gas"><div class="highlight"><pre><span class="na">.section</span> <span class="no">.foo</span><span class="p">,</span><span class="s">"bw"</span><span class="p">,</span><span class="no">discard</span><span class="p">,</span> <span class="s">"sym"</span>
<span class="na">.section</span> <span class="no">.bar</span><span class="p">,</span><span class="s">"rd"</span><span class="p">,</span><span class="no">associative</span><span class="p">,</span> <span class="s">"sym"</span>
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="target-specific-behaviour">
<h2><a class="toc-backref" href="#id9">Target Specific Behaviour</a><a class="headerlink" href="#target-specific-behaviour" title="Permalink to this headline">¶</a></h2>
<div class="section" id="windows-on-arm">
<h3><a class="toc-backref" href="#id10">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="#id11">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"><div class="highlight"><pre><span class="nf">movw</span> <span class="no">r4</span><span class="p">,</span> <span class="c">#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 <tt class="docutils literal"><span class="pre">-mcode-model=large</span></tt> to allow a 4GiB
range via a slight deviation. It will generate an indirect jump as follows:</p>
<div class="highlight-gas"><div class="highlight"><pre><span class="nf">movw</span> <span class="no">r4</span><span class="p">,</span> <span class="c">#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="#id12">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 <tt class="docutils literal"><span class="pre">__chkstk</span></tt> 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>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<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="AliasAnalysis.html" title="LLVM Alias Analysis Infrastructure"
>next</a> |</li>
<li class="right" >
<a href="ProgrammersManual.html" title="LLVM Programmer’s Manual"
>previous</a> |</li>
<li><a href="http://llvm.org/">LLVM Home</a> | </li>
<li><a href="index.html">Documentation</a>»</li>
</ul>
</div>
<div class="footer">
© Copyright 2003-2014, LLVM Project.
Last updated on 2015-02-27.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>
</html>
|