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

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 06:20:12 PDT 2023


thieta added a comment.

I implemented a much nicer and easier method to just find the following three paths:

  <root>/lib
  <root>/lib/clang/XX/lib
  <root>/lib/clang/XX/lib/windows

This made the following work:

  bin\clang-cl.exe /c test.cpp -fsanitize=address -Xclang --dependent-lib=x86_64-pc-windows-msvc\clang_rt.asan.lib
  bin\lld-link.exe test.obj

It also worked with the non-per-target directories with another library name.

I think this feels much cleaner and without so much other code being dragged into lld.



================
Comment at: lld/COFF/Driver.cpp:468
 
-  bool hasPathSep = (filename.find_first_of("/\\") != StringRef::npos);
-  if (hasPathSep)
+  if (sys::path::is_absolute(filename))
     return getFilename(filename);
----------------
In order to get relative paths to work, I had to change this line. I am NOT sure what the original intent of this block was. It will make any relative path only return the filename. And none of the tests seems to cover this case, everything works after my change.

But if someone have a bit more context on this - I'll be happy to understand what's going on in this block.


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