[PATCH users/roland/ld-depfile] ld, gold: Add --dependency-file option.

Roland McGrath mcgrathr@google.com
Mon Jun 15 21:15:39 GMT 2020


On Sun, Jun 14, 2020 at 11:22 AM Fangrui Song <i@maskray.me> wrote:
> >Please consider whether using Unordered_set (declared in system.h),
> >which uses a hashed set where supported, would be better than
> >std::set, which uses a binary tree. I'm OK either way, as long as
> >you've considered the two, though my guess would be that Unordered_set
> >would probably be better.
>
> std::unordered_set makes the output unstable across different systems.
> I like a data structure which iterates elements by insertion order (like JavaScript,Python,Ruby).
> This is even better than a std::set

Stable, deterministic output is an important invariant to maintain for
all build tools.
Deduplication here is not particularly important, I just did it since
it seemed easy.
To wit, the BFD implementation does not deduplicate, but just
preserves input order.

So I've just changed the gold implementation to use std::vector instead.
(The code is updated on the users/roland/ld-depfile branch.)


Thanks,
Roland


More information about the Binutils mailing list