[PATCH] D74776: [Hexagon] clang driver should consider --sysroot option when looking for includes
Sid Manning via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 18 12:26:50 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfaa889b23587: [Hexagon] clang driver should consider --sysroot option (authored by sidneym).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74776/new/
https://reviews.llvm.org/D74776
Files:
clang/lib/Driver/ToolChains/Hexagon.cpp
clang/test/Driver/hexagon-toolchain-elf.c
Index: clang/test/Driver/hexagon-toolchain-elf.c
===================================================================
--- clang/test/Driver/hexagon-toolchain-elf.c
+++ clang/test/Driver/hexagon-toolchain-elf.c
@@ -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"
Index: clang/lib/Driver/ToolChains/Hexagon.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Hexagon.cpp
+++ clang/lib/Driver/ToolChains/Hexagon.cpp
@@ -540,6 +540,13 @@
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");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74776.245237.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200218/0624d85b/attachment.bin>
More information about the cfe-commits
mailing list