This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] Cleanup error messages / add more coverage tests
ClosedPublic

Authored by aganea on Aug 31 2018, 2:12 PM.

Details

Summary

Changes summary:

  1. Log the reason for a PDB or precompiled-OBJ load failure. The format looks like this:
lld-link: warning: Cannot use debug info for 'pdb-type-server-missing.yaml.tmp1.obj'
>>> failed to load reference 'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb': no such file or directory.
  1. Properly handle out-of-date PDB or precompiled-OBJ signature by displaying a corresponding error:
lld-link: warning: Cannot use debug info for 'pdb-type-server-invalid-signature.yaml.tmp.obj'
>>> failed to load reference 'pdb-diff-cl.pdb': The signature does not match; the file(s) might be out of date.
  1. Slightly change behavior on PDB failure: any subsequent load attempt from another OBJ would result in the same error message being logged:
lld-link: warning: Cannot use debug info for 'pdb-type-server-missing.yaml.tmp1.obj'
>>> failed to load reference 'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb': no such file or directory.

lld-link: warning: Cannot use debug info for 'pdb-type-server-missing.yaml.tmp2.obj'
>>> failed to load reference 'C:\src\llvm-project\build\definitely_not_found_for_sure.pdb': no such file or directory.
  1. Slightly change behavior on PDB failure: retry with filename only if previous error was ENOENT ("no such file or directory")
  1. Tests: a. for native PDB errors; b. cover all the cases above.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

aganea created this revision.Aug 31 2018, 2:12 PM
aganea edited the summary of this revision. (Show Details)Aug 31 2018, 2:14 PM
aganea edited the summary of this revision. (Show Details)Aug 31 2018, 2:29 PM
ruiu added inline comments.Sep 3 2018, 6:03 PM
COFF/PDB.cpp
168

We generally don't use std::map because it's slower than llvm::DenseMap and in most cases we don't need an ordered map (std::map is ordered). But this use may be okay because original code uses std::set. Or, we don't need to care about it at all if the number of data inserted into this map/set is small. Zach?

zturner accepted this revision.Sep 5 2018, 4:37 PM

It's probably fine because there's only going to be a handful of items in the map. I mildly prefer the LLVM ones, but I also don't care that much.

This revision is now accepted and ready to land.Sep 5 2018, 4:37 PM
This revision was automatically updated to reflect the committed changes.