-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriver.html
218 lines (205 loc) · 11.3 KB
/
Driver.html
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
<!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="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Driver — lld 11 documentation</title>
<link rel="stylesheet" href="_static/llvm.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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>
<script type="text/javascript" src="_static/language_data.js"></script>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Open Projects" href="open_projects.html" />
<link rel="prev" title="Developing lld Readers" href="Readers.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 Documentation"/></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="open_projects.html" title="Open Projects"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Readers.html" title="Developing lld Readers"
accesskey="P">previous</a> |</li>
<li><a href="index.html">lld Home</a> | </li>
<li class="nav-item nav-item-1"><a href="AtomLLD.html" >ATOM-based lld</a> »</li>
<li class="nav-item nav-item-2"><a href="development.html" accesskey="U">Development</a> »</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Driver</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#overview">Overview</a><ul>
<li><a class="reference internal" href="#flavors">Flavors</a><ul>
<li><a class="reference internal" href="#selecting-a-flavor">Selecting a Flavor</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#adding-an-option-to-an-existing-flavor">Adding an Option to an existing Flavor</a></li>
<li><a class="reference internal" href="#adding-a-flavor">Adding a Flavor</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="Readers.html"
title="previous chapter">Developing lld Readers</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="open_projects.html"
title="next chapter">Open Projects</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/Driver.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="driver">
<h1>Driver<a class="headerlink" href="#driver" title="Permalink to this headline">¶</a></h1>
<p>Note: this document discuss Mach-O port of LLD. For ELF and COFF,
see <a class="reference internal" href="index.html"><span class="doc">LLD - The LLVM Linker</span></a>.</p>
<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="#overview" id="id2">Overview</a><ul>
<li><a class="reference internal" href="#flavors" id="id3">Flavors</a><ul>
<li><a class="reference internal" href="#selecting-a-flavor" id="id4">Selecting a Flavor</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#adding-an-option-to-an-existing-flavor" id="id5">Adding an Option to an existing Flavor</a></li>
<li><a class="reference internal" href="#adding-a-flavor" id="id6">Adding a Flavor</a></li>
</ul>
</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 the lld driver. The purpose of this document is to
describe both the motivation and design goals for the driver, as well as details
of the internal implementation.</p>
</div>
<div class="section" id="overview">
<h2><a class="toc-backref" href="#id2">Overview</a><a class="headerlink" href="#overview" title="Permalink to this headline">¶</a></h2>
<p>The lld driver is designed to support a number of different command line
interfaces. The main interfaces we plan to support are binutils’ ld, Apple’s
ld, and Microsoft’s link.exe.</p>
<div class="section" id="flavors">
<h3><a class="toc-backref" href="#id3">Flavors</a><a class="headerlink" href="#flavors" title="Permalink to this headline">¶</a></h3>
<p>Each of these different interfaces is referred to as a flavor. There is also an
extra flavor “core” which is used to exercise the core functionality of the
linker it the test suite.</p>
<ul class="simple">
<li>gnu</li>
<li>darwin</li>
<li>link</li>
<li>core</li>
</ul>
<div class="section" id="selecting-a-flavor">
<h4><a class="toc-backref" href="#id4">Selecting a Flavor</a><a class="headerlink" href="#selecting-a-flavor" title="Permalink to this headline">¶</a></h4>
<p>There are two different ways to tell lld which flavor to be. They are checked in
order, so the second overrides the first. The first is to symlink <strong class="program">lld</strong>
as <strong class="program">lld-{flavor}</strong> or just <strong class="program">{flavor}</strong>. You can also specify
it as the first command line argument using <code class="docutils literal notranslate"><span class="pre">-flavor</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ lld -flavor gnu
</pre></div>
</div>
<p>There is a shortcut for <code class="docutils literal notranslate"><span class="pre">-flavor</span> <span class="pre">core</span></code> as <code class="docutils literal notranslate"><span class="pre">-core</span></code>.</p>
</div>
</div>
</div>
<div class="section" id="adding-an-option-to-an-existing-flavor">
<h2><a class="toc-backref" href="#id5">Adding an Option to an existing Flavor</a><a class="headerlink" href="#adding-an-option-to-an-existing-flavor" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Add the option to the desired <code class="file docutils literal notranslate"><span class="pre">lib/Driver/</span><em><span class="pre">flavor</span></em><span class="pre">Options.td</span></code>.</li>
<li>Add to <code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">lld::FlavorLinkingContext</span></code> a getter and setter method
for the option.</li>
<li>Modify <code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">lld::FlavorDriver::parse()</span></code> in :file:
<cite>lib/Driver/{Flavor}Driver.cpp</cite> to call the targetInfo setter
for the option.</li>
<li>Modify {Flavor}Reader and {Flavor}Writer to use the new targetInfo option.</li>
</ol>
</div>
<div class="section" id="adding-a-flavor">
<h2><a class="toc-backref" href="#id6">Adding a Flavor</a><a class="headerlink" href="#adding-a-flavor" title="Permalink to this headline">¶</a></h2>
<ol class="arabic simple">
<li>Add an entry for the flavor in <code class="file docutils literal notranslate"><span class="pre">include/lld/Common/Driver.h</span></code> to
<code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">lld::UniversalDriver::Flavor</span></code>.</li>
<li>Add an entry in <code class="file docutils literal notranslate"><span class="pre">lib/Driver/UniversalDriver.cpp</span></code> to
<code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">lld::Driver::strToFlavor()</span></code> and
<code class="xref cpp cpp-func docutils literal notranslate"><span class="pre">lld::UniversalDriver::link()</span></code>.
This allows the flavor to be selected via symlink and <cite>-flavor</cite>.</li>
<li>Add a tablegen file called <code class="file docutils literal notranslate"><span class="pre">lib/Driver/</span><em><span class="pre">flavor</span></em><span class="pre">Options.td</span></code> that
describes the options. If the options are a superset of another driver, that
driver’s td file can simply be included. The <code class="file docutils literal notranslate"><em><span class="pre">flavor</span></em><span class="pre">Options.td</span></code> file
must also be added to <code class="file docutils literal notranslate"><span class="pre">lib/Driver/CMakeLists.txt</span></code>.</li>
<li>Add a <code class="docutils literal notranslate"><span class="pre">{flavor}Driver</span></code> as a subclass of <code class="xref cpp cpp-class docutils literal notranslate"><span class="pre">lld::Driver</span></code>
in <code class="file docutils literal notranslate"><span class="pre">lib/Driver/</span><em><span class="pre">flavor</span></em><span class="pre">Driver.cpp</span></code>.</li>
</ol>
</div>
</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="open_projects.html" title="Open Projects"
>next</a> |</li>
<li class="right" >
<a href="Readers.html" title="Developing lld Readers"
>previous</a> |</li>
<li><a href="index.html">lld Home</a> | </li>
<li class="nav-item nav-item-1"><a href="AtomLLD.html" >ATOM-based lld</a> »</li>
<li class="nav-item nav-item-2"><a href="development.html" >Development</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2011-2020, LLVM Project.
Last updated on 2020-02-14.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
</div>
</body>
</html>