2023/09/08
(1) that gnu ld, part of gnu’s binutils suite, is the de-facto standard interface for linker CLIs.
Thus, all of gold (elf-only ld), mold/sold, and lld also try to expose ld-compatible CLIs.
(2) that ld has several modes of adding a build id to an executable:
--build-id[=style][Create a ]
.note.gnu.build-idELF note section or a.buildidCOFF section. The contents of the note are unique bits identifying this linked file.stylecan be
uuidto use 128 random bits,sha1to use a 160-bit SHA1 hash on the normative parts of the output contents,md5to use a 128-bit MD5 hash on the normative parts of the output contents, or0xHEXSTRINGto use a chosen bit string specified as an even number of hexadecimal digits (-and:characters between digit pairs are ignored).If
styleis omitted, sha1 is used.
lld adds a --build-id=tree style as an alias for --build-id=sha1, and an extra --build-id=fast style.
mold add a --build-id=sha256 style and defaults to that.