[PATCH] libiberty, ld: Use x86 HW optimized sha1
Nick Clifton
nickc@redhat.com
Wed Nov 29 09:33:29 GMT 2023
Hi Michael,
>>> I think it would be a bad idea to lie to users, if they choose
>>> --buildid=sha1, we should be using SHA1, not some other checksum,
>>
>> Agreed.
>
> In principle I agree, but OTOH it's not so super clear cut: when you
> actually want to depend on what --build-id=xyz produces (e.g. for
> post-build checks), then you don't only need the specific hash algorithm.
> You also need to know how exactly it's applied: which pieces of the input
> file go into hashing, in which order, and which length. All linkers
> do that differently right now, so even with the same hash algo they would
> produce different checksums.
>
> What matters for build-id is that the same input generates the same
> checksum, and different inputs likely don't generate the same checksum.
> In that sense our naming of the build-id strategies should rather be
> something like "quick" and "thorough" or "cryptographic". Naming a
> specific algorithm implies something dependable that actually isn't so
> dependable after all.
That makes sense. But what if rather than the input to the linker changing
the linker itself changes ? For example suppose that ld.bfd supported a
--build-id=fast option which used the sha1 algorithm. Then in the next
release we decide to change the algorithm to something else, eg blake3.
Then using the 2.41 linker would produce a different build-id for the
same input as the 2.42 linker.
I actually like the idea of supporting descriptive names for the --build-id
option, but I think that we might need to include some caveats in the
documentation...
Cheers
Nick
More information about the Binutils
mailing list