docs: SSL/TLS

This commit is contained in:
LiuBinPeng
2022-05-24 13:00:23 +08:00
parent 7241220c8e
commit 4f11b95363
90 changed files with 4054 additions and 451 deletions

View File

@@ -6,9 +6,7 @@
## 结构
![](/Users/lbp/Desktop/GitHub/knowledge-kit/assets/LLVM-segment.png)
![](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/assets/LLVM-segment.png)
LLVM 由三部分构成:
@@ -18,7 +16,7 @@ LLVM 由三部分构成:
- Backend后端生成目标程序机器码
![](/Users/lbp/Desktop/GitHub/knowledge-kit/assets/LLVM-Structure.png)
![](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/assets/LLVM-Structure.png)
正是由于这样的设计,使得 LLVM 具备很多有点:
@@ -35,10 +33,6 @@ LLVM 由三部分构成:
LLVM现在被作为实现各种静态和运行时编译语言的通用基础结构(GCC家族、Java、.NET、Python、Ruby、Scheme、Haskell、D等)
## Clang
[Clang](http://clang.llvm.org/) 是 LLVM 的一个子项目,基于 LLVM 架构的 c/c++/Objective-C 语言的编译器前端
@@ -57,9 +51,7 @@ Clang 相较于 GCC具备下面优点
- 设计清晰简单,容易理解,易于扩展增强
![](/Users/lbp/Desktop/GitHub/knowledge-kit/assets/LLVM-phase.png)
![](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/assets/LLVM-phase.png)
### 查看编译过程
@@ -69,12 +61,10 @@ clang -ccc-print-phases main.m
对 main.m 文件
![](/Users/lbp/Desktop/GitHub/knowledge-kit/assets/clang-phase.png)
![](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/assets/clang-phase.png)
可以看到经历了输入、预处理、编译、LLVM Backend、汇编、链接、绑定架构7个阶段。
查看 preprocessor (预处理)的结果:`clang -E main.m`。预处理主要做的事情就是头文件导入、宏定义替换等。
词法分析,生成 Token`clang -fmodules -E -Xclang -dump-tokens main.m`
@@ -89,14 +79,10 @@ int main(int argc, const char * argv[]) {
}
```
![](/Users/lbp/Desktop/GitHub/knowledge-kit/assets/clang-analysize.png)
![](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/assets/clang-analysize.png)
语法分析生成语法树ASTAbstract Syntax Tree`clang -fmodules -fsyntax-only -Xclang -ast-dump main.m`
![](/Users/lbp/Desktop/GitHub/knowledge-kit/assets/clang-ast.png)
![](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/assets/clang-ast.png)
### LLVM IR