2021年总结

llvm-project

今年800+ commits,灌水很多,挑出一些值得一提的。

LLVM

  • Deleted remnant PowerPC Darwin code.
  • [XRay] Support DW_TAG_call_site and delete unneeded PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL lowering
  • [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags
  • [yaml2obj/obj2yaml/llvm-readobj] Support SHF_GNU_RETAIN
  • [MC] Support SHF_GNU_RETAIN as section flag 'R'
  • Support .reloc *, BFD_RELOC_{NONE,16,32,64}, * for a number of targets
  • Support .symver *, *, remove
  • Switched llvm-readelf/llvm-strings/llvm-nm/etc from llvm::cl to OptTable, modernizing the command line option syntax
  • [RISCV] Support machine constraint "S"
  • [LTO] Add SelectionKind to IRSymtab and use it in ld.lld/LLVMgold
  • [InstrProfiling][ELF] Make __profd_ private if the function does not use value profiling makes PGO/coverage instrumentation smaller
  • [InstrProfiling] Make CountersPtr in __profd_ relative greatly decreases the number of dynamic relocations
  • [X86] Default to -x86-pad-for-align=false to drop assembler difference with or w/o -g
  • [MC] Set SHF_INFO_LINK on SHT_REL/SHT_RELA sections
  • [llvm-objdump/llvm-readobj/obj2yaml/yaml2obj] Support STO_RISCV_VARIANT_CC and DT_RISCV_VARIANT_CC
  • Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion
  • [LangRef] Update ifunc syntax
  • [llvm-objdump] -p: Dump PE header for PE/COFF
  • [MachineOutliner] Don't outline functions starting with PATCHABLE_FUNCTION_ENTER/FENTRL_CALL

Clang

  • Add -f[no-]direct-access-external-data to supersede -mpie-copy-relocations
  • Add GNU attribute 'retain'
  • Define __GCC_HAVE_DWARF2_CFI_ASM if applicable
  • Fixed a number of cross-compiling issues in lib/Driver. Properly supported cross-compiling using g++ files (both normal and Debian-flavored)
  • [Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-default-pie
  • -gsplit-dwarf semantics fix
  • -fasynchronous-unwind-tables semantics fix
  • Record -fasynchronous-unwind-tables and CC1 -mframe-pointer={non-leaf,all} in module flags metadata to affect synthesized functions
  • Implement -falign-loops=N
  • Minor CGDebugInfo cleanup
  • Add -fbinutils-version= to gate ELF features on the specified binutils version

lld

  • [ELF] Special case --shuffle-sections=-1 to reverse input sections
  • [ELF] Change --shuffle-sections=<seed> to --shuffle-sections=<section-glob>=<seed>
  • [ELF] Add OVERWRITE_SECTIONS command
  • [ELF] Add -Bsymbolic-non-weak-functions
  • [ELF] Support copy relocation on non-default version symbols for glibc
  • [ELF] Add --why-extract= to query why archive members/lazy object files are extracted
  • [ELF] Implement TLSDESC for x86-32
  • [ELF] Split scanRelocations into scanRelocations/postScanRelocations
  • [ELF] Replace LazyObjFile with lazy ObjFile/BitcodeFile
  • [ELF][PPC32] Support .got2 in an output section description may benefit someone writing WiiU in Rust
  • [ELF][LTO] Call madvise(MADV_DONTNEED) on MemoryBuffer instances

Wrote 12.0.0 and 13.0.0 release notes for ld.lld. Made ld.lld quite a bit faster. See https://maskray.me/blog/2021-12-19-why-isnt-ld.lld-faster#new-hope.

LLDB

  • Makefile.rules: Avoid redundant .d generation (make restart) and inline archive rule to the only test
  • [lldb] Add -Wl,-rpath to make tests run with fresh built libc++

compiler-rt

  • [sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl
  • [sanitizer] Fall back to fast unwinder
  • [sanitizer] Improve accuracy of GetTls on x86/s390
  • [lsan] Bump the thread limit from 1<<13 to 1<<22
  • [InstrProfiling] Use llvm.compiler.used if applicable for Mach-O

Misc

  • [libunwind] Add UNW_AARCH64_* beside UNW_ARM64_*
  • [libc++abi] Simplify __gxx_personality_v0

binutils

Reported many bugs and feature requests:

My commits:

  • Add some more DWARF-5 sections
  • nm: Add --quiet to suppress "no symbols" diagnostic
  • ld: Add -Bno-symbolic
  • gold: Add -Bno-symbolic
  • ld: Add -no-pie
  • ld: Add ChangeLog entry for -no-pie
  • gold: --export-dynamic-symbol: don't imply -u
  • readelf: Make DT_PREINIT_ARRAYSZ's output style match DT_INIT_ARRAYSZ
  • readelf: Support RELR in -S and -d and output
  • readelf: Support SHT_RELR/DT_RELR for -r
  • bfd_section_from_shdr: Support SHT_RELR sections

GCC

Reported bugs and feature requests:

glibc

Reported bugs and feature requests:

26 commits:

Linux kernel

4 commits:

  • module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols
  • x86/build: Treat R_386_PLT32 relocation as R_386_PC32
  • firmware_loader: align .builtin_fw to 8
  • powerpc: Add "-z notext" flag to disable diagnostic

Others

Wrote 28 blog posts (including this one). Quite a few discuss linkers.

Work which has/will have a large impact in the Linux world:

  • promotion of DT_RELR in GNU toolchain
  • build glibc with ld.lld 13.0.0
  • point out the ways to build glibc with Clang (this needs maintainers' help)