GNU ld, which doesn't generate PDBs, can optionally generate a build id by passing the --build-id option. LLD's MinGW frontend knows about this option but ignores it, as I had incorrectly assumed that LLD already generated build IDs even in those cases.
If debug info is requested and no PDB path is set, generate a build id signature as a hash of the binary itself. This allows associating a binary to a minidump, even if debug info isn't written in PDB form by the linker.
I guess the main question is if we should add an lld specific option for this to the lld-link inteface, which we pass from the MinGW frontend when --build-id is received, or if we just should always generate it for the "mingw && debug && !pdb" case.