2019年总结——工具链的一年
source link: http://maskray.me/blog/2019-12-31-summary
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
2019年总结——工具链的一年
2017年10月第一次给LLVM提交patch,到2019年底已经贡献两年多了。今年800 commits,灌水很多,挑出一些值得一提的。
- LLVM binary utilities很多改进,如:清理了llvm-objdump代码,使llvm-nm ELF production ready,给llvm-readobj/llvm-readelf添加
GNU_PROPERTY_X86_*
输出,给llvm-objcopy实现了ELF:--only-keep-debug
, COFF:--redefine-sym --strip-debug
, Mach-O:--redefine-sym
- MC各种改进(ifunc、.reloc、.symver、.weakref等)、删除废弃代码(
MCCodePadder
等) - x86 -fno-plt
__tls_get_addr
(D62106, D64304) - dominator tree、dead code elimination、global optimization等改进
- DebugInfo改进
- Legacy pass manager清理
- 删除
llvm.{sig,}{segjmp,longjmp}
- 删除
"no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf"
- 简化SelectionDAG inline assembly
- 给FreeBSD powerpc64贡献者改patches。FreeBSD 13-CURRENT powerpc64用clang了
- ppc32 codegen改进(D63563, D71649)。FreeBSD 13-CURRENT powerpc也用clang了
Clang
-gsplit-dwarf
能在非Linux非Fuchsia的OS(如FreeBSD)上用(r357150)-gz
改进- 给ppc64实现inline asm constraint
"ww"
(D64119) - 实现
-mlong-double-64
(D64067)和-mlong-double-128
(D64277)、-mabi=ibmlongdouble -mabi=ieeelongdouble
(D64283) - 重构
-fomit-frame-pointer
-momit-leaf-frame-pointer
(D64294) - clangDriver的各种改进(libgcc简化、
LIBRARY_PATH
顺序、musl search order、-fsanitize=
等) - 默认禁用
-Wbitwise-op-parentheses -Wlogical-op-parentheses
。这两个diagnostics false positive很多。 - 修复
-M -MM -MD -MMD -MT -MQ
的多个问题(r371917, r371918) - 默认启用
-fuse-init-array
(D71393, D71434)
- 实现
--allow-shlib-undefined
(D62276) - 完整实现了ppc32 port(main: D62464, TLS: D62940)。这两个补丁是我非常满意的,完整了解了方方面面后实现的.
- ppc64诸多改进,质量提升到production ready状态,被FreeBSD 13-CURRENT采用。
- 移除Android Bionic的AArch64
PT_TLS
hack(D62055),为此实现了几个integrated assembler功能,又引申出一系列lld TLS改进(D62098 )。深入研究还发现了musl<1.1.23和FreeBSD ld.so的问题 - 给RISC-V port实现了PLT、GOT等(main:D63076、TLS(D63020))。再加上其他改进,RISCV-V port达到了除
R_RISCV_ALIGN R_RISCV_RELAX
外production ready状态。 我对RISC-V linker relaxation的感受很复杂。这个功能怎么实现需要认真思考。 - 把
PT_TLS
从PT_GNU_RELRO
中间移动到开头(D56828),实现重叠PF_R|PF_W
方案(D58892) STT_GNU_IFUNC
处理的改进。D65651 MoveR_*_IRELATIVE
from .rela.plt to rela.dyn。GNU ld x86和AArch64仍把R_*_IRELATIVE
放置在.rela.plt中,感觉不好。D65995、D71519 Add IpltSection等。- .got和.got.plt分离的方案有些缺陷,2018年改进了一点,D59594完整解决问题
- 不同alignment
SHT_NOTE
的放置(D61296),当初32-bit到64-bit的演化中,Linux、FreeBSD、NetBSD都弄错了Elf64_Nhdr
的大小,只有少数系统如Solaris弄对了。 - 简化exportDynamic和isPreemptible (r368550 D66091)
- Linker script的改进(D62177 memory region等)
- x86-64 TLSDESC(D62513),也实现了LLVM的codegen部分(D62512)。
- 错误信息的改进(D59649, D61583 STT_SECTION to discarded section)
undefined symbol
拼写错误的提示(D67039),extern "C"
的提示(D69592, D69650)-z noseparate-code
(D64903 D64906)。最多给输出节省3*maxpagesize
字节(平均似乎大于1.5*maxpagesize
),在x86上maxpagesize为4096,在aarch64和ppc64上为65536。嗯,平均给Android每个executable/shared object节省6kb。- 很多ClangBuiltLinux的改进。The Linux kernel for arm32_7, arm64, ppc64le and x86_64 can now be linked by lld.加了
-z separate-loadable-segments
(D67481)用于Fuchsia。
binutils
给binutils报告了诸多RISC-V bugs:
Others:
给ELF ABI RISC-V Processor Supplement ABI的建议:
- MIPS: Drop .dynsym symbol ordering requirement and nullify
DT_MIPS_XHASH
- Hexagon: 希望实现TLSDESC
- x86: Intel Control-flow Enhancement Technology (D59780)。对Intel坚持弄
.plt.sec
有点失望。 他们的说辞仅仅是早年弄MPX(已经被Linux移除,正在被Linux移除)也设计了这样的方案,并且在没有基准测试的情况下说这样或许对cache locality更友好。 对ppc了解更深后发现.plt.sec
倒是和ppc32/ppc64.glink
有相似之处。ppc引入.glink
是缺乏ADDPCIS时的无奈之举。x86这样设计则算明显缺陷,亦不利于未来增加新的PLT格式, 为了避免未来再发生这种binutils行为挟持LLVM/Clang/lld实现的例子,只能多关注binutils的变化了。另外值得一提,AArch64 8.3a 8.5a也有相似的特性Pointer Authentication、Branch Target Identification。 Linker选项的语义AArch64比x86有优雅。我试图在D59780挽救。
musl commits+=3。
今年也是首次贡献ldc,现在积攒了4 commits。D语言解决了不少C++痛点,今后需要更多学习。dmd commits++。
给Lua 5.4.0指出LUA_NOCVTN2S
问题。
lsp-mode commits+=3。lsp-ui commits++。很惭愧,今年基本没有维护Emacs的这两个套件。 希望lsp-mode和eglot能相互取长补短。我还是觉得lsp-mode实现过于臃肿了,现在用户基数大了,有些地方不容易渐进改了。
给OSDT Weekly提供过一些情报帮助。
发布了ccls 0.20190314.3、0.20190823.5。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK