This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] More detailed information for /failifmismatch
ClosedPublic

Authored by aganea on Mar 4 2019, 8:26 AM.

Details

Summary

When mismatched #pragma detect_mismatch declarations occur, now print the conflicting OBJs.

MSVC prints:

test2.obj : error LNK2038: mismatch detected for 'TEST': value '2' doesn't match value '1' in test.obj
test.exe : fatal error LNK1319: 1 mismatches detected

LLD now prints:

lld-link: error: /failifmismatch: mismatch detected for 'TEST':
>>> test.obj: has value 1
>>> test2.obj: has value 2

Fixes PR38579

Diff Detail

Repository
rL LLVM

Event Timeline

aganea created this revision.Mar 4 2019, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2019, 8:26 AM
aganea edited the summary of this revision. (Show Details)Mar 4 2019, 10:12 AM
ormris removed a subscriber: ormris.Mar 4 2019, 10:19 AM
rnk accepted this revision.Mar 5 2019, 3:10 PM

lgtm

test/COFF/Inputs/failmismatch1.bc
1 ↗(On Diff #189155)

Use the .ll file extension instead of .bc for textual IR files

This revision is now accepted and ready to land.Mar 5 2019, 3:10 PM
This revision was automatically updated to reflect the committed changes.
ruiu added inline comments.Mar 11 2019, 4:56 PM
lld/trunk/COFF/DriverUtils.cpp
701

In general, an error string that may be composed should be of type const Twine & instead of StringRef to avoid cost of string concatenation.

aganea marked an inline comment as done.Mar 15 2019, 6:08 AM
aganea added inline comments.
lld/trunk/COFF/DriverUtils.cpp
701

The Twine would need to be flattened anyway below, because it has to be stored as a value in Config->MustMatch.
As an alternative, I can pass a InputFile *Source instead as a parameter. Would you prefer that? Please see D59411.