Today I Learned

2023/09/08

linker debuginfo ld build-id

(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

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.