This is an archive of the discontinued LLVM Phabricator instance.

[lld-link] Add /reproduce: support for several flags
ClosedPublic

Authored by thakis on Feb 22 2021, 11:35 AM.

Details

Reviewers
hans
rnk
Summary

/reproduce: now works correctly with:

  • /call-graph-ordering-file:
  • /def:
  • /natvis:
  • /order:
  • /pdbstream:

I went through all instances of MemoryBuffer::getFile() and made sure
everything that didn't already do so called takeBuffer().

For natvis, that wasn't possible since DebugInfo/PDB wants to take
owernship of the natvis buffer. For that case, I'm manually adding the
tar file entry.

/natvis: and /pdbstream: is slightly awkward, since createResponseFile()
always adds these flags to the response file but createPDB() (which
ultimately adds the files referenced by the flags) is only called if
/debug is also passed. So when using /natvis: without /debug with
/reproduce:, lld won't warn, but when linking using the response
file from the archive, it won't find the natvis file since it's not
in the tar. This isn't a new issue though, and after this patch things
at least work with using /natvis: _with_ debug with /reproduce:.
(Same for /pdbstream:)

Diff Detail

Event Timeline

thakis requested review of this revision.Feb 22 2021, 11:35 AM
thakis created this revision.
thakis updated this revision to Diff 325522.Feb 22 2021, 11:51 AM

add missing trailing backslash in one RUN line

rnk accepted this revision.Feb 22 2021, 1:12 PM

lgtm

lld/COFF/Driver.cpp
633

(nit) Descriptive names can be more helpful than comments. The comment is fine, but how about renaming to createReproducerRspFile or createRspFileForReproduce?

This revision is now accepted and ready to land.Feb 22 2021, 1:12 PM

Thanks!

lld/COFF/Driver.cpp
633

The ELF and MachO ports also have the same comment. I can rename all versions of these functions and remove the comments in a follow-up :)

thakis closed this revision.Feb 23 2021, 9:54 AM

Not sure why phab managed to add a link to https://reviews.llvm.org/rGe6d1f261a5a08d4c05b25509a6f4217a8a1c2188 but then didn't close this. Anyways, closed!

Aha, because I typod "Revision" as "Revison".