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

Fangrui Song i@maskray.me
Sun Jun 14 18:22:18 GMT 2020


On 2020-06-13, Cary Coutant via Binutils wrote:
>> +  // Set of names of all files read.
>> +  static std::set<std::string> files_read;
>
>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

>As for a dedicated option vs. post-processing -t output, I'm in favor
>of the dedicated option. The -t output might be mixed in with other
>stderr output from the linker, and isn't really suitable for
>general-purpose automated usage like this.

gold should print to stdout instead of stderr.
See https://sourceware.org/pipermail/binutils/2020-June/111696.html :)
(If it is ok, please check in it for me, because I don't have a write
acess)

>Also, as was mentioned in
>the lld review thread, -t output doesn't mention archive libraries
>that were searched but contributed nothing to the link.
>
>-cary

This is a valid point. However, we still have a problem of lingering
files in the dependency list, which will be flagged by the next make
invocation.
In the traditional make+cc model, -MP is needed
(https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html )


More information about the Binutils mailing list