Skip to content

Commit bd20fd8

Browse files
committed
clang: Use sysroot relative paths for getArchSpecificLibPaths and getRuntimePath
Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Khem Raj <[email protected]>
1 parent 71c72f6 commit bd20fd8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,10 @@ ToolChain::getTargetSubDirPath(StringRef BaseDir) const {
988988
}
989989

990990
std::optional<std::string> ToolChain::getRuntimePath() const {
991-
SmallString<128> P(D.ResourceDir);
991+
SmallString<128> P(D.SysRoot);
992+
StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
993+
llvm::sys::path::append(P, "/usr/", ClangLibdirBasename, "clang",
994+
CLANG_VERSION_STRING);
992995
llvm::sys::path::append(P, "lib");
993996
if (auto Ret = getTargetSubDirPath(P))
994997
return Ret;
@@ -1016,7 +1019,10 @@ ToolChain::path_list ToolChain::getArchSpecificLibPaths() const {
10161019
path_list Paths;
10171020

10181021
auto AddPath = [&](const ArrayRef<StringRef> &SS) {
1019-
SmallString<128> Path(getDriver().ResourceDir);
1022+
SmallString<128> Path(getDriver().SysRoot);
1023+
StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
1024+
llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
1025+
CLANG_VERSION_STRING);
10201026
llvm::sys::path::append(Path, "lib");
10211027
for (auto &S : SS)
10221028
llvm::sys::path::append(Path, S);

0 commit comments

Comments
 (0)