本講題簡介 executable 是怎麼經過 toolchain 生成,簡介 ELF 格式,static linking 以及 dynamic linking。如果你平常都是透過 gcc a.c來編譯檔案,卻不太了解 a.c 是怎麼變成 a.out 的話,這是一個你可以來了解的過程。目標聽眾
Linux 程式開發入門者
先備知識
Basic linux and c programming
歡迎大家來到SITCON 2021 ヽ(✿゚▽゚)ノ
共筆入口:https://hackmd.io/@SITCON/2021
手機版請點選上方 按鈕展開議程列表。
請從這裡開始
git clone https://github.com/NTHU-SC/linking-labs
git checkout sitcon2021
今天會講
Hello World
資料夾的東西
-S
: Section 資訊
dd
切出-s
: Symbol 資訊-sW
gcc --verbose
可觀察-D
: define symbol-I
: header 資料夾指定-Wall
-O
: 最佳化
-O1
-O2
-O3
-Ofast
(可能會出錯)-fPIC
-shared
-static
.a
ldd
ldconfig -v
不同語言只要能變成 object file 就能產生 symbol。
extern "C"
比較好_Z
prefix for C++ 等-g
參數來保留 / 加入 debug symbolgdb
等除錯器難以輸出可以辨識/偵錯的訊息
LD_LIBRARY_PATH
LD_PRELOAD
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing