Skip to content

Commit 1d577c7

Browse files
authored
Update ld.md
1 parent f71227c commit 1d577c7

File tree

1 file changed

+38
-28
lines changed

1 file changed

+38
-28
lines changed

command/ld.md

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

0 commit comments

Comments
 (0)