UNPKG

769 BMarkdownView Raw
1ld
2===
3
4将目标文件连接为可执行程序
5
6## 补充说明
7
8**ld命令** 是GNU的连接器,将目标文件连接为可执行程序。
9
10### 语法
11
12```shell
13ld(选项)(参数)
14ld [options] objfile ...
15```
16
17### 选项
18
19```shell
20-o:指定输出文件名;
21-e:指定程序的入口符号。
22```
23
24### 参数
25
26目标文件:指定需要连接的目标文件。
27
28### 实例
29
30这告诉ld通过将文件“/lib/crt0.o”与“hello.o”和库“libc.a”链接起来,生成一个名为output的文件,该文件将来自标准搜索目录。
31
32```shell
33ld -o <output> /lib/crt0.o hello.o -lc
34ld -o output /lib/crt0.o hello.o -lc
35```
36
37
38<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->