This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [MinGW] Pass libpath to the COFF linker
ClosedPublic

Authored by mstorsjo on Oct 9 2018, 1:23 AM.

Details

Summary

This is necessary for handling defaultlib directives embedded in object files, unless they use an absolute path.

This is needed in all incarnations of D53012 and regardless of whether D53013 is picked or not.

Diff Detail

Repository
rL LLVM

Event Timeline

mstorsjo created this revision.Oct 9 2018, 1:23 AM
ruiu added a comment.Oct 9 2018, 6:30 AM

If you do this, do you still have to search library files in MinGW driver?

If you do this, do you still have to search library files in MinGW driver?

Yes, we still need to keep it there.

In order to move all of that into the COFF linker side, we'd need to extend the lld-link command line interface quite a bit. The MinGW linker takes -lfoo, which can either mean libfoo.a or libfoo.dll.a (unless the -Bstatic flag was passed). As lld-link today only takes full filenames, this doesn't fit right away as is. And we'd need the static flag of course. And the static flag isn't global but only affects any later -lfoo up until the next -Bdynamic.

ruiu accepted this revision.Oct 9 2018, 10:18 AM

LGTM

This revision is now accepted and ready to land.Oct 9 2018, 10:18 AM
This revision was automatically updated to reflect the committed changes.