LLVM

Code Models and Relocation Types

本文主要探讨 code models, relocation 与 relocation types。文章首先解释不同的 code models 如何影响编译器的代码生成,然后介绍 relocation 这一机制和常见的 relocation type。文章结合多个代码示例说明在不同场景下(如不同 code models 下的函数调用、全局变量访问)生成的汇编代码以及所使用的 relocation types。

Learn Relocation by Debugging a HWASAN Linker Error

笔者在 Linux/AArch64 环境下使用 HWASAN 时,遇到一 “relocation R_AARCH64_ADR_PREL_PG_HI21 out of range” 链接错误,在分析解决该链接错误过程中对 linker relocation 以及 HWASAN 都有了更深的理解,因此将分析解决该链接错误的过程梳理总结形成此文。

Strict Aliasing, TBAA and TypeSanitizer

本文首先介绍了 C++ 中的 strict aliasing rule,然后深入分析编译器是如何利用 strict aliasing rule 对程序进行分析优化的,之后介绍了检测 strict aliasing violation 的动态分析工具 TypeSanitizer,最后介绍如何在编程时避免写出 strict aliasing violation 的代码。