[Driver] Fix rpath for compiler-rt
authorYaxun (Sam) Liu <yaxun.liu@amd.com>
Wed, 5 Apr 2023 23:38:37 +0000 (19:38 -0400)
committerYaxun (Sam) Liu <yaxun.liu@amd.com>
Thu, 6 Apr 2023 00:14:53 +0000 (20:14 -0400)
commit5f91c747763c20a63f3d6156fced03b474f842a1
tree6c06ee845c2adbb9f7b5440cf3c382d0b294a691
parentf79c037b63278bc5b4481a1a55c68e42f0ea1461
[Driver] Fix rpath for compiler-rt

The compiler-rt library path can be either {resource_dir}/lib/{triple}
or {resource_dir}/lib/{OS}/{arch} depending on whether
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default is ON or OFF.
Currently, the rpath added by -rtlib-add-rpath only adds
the latter. This patch checks both and adds the one that exists.

Reviewed by: Fangrui Song

Differential Revision: https://reviews.llvm.org/D146686
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/OHOS.cpp
clang/lib/Driver/ToolChains/OHOS.h
clang/lib/Driver/ToolChains/VEToolchain.cpp
clang/test/Driver/arch-specific-libdir-rpath.c