[PATCH] D151188: [lld] Find resource and lib dir

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 01:15:39 PDT 2023


thieta added a comment.

Hi! This is the first draft of what we discussed at EuroLLVM - to let LLD find the runtime and lib dir to integrate sanitizers easier and libc++ on Windows.

This patch is not done, but I wanted to open it early because there are some discussion points - specifically:

- LLD doesn't know the full triple, which we need to find the directory where the runtimes or libraries are located when building the runtimes with PER_TARGET_DIRECTORY. I added code to synthesize the triple from some options in LLD, but it feels a little icky. I don't know if you guys have any thoughts on that.
- The way lld finds libraries seems to happen very early, so unless the user specifies /machine:x64, the libraries won't be seen because we haven't parsed any object files and extracted the target machine yet. One thought I had here was to try to find the libraries early, and if we don't see a library, we can wait until we have parsed an object file, extracted the machine, and then tried to refind those libraries we failed to find. But I wanted to make sure that this is the path we want to take.
- I don't think we can extract the straight logic for finding the paths from the clang driver (it's pretty well nestled in there), so I ended up more or less rewriting the code in WindowsDriver - not sure how to get that logic back into the clang driver yet, maybe we could call it from the MSVC/MingW drivers instead of keeping it in the base Driver/toolchain.

With the current patch above I was able to do:

`bin\lld-link.exe test.obj -wholearchive:clang_rt.asan.lib -wholearchive:clang_rt.asan_cxx.lib /machine:x64` and it found the runtimes without any additional arguments.


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