LLVM contribution

Contributor since 2017. Landed 4900+ commits.

Blog posts about LLVM: https://maskray.me/blog/tags/llvm/

LLVM

  • Improved many binary utilities (llvm-ar, llvm-nm, llvm-objcopy, llvm-objdump, llvm-readobj, etc) to put them in a good shape for production use. I am now a main reviewer of these binary utilities.
  • Misc fixes to x86 addend folding bug, StackColoring, BranchRelaxation, JumpThreading (https://bugs.llvm.org/show_bug.cgi?id=44922), etc.
  • Improved the dominator tree with one commit having a ~4.5% performance improvement, e.g. D58327 D58349 D58369
  • x86
    • Implemented -march=x86-64-v[234]
    • Fixed lock cmpxchg16b on a global variable with offset
    • [X86FastISel] Fix MO_GOTPCREL GlobalValue reference in static relocation model
    • [X86][FastISel] Support materializing floating-point constants for large code model & PIC
    • Fixed some .code16 assembler issues
    • Mitigation for Intel's Jump Conditional Code Erratum
  • gcov (code coverage with GCC file format compatibility)
    • Rewrote llvm-cov gcov: added support for gcov 4.7~10, improved performance, added support for Kirchhoff circuit law optimization, added many options.
    • Added Kirchhoff circuit law optimization to instrumentation
    • Added support for GCC 4.7~10 compatible instrumentation
  • MC
    • Fixed double negation of .cfi_ directives
    • Fixed many assembler issues.
    • Added SHF_GNU_RETAIN
    • Many cleanups
  • Fixed many debug information bugs
  • LTO
    • Added dso_local propagation for ELF shared objects
    • [ThinLTO] Add Visibility bits to GlobalValueSummary::GVFlags allows non-imported definitions to be optimized with the most constraining visibility.
    • Added comdat nodeduplicate
  • PGO
    • Decreased object file size: D84723 (2.2%), D103717 (2.5% (more for Windows))
    • Fixed various linker garbage collection problems
  • LangRef
    • Clarified semantics of comdat, !associated, stack protector attributes, and some module flags metadata
  • IR
    • Fixed issues and implemented some features related to COMDAT
  • Test utilities
    • Added split-file to improve test readability
  • zstd compressed debug sections
  • Implemented a simplified 64-bit xxh3 hash algorithm adapted from the reference implementaion

Clang

  • Implemented -fpatchable-function-entry=
  • Implemented -mlong-double-128 for x86 and PowerPC.
  • Added -fbinutils-version=
  • Added -gno-split-dwarf
  • Added -f[no-]legacy-pass-manager
  • -mbranches-within-32B-boundaries
  • Many driver changes
    • Improved -B COMPILER_PATH compatibility with GCC
    • Supportted C++ for Debian and upstream cross-compiling GCC
  • Added -fno-semantic-interposition and simplified internal handling.
  • Added -f[no-]direct-access-external-data
  • Implemented -march=x86-64-v[234]
  • Implemented -fprofile-update={atomic,prefer-atomic,single}
  • Implemented __attribute__((retain)) and SHF_GNU_RETAIN
  • Implemented -falign-loops=
  • --gcc-install-dir=: use clang++ --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/12 to use the selected GCC installation directory. Gentoo uses this (/etc/clang/gentoo-gcc-install.cfg) to select the configured GCC installation
  • C++/ObjC++: switch to gnu++17 as the default standard (fixed many tests)
  • -gz=zstd

LLD

1300+ commits. (as of 2023-02)

  • ELF maintainer since 9.0.0. Wrote 9.0.0 ~ 18.1.0 release notes
  • Huge performance improvement: lld 14 ELF changes, lld 15 ELF changes
  • Implemented --no-allow-shlib-undefined
  • Implemented -z noseparate-code/-z separate-code and improved the section layout
    • -z noseparate-code saved up to 3*maxpagesize bytes.
  • Improved --warn-backrefs to be production ready and added --warn-backrefs-exclude.
  • Added -z rel and -z rela
  • Fixed numerous places where LLD can and should improve compatibility with GNU ld.
    • Weak symbols
    • --wrap
    • symbol versioning
    • triple-argument OUTPUT_FORMAT
    • --dynamic-list
    • --noinhibit-exec
    • --emit-relocs (used by some post-link analysis tools)
    • diagnostics on relocations referencing local symbols defined in discarded section group members
    • and many others
  • Many TLS fixes
  • SHF_LINK_ORDER semantics
  • zstd compressed debug sections
  • Linker script improvement: (e.g. D62177 D66279 D74741 D74375) The linker script support is complete enough which meets several kernels' (FreeBSD, Linux, Fuchsia Zircon) needs and most use cases can be adapted from GNU ld with some portability fixes.
    • Introduced the OVERWRITE_SECTIONS command
  • Improved range extension thunks for many cases
  • --shuffle-sections=<section-glob>=<seed>
  • Added --debug-names
  • AArch64
    • Contributed to --fix-cortex-a53-843419, PAC-PLT and Branch Target Identification
    • Fixed a serious TLS issue (D62055)
    • Implemented range extension thunks with addends (D70637)
  • Implemented the PowerPC32 port
  • Implemented a majority of the RISC-V port (D63076 D63220 and others)
    • The port had some basic -no-pie support before I touched it. I added the rest, -shared/-pie support (PLT,GOT,copy and relative relocations), implemented TLS support and linker relaxation.
    • ULEB128 relocations
    • TLSDESC relocations
  • PowerPC64: implemented many features
  • x86-32
    • TLSDESC relocations
  • x86-64
    • TLSDESC relocations (D62513)
    • Contributed to Intel Control-flow Enforcement Technology (D59780)
    • Implemented support for medium/large code models and fixed longstanding _GLOBAL_OFFSET_TABLE_ bugs

compiler-rt

  • Ported sanitizers to musl ([sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl)
  • Diagnostic reporting for -fno-exceptions -fno-asynchronous-unwind-tables code
  • Linux AArch64 port of DataFlowSanitizer
  • Many fixes to sanitizer runtime
  • XRay maintenance