This is an archive of the discontinued LLVM Phabricator instance.

[COFF] Store a pointer to the parent instead of just the parent name in InputFile
Needs ReviewPublic

Authored by zturner on Jul 9 2018, 12:01 PM.

Details

Reviewers
ruiu
inglorion
Summary

I'm trying to make LLD PDBs look more like Microsoft PDBs. While we can never be perfect, any small amount we can get closer saves a lot of time when debugging and adds confidence that our PDBs are "correct".

Currently I'm trying to create the list of modules in the same order that MSVC creates them. In order to do that, we need a little bit more info from an object file than just the name of its parent. So, rather than adding more and more fields to keep track of all this extra information, we can just store a pointer to the parent itself.

Currently there's no functional change here, we're just changing a StringRef to an ArchiveFile*. In subsequent patches I'll use this to sort the module list in the same order that link.exe does before writing the PDB.

Diff Detail

Event Timeline

zturner created this revision.Jul 9 2018, 12:01 PM
ruiu added a comment.Jul 9 2018, 3:01 PM

The problem of having an archive file pointer instead of an archive file name is that we don't (and don't have to) instantiate an archive file object for an archive given as an argument for /wholearchive. How do you deal with that?

The problem of having an archive file pointer instead of an archive file name is that we don't (and don't have to) instantiate an archive file object for an archive given as an argument for /wholearchive. How do you deal with that?

It seems like I don't deal with that currently, however all the tests pass. So either that means when an argument is passed to /wholearchive, we never end up needing the archive name anyway, or it means that we're lacking test coverage somewhere. Do you know which it is? If it's the former, then I guess I don't need to do anything. If it's the latter, then is there any reason we *can't* instantiate an ArchiveFile object? The expensive thing is parsing the archive, which we have to do regardless.

ruiu added a comment.Jul 9 2018, 3:14 PM

I think it is a lack of an appropriate test. I believe we construct an error message at runtime by concatenating archive file name with a object file name, so if we handle object files in an /wholearchive archive file as if they are outside of any archive, we'd generate a wrong error message.

There's no strong reason not to instantiate archive files for /wholearchive. It's just that it's currently a (small) waste of resource.