[PATCH] D42326: [COFF] add option to avoid overwriting unchanged import libraries

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 19 16:56:46 PST 2018


inglorion added a comment.

Some alternatives I considered:

1. Instead of doing this for only import libraries, do it for all archives. This has the potential to allow more things to be sped up, but it also means that every archive will be byte-for-byte compared if an older version already exists. Since archives in general are larger than import libraries, and the general expectation is that if the build system rebuilt it, something changed, this doesn't seem worth it.

2. Enabling the new functionality by default. I did not consider this safe to do, because it breaks the assumptions many people and build systems make about how things work. If A depends on B and B depends on C, then, without the change, changing C will cause A and B to be rebuilt and receive new timestamps. With the change, if rebuilding B results in the same bytes that were already in there, B will retain its old timestamp and A will not be rebuilt. This also means that B will now look older than C. This seems like an unexpected enough change in semantics that I would want people to explicitly opt into it.

3. Making changes on a lower level than just in the COFF linker driver. I had thought of something along the lines of adding a writeArchive function that produces a MemoryBuffer or something similar, so that bytes can be compared before making a decision about actually committing something to the filesystem. Perhaps adding a flag to writeArchive to easily enable the check. These things may be worth doing in a follow-up especially if we want to have similar behavior in more places. For now, I felt like not changing common code for a special case in the COFF linker was the better choice.


https://reviews.llvm.org/D42326





More information about the llvm-commits mailing list