[PATCH] D151188: [LLD][COFF] Add LLVM toolchain library paths by default.

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 13:06:23 PDT 2023


mstorsjo added a comment.

If link.exe does support relative paths in the embedded directives, lots of this plan should be quite good to go.

But for the cases with e.g. libc++ header pragmas, if we want to keep them working as before, we're in a trickier situation. As far as I can see that, we'd need to split it up into three parts:

1. `-libpath:${toolchain}/lib` - either explicitly on the command line or implied by the lld/WindowsDriver logic
2. `-relative-libpath:${triple}` - essentially a new directive or similar, as an embedded directive in the object files, generated by Clang. I presume link.exe doesn't have anything like that...
3. `-defaultlib:libc++.lib` - produced by the libc++ header pragmas

Or should Clang, given pragmas, try to resolve them and see if they need a relative path, so with `#pragma comment(lib, "c++.lib")`, it checks for `c++.lib` in `${toolchain}/lib/${triple}`, and if found there, embedding `-defaultlib:{triple}/c++.lib`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151188/new/

https://reviews.llvm.org/D151188



More information about the llvm-commits mailing list