2019-04-21 11:50:48 +08:00

18 lines
1.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="ld">ld</h1>
<p>将目标文件连接为可执行程序</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>ld命令</strong> 是GNU的连接器将目标文件连接为可执行程序。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">ld(选项)(参数)
ld [options] objfile ...</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-o指定输出文件名
-e指定程序的入口符号。</code></pre>
<h3 id="参数">参数</h3>
<p>目标文件:指定需要连接的目标文件。</p>
<h3 id="实例">实例</h3>
<p>这告诉ld通过将文件“/lib/crt0.o”与“hello.o”和库“libc.a”链接起来生成一个名为output的文件该文件将来自标准搜索目录。</p>
<div class="sourceCode" id="cb3"><pre><code class="language-bash"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="fu">ld</span> -o <span class="op">&lt;</span>output<span class="op">&gt;</span> /lib/crt0.o hello.o -lc</a>
<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="fu">ld</span> -o output /lib/crt0.o hello.o -lc</a></code></pre></div>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->