Update ld.md

This commit is contained in:
小弟调调™ 2018-05-06 21:52:27 +08:00 committed by GitHub
parent f71227c949
commit 1d577c72f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 27 deletions

View File

@ -1,28 +1,38 @@
ld ld
=== ===
将目标文件连接为可执行程序 将目标文件连接为可执行程序
## 补充说明 ## 补充说明
**ld命令** 是GNU的连接器将目标文件连接为可执行程序。 **ld命令** 是GNU的连接器将目标文件连接为可执行程序。
### 语法 ### 语法
``` ```
ld(选项)(参数) ld(选项)(参数)
``` ld [options] objfile ...
```
### 选项
### 选项
```
-o指定输出文件名 ```
-e指定程序的入口符号。 -o指定输出文件名
``` -e指定程序的入口符号。
```
### 参数
### 参数
目标文件:指定需要连接的目标文件。
目标文件:指定需要连接的目标文件。
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ --> ### 实例
这告诉ld通过将文件“/lib/crt0.o”与“hello.o”和库“libc.a”链接起来生成一个名为output的文件该文件将来自标准搜索目录。
```bash
ld -o <output> /lib/crt0.o hello.o -lc
ld -o output /lib/crt0.o hello.o -lc
```
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->