[Hexagon] clang driver should consider --sysroot option

Hexagon's clang driver should consider --sysroot option when setting
up include paths.

Differential Revision: https://reviews.llvm.org/D74776
This commit is contained in:
Sid Manning 2020-02-18 13:35:00 -06:00
parent a7dcbe90cc
commit faa889b235
2 changed files with 18 additions and 0 deletions

View File

@ -540,6 +540,13 @@ void HexagonToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
return;
const Driver &D = getDriver();
if (!D.SysRoot.empty()) {
SmallString<128> P(D.SysRoot);
llvm::sys::path::append(P, "include");
addExternCSystemInclude(DriverArgs, CC1Args, P.str());
return;
}
std::string TargetDir = getHexagonTargetDir(D.getInstalledDir(),
D.PrefixDirs);
addExternCSystemInclude(DriverArgs, CC1Args, TargetDir + "/hexagon/include");

View File

@ -577,3 +577,14 @@
// RUN: | FileCheck -check-prefix=CHECK082 %s
// CHECK082-NOT: -march=
// CHECK082-NOT: -mcpu=
// -----------------------------------------------------------------------------
// Passing --sysroot
// -----------------------------------------------------------------------------
// RUN: %clang -### -target hexagon-unknown-elf \
// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
// RUN: -mcpu=hexagonv60 \
// RUN: --sysroot=/hexagon \
// RUN: %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK083 %s
// CHECK083: "-isysroot" "/hexagon"
// CHECK083: "-internal-externc-isystem" "/hexagon/include"