[all-commits] [llvm/llvm-project] d3e5b6: [ELF] Implement --build-id={md5, sha1} with truncat...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Mar 24 11:32:00 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d3e5b6f7539b86995aef6e2075c1edb3059385ce
      https://github.com/llvm/llvm-project/commit/d3e5b6f7539b86995aef6e2075c1edb3059385ce
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-03-24 (Thu, 24 Mar 2022)

  Changed paths:
    M lld/ELF/Writer.cpp
    M lld/test/ELF/build-id.s
    M lld/test/ELF/partition-notes.s

  Log Message:
  -----------
  [ELF] Implement --build-id={md5,sha1} with truncated BLAKE3

--build-id was introduced as "approximation of true uniqueness across all
binaries that might be used by overlapping sets of people". It does not require
the some resistance mentioned below. In practice, people just use --build-id=md5
for 16-byte build ID and --build-id=sha1 for 20-byte build ID.

BLAKE3 has 256-bit key length, which provides 128-bit security against
(second-)preimage, collision, and differentiability attacks. Its portable
implementation is fast. It additionally provides Arm Neon/AVX2/AVX-512. Just
implement --build-id={md5,sha1} with truncated BLAKE3.

Linking clang 14 RelWithDebInfo with --threads=8 on a Skylake CPU:

* 1.13x as fast with --build-id=md5
* 1.15x as fast with --build-id=sha1

--threads=4 on Apple m1:

* 1.25x as fast with --build-id=md5
* 1.17x as fast with --build-id=sha1

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D121531




More information about the All-commits mailing list