[PATCH] D74776: [Hexagon] clang driver should consider --sysroot option when looking for includes
Sid Manning via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 09:49:09 PST 2020
sidneym created this revision.
sidneym added reviewers: kparzysz, bcain.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Consider --sysroot when building the system c include paths.
Repository:
rG LLVM Github Monorepo
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.245188.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200218/065e675e/attachment.bin>
More information about the llvm-commits
mailing list