[all-commits] [llvm/llvm-project] ccdebb: [Driver] Ensure ToolChain::LibraryPaths is not emp...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Apr 8 16:51:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ccdebbae4d77d3efc236af92c22941de5d437e01
      https://github.com/llvm/llvm-project/commit/ccdebbae4d77d3efc236af92c22941de5d437e01
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-04-08 (Mon, 08 Apr 2024)

  Changed paths:
    M clang/lib/Driver/ToolChain.cpp
    M clang/test/Driver/arm-compiler-rt.c
    M clang/test/Driver/cl-link.c
    M clang/test/Driver/compiler-rt-unwind.c
    M clang/test/Driver/coverage-ld.c
    M clang/test/Driver/instrprof-ld.c
    M clang/test/Driver/linux-ld.c
    M clang/test/Driver/mingw-sanitizers.c
    M clang/test/Driver/msp430-toolchain.c
    M clang/test/Driver/print-libgcc-file-name-clangrt.c
    M clang/test/Driver/print-runtime-dir.c
    M clang/test/Driver/riscv32-toolchain-extra.c
    M clang/test/Driver/riscv32-toolchain.c
    M clang/test/Driver/riscv64-toolchain-extra.c
    M clang/test/Driver/riscv64-toolchain.c
    M clang/test/Driver/sanitizer-ld.c
    M clang/test/Driver/wasm-toolchain.c
    M clang/test/Driver/wasm-toolchain.cpp
    M clang/test/Driver/windows-cross.c
    M clang/test/Driver/zos-ld.c
    M flang/test/Driver/msvc-dependent-lib-flags.f90

  Log Message:
  -----------
  [Driver] Ensure ToolChain::LibraryPaths is not empty for non-Darwin

Follow-up to #81037.

ToolChain::LibraryPaths holds the new compiler-rt library directory
(e.g. `/tmp/Debug/lib/clang/19/lib/x86_64-unknown-linux-gnu`). However,
it might be empty when the directory does not exist (due to the `if
(getVFS().exists(P))` change in https://reviews.llvm.org/D158475).

If neither the old/new compiler-rt library directories exists, we would
suggest the undesired old compiler-rt file name:

```
% /tmp/Debug/bin/clang++ a.cc -fsanitize=memory -o a
ld.lld: error: cannot open /tmp/Debug/lib/clang/19/lib/linux/libclang_rt.msan-x86_64.a: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```

With this change, we will correctly suggest the new compiler-rt file name.

Fix #87150

Pull Request: https://github.com/llvm/llvm-project/pull/87866



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list