This is an archive of the discontinued LLVM Phabricator instance.

Report an error if you try to link against .dll instead of .lib.
ClosedPublic

Authored by ruiu on Mar 1 2018, 12:51 PM.

Details

Summary

It is a usage error to feed a .dll file instead of a .dll to COFF linker.
Previously, lld failed with a mysterious error message. Now we reject
it at the driver.

Fixes https://bugs.llvm.org/show_bug.cgi?id=36440

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Mar 1 2018, 12:51 PM
smeenai added a subscriber: smeenai.Mar 1 2018, 1:58 PM

"It is a usage error to feed a .dll file instead of a .dll to COFF linker"

Should be

"It is a usage error to feed a .dll file instead of a .lib to COFF linker"

Do you think it's worth printing a nicer error for the specific case of DLLs (something that tells the user they should be linking against the import library instead)? In particular, binutils supports linking against DLLs directly (it synthesizes an import library on the fly), so a nicer error message could be helpful for users coming from that toolchain.

lld/COFF/Driver.cpp
135 ↗(On Diff #136589)

Is it standard LLVM or LLD coding style to not have the newlines?

ruiu updated this revision to Diff 136611.Mar 1 2018, 2:49 PM
  • show a better error message
smeenai accepted this revision.Mar 1 2018, 3:08 PM

LGTM

lld/COFF/Driver.cpp
161 ↗(On Diff #136611)

Nit: I'd prefer "Did you specify a DLL instead of an import library?" (DLL file -> DLL, import file -> import library)

This revision is now accepted and ready to land.Mar 1 2018, 3:08 PM
This revision was automatically updated to reflect the committed changes.