[go: up one dir, main page]

Today I Learned

tags


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-id ELF note section or a .buildid COFF section. The contents of the note are unique bits identifying this linked file. style can be

  • uuid to use 128 random bits,
  • sha1 to use a 160-bit SHA1 hash on the normative parts of the output contents,
  • md5 to use a 128-bit MD5 hash on the normative parts of the output contents, or
  • 0xHEXSTRING to use a chosen bit string specified as an even number of hexadecimal digits (- and : characters between digit pairs are ignored).

If style is 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.