This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [MinGW] Look for other library patterns with -l
ClosedPublic

Authored by mstorsjo on Oct 9 2019, 3:49 AM.

Details

Summary

GNU ld looks for a number of other patterns than just lib<name>.dll.a and lib<name>.a.

GNU ld does support linking directly against a DLL without using an import library. If that's the only match for a -l argument, point out that the user needs to use an import library, instead of leaving the user with a puzzling message about the -l argument not being found at all.

Also convert an existing case of fatal() into error().

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 9 2019, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 9 2019, 3:49 AM
rnk accepted this revision.Oct 9 2019, 1:55 PM

lgtm

This revision is now accepted and ready to land.Oct 9 2019, 1:55 PM
ruiu accepted this revision.Oct 9 2019, 7:40 PM

LGTM with this change.

lld/MinGW/Driver.cpp
145–146

It should be error instead of fatal, as our promise is that we use fatal only to report corrupted files.

mstorsjo updated this revision to Diff 224260.Oct 9 2019, 11:43 PM
mstorsjo edited the summary of this revision. (Show Details)

Changed to use error() instead of fatal() in the added lines of code, and in another place in the same function. Added an if (errorCount()) return false; at the end of the MinGW driver, to avoid actually trying to start the linking if errors were reported at this stage.

All other existing error reporting in the MinGW driver is still using fatal(), but changing that is a different matter.

ruiu accepted this revision.Oct 10 2019, 12:11 AM

LGTM

Using error instead of fatal is not a high priority matter for the MinGW driver because I believe users are using this driver as a command. But still it is better to use error because it is more like a contract as a library. So, can you make a follow-up change?

LGTM

Using error instead of fatal is not a high priority matter for the MinGW driver because I believe users are using this driver as a command. But still it is better to use error because it is more like a contract as a library. So, can you make a follow-up change?

I can try to make such a change a bit later, yes, but I've got a bit too many other things going on right now.

This revision was automatically updated to reflect the committed changes.