nixpkgs/pkgs/build-support/bintools-wrapper
Rahul Butani b41933a1be
bintools-wrapper: specify SHA1 as the build-id hash style explicitly
NixOS/nixpkgs#146275 has more discussion on this; the abridged version
is that `lld` defaults to using `--build-id=fast` while GNU `ld` defaults
to `--build-id=sha1`. These differ in length and so
`separate-debug-info.sh`, as of this writing, errors on `lld`'s shorter
`--build-id=fast`-generated hashes.

`lld` offers the following `build-id` styles:
  - UUID (random; fast but bad for reproducibility)
  - fast (xxhash; fast but shorter hashes)
  - user provided hexstring
  - SHA1
  - MD5

GNU `ld` supports the latter three options, `mold` supports all of these
plus SHA256.

UUID is out because it's not reproducible, fast isn't supported by GNU
`ld`

Using a nix provided (sourced from the output base hash) hash as the
`build-id` seems tempting but would require a little extra work
(we have to include some characteristic of the binary being hashed
so that binaries within a derivation still have unique hashes; it
seems easy to get this wrong; i.e. a path based approach would make
two otherwise identical binaries that reside at different paths have
different `build-id` hashes)

That leaves SHA1 and MD5 and GNU `ld` already defaults to the former.

This commit adds `$NIX_BUILD_ID_STYLE` as an escape hatch, in case any
packages have strong opinions about which hash to use.

----

Note that if/when NixOS/nixpkgs#146275 goes through, this change can be
reverted if linker speed is a priority.
2023-02-25 12:49:40 -06:00
..
add-darwin-ldflags-before.sh bintools-wrapper: ensure roles are set before mangling variables 2021-04-11 10:27:16 +09:00
add-flags.sh bintools-wrapper: skip dynamic linker for static binaries 2020-12-27 16:42:11 +01:00
add-hardening.sh {cc,binutils}-wrapper: match leading/trailing arguments 2021-09-20 17:24:04 -07:00
darwin-install_name_tool-wrapper.sh darwin: wrap strip and install_name_tool to codesign modified files 2021-05-17 00:27:02 +09:00
darwin-strip-wrapper.sh darwin: wrap strip and install_name_tool to codesign modified files 2021-05-17 00:27:02 +09:00
default.nix bintools: Add response file support to ld-wrapper (#213831) 2023-02-23 17:05:18 -08:00
gnu-binutils-strip-wrapper.sh stdenv: move --enable-deterministic-archives flag into GNU wrapper 2021-09-18 15:11:17 +02:00
ld-solaris-wrapper.sh
ld-wrapper.sh bintools-wrapper: specify SHA1 as the build-id hash style explicitly 2023-02-25 12:49:40 -06:00
macos-sierra-reexport-hack.bash build-support: Use equivalent valid exit code 2022-11-29 19:11:45 +13:00
setup-hook.sh Revert #127736: stdenv changes towards an alternative shell 2021-07-17 20:39:47 +02:00