<div dir="ltr">Adding Reid, Michal<div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 6, 2017 at 5:01 AM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@gmail.com" target="_blank">benny.kra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sat, Mar 4, 2017 at 12:20 AM, Pirama Arumuga Nainar via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: pirama<br>
> Date: Fri Mar 3 17:20:49 2017<br>
> New Revision: 296927<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=296927&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=296927&view=rev</a><br>
> Log:<br>
> Add arch-specific directory to search path<br>
><br>
> Summary:<br>
><br>
> This change adds an arch-specific subdirectory in <ResourceDir>/lib/<OS><br>
> to the linker search path. This path also gets added as '-rpath' for<br>
> native compilation if a runtime is linked in as a shared object. This<br>
> allows arch-specific libraries to be installed alongside clang.<br>
><br>
> Reviewers: danalbert, cbergstrom, javed.absar<br>
><br>
> Subscribers: srhines<br>
><br>
> Differential Revision: <a href="https://reviews.llvm.org/D30015" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D30015</a><br>
><br>
> Added:<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/aarch64/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/aarch64/.keep<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/arm/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/arm/.keep<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/i386/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/i386/.keep<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/x86_64/<br>
> cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/x86_64/.keep<br>
> cfe/trunk/test/Driver/arch-<wbr>specific-libdir-rpath.c<br>
> cfe/trunk/test/Driver/arch-<wbr>specific-libdir.c<br>
> Modified:<br>
> cfe/trunk/include/clang/<wbr>Driver/ToolChain.h<br>
> cfe/trunk/lib/Driver/<wbr>ToolChain.cpp<br>
> cfe/trunk/lib/Driver/Tools.cpp<br>
> cfe/trunk/test/lit.cfg<br>
><br>
> Modified: cfe/trunk/include/clang/<wbr>Driver/ToolChain.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=296927&r1=296926&r2=296927&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Driver/ToolChain.h?rev=<wbr>296927&r1=296926&r2=296927&<wbr>view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/include/clang/<wbr>Driver/ToolChain.h (original)<br>
> +++ cfe/trunk/include/clang/<wbr>Driver/ToolChain.h Fri Mar 3 17:20:49 2017<br>
> @@ -299,6 +299,11 @@ public:<br>
> const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,<br>
> StringRef Component,<br>
> bool Shared = false) const;<br>
> +<br>
> + // Returns <ResourceDir>/lib/<OSName>/<<wbr>arch>. This is used by runtimes (such<br>
> + // as OpenMP) to find arch-specific libraries.<br>
> + std::string getArchSpecificLibPath() const;<br>
> +<br>
> /// needsProfileRT - returns true if instrumentation profile is on.<br>
> static bool needsProfileRT(const llvm::opt::ArgList &Args);<br>
><br>
><br>
> Modified: cfe/trunk/lib/Driver/<wbr>ToolChain.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=296927&r1=296926&r2=296927&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Driver/<wbr>ToolChain.cpp?rev=296927&r1=<wbr>296926&r2=296927&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Driver/<wbr>ToolChain.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/<wbr>ToolChain.cpp Fri Mar 3 17:20:49 2017<br>
> @@ -10,6 +10,7 @@<br>
> #include "clang/Driver/ToolChain.h"<br>
> #include "Tools.h"<br>
> #include "clang/Basic/ObjCRuntime.h"<br>
> +#include "clang/Basic/<wbr>VirtualFileSystem.h"<br>
> #include "clang/Config/config.h"<br>
> #include "clang/Driver/Action.h"<br>
> #include "clang/Driver/Driver.h"<br>
> @@ -74,6 +75,10 @@ ToolChain::ToolChain(const Driver &D, co<br>
> if (!isThreadModelSupported(A-><wbr>getValue()))<br>
> D.Diag(diag::err_drv_invalid_<wbr>thread_model_for_target)<br>
> << A->getValue() << A->getAsString(Args);<br>
> +<br>
> + std::string CandidateLibPath = getArchSpecificLibPath();<br>
> + if (getVFS().exists(<wbr>CandidateLibPath))<br>
> + getFilePaths().push_back(<wbr>CandidateLibPath);<br>
> }<br>
><br>
> ToolChain::~ToolChain() {<br>
> @@ -320,6 +325,14 @@ const char *ToolChain::getCompilerRTArgS<br>
> return Args.MakeArgString(<wbr>getCompilerRT(Args, Component, Shared));<br>
> }<br>
><br>
> +std::string ToolChain::<wbr>getArchSpecificLibPath() const {<br>
> + SmallString<128> Path(getDriver().ResourceDir);<br>
> + StringRef OSLibName = getTriple().isOSFreeBSD() ? "freebsd" : getOS();<br>
> + llvm::sys::path::append(Path, "lib", OSLibName,<br>
> + llvm::Triple::getArchTypeName(<wbr>getArch()));<br>
> + return Path.str();<br>
> +}<br>
> +<br>
> bool ToolChain::needsProfileRT(<wbr>const ArgList &Args) {<br>
> if (Args.hasFlag(options::OPT_<wbr>fprofile_arcs, options::OPT_fno_profile_arcs,<br>
> false) ||<br>
><br>
> Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=296927&r1=296926&r2=296927&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Driver/<wbr>Tools.cpp?rev=296927&r1=<wbr>296926&r2=296927&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Mar 3 17:20:49 2017<br>
> @@ -14,6 +14,7 @@<br>
> #include "clang/Basic/LangOptions.h"<br>
> #include "clang/Basic/ObjCRuntime.h"<br>
> #include "clang/Basic/Version.h"<br>
> +#include "clang/Basic/<wbr>VirtualFileSystem.h"<br>
> #include "clang/Config/config.h"<br>
> #include "clang/Driver/Action.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> @@ -238,8 +239,9 @@ static void AddLinkerInputs(const ToolCh<br>
><br>
> // LIBRARY_PATH - included following the user specified library paths.<br>
> // and only supported on native toolchains.<br>
> - if (!TC.isCrossCompiling())<br>
> + if (!TC.isCrossCompiling()) {<br>
> addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH");<br>
> + }<br>
> }<br>
><br>
> /// Add OpenMP linker script arguments at the end of the argument list so that<br>
> @@ -2000,6 +2002,19 @@ static void CollectArgsForIntegratedAsse<br>
> }<br>
> }<br>
><br>
> +static void addArchSpecificRPath(const ToolChain &TC, const ArgList &Args,<br>
> + ArgStringList &CmdArgs) {<br>
> + // In the cross-compilation case, arch-specific library path is likely<br>
> + // unavailable at runtime.<br>
> + if (TC.isCrossCompiling()) return;<br>
<br>
Why? This is fundamentally against the design of the clang driver. It<br>
should be always possible to use clang as a cross compiler and the<br>
existence of isCrossCompiling() is an accident of history. What's<br>
breaking without this check? Please either make this compatible with<br>
cross compilation or revert this patch.<br></blockquote><div><br></div><div>This is just a heuristic to prevent an rpath that is most likely unavailable at runtime from being embedded into an object. Michal suggested I add the rpath during review.</div><div><br></div><div>I'm happy to add the rpath in all cases, if that'd make the Driver behave consistently.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> +<br>
> + std::string CandidateRPath = TC.getArchSpecificLibPath();<br>
> + if (TC.getVFS().exists(<wbr>CandidateRPath)) {<br>
> + CmdArgs.push_back("-rpath");<br>
> + CmdArgs.push_back(Args.<wbr>MakeArgString(CandidateRPath.<wbr>c_str()));<br>
> + }<br>
> +}<br>
> +<br>
> static void addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC,<br>
> const ArgList &Args) {<br>
> if (!Args.hasFlag(options::OPT_<wbr>fopenmp, options::OPT_fopenmp_EQ,<br>
> @@ -2020,6 +2035,8 @@ static void addOpenMPRuntime(ArgStringLi<br>
> // Already diagnosed.<br>
> break;<br>
> }<br>
> +<br>
> + addArchSpecificRPath(TC, Args, CmdArgs);<br>
> }<br>
><br>
> static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,<br>
> @@ -2030,6 +2047,10 @@ static void addSanitizerRuntime(const To<br>
> if (IsWhole) CmdArgs.push_back("-whole-<wbr>archive");<br>
> CmdArgs.push_back(TC.<wbr>getCompilerRTArgString(Args, Sanitizer, IsShared));<br>
> if (IsWhole) CmdArgs.push_back("-no-whole-<wbr>archive");<br>
> +<br>
> + if (IsShared) {<br>
> + addArchSpecificRPath(TC, Args, CmdArgs);<br>
> + }<br>
> }<br>
><br>
> // Tries to use a file with the list of dynamic symbols that need to be exported<br>
> @@ -9002,6 +9023,8 @@ void gnutools::Linker::<wbr>ConstructJob(Comp<br>
> }<br>
> if (JA.isHostOffloading(Action::<wbr>OFK_OpenMP))<br>
> CmdArgs.push_back("-<wbr>lomptarget");<br>
> +<br>
> + addArchSpecificRPath(<wbr>ToolChain, Args, CmdArgs);<br>
> }<br>
><br>
> AddRunTimeLibs(ToolChain, D, CmdArgs, Args);<br>
><br>
> Added: cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/aarch64/.keep<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep?rev=296927&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/resource_dir_with_arch_<wbr>subdir/lib/linux/aarch64/.<wbr>keep?rev=296927&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> (empty)<br>
><br>
> Added: cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/arm/.keep<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep?rev=296927&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/resource_dir_with_arch_<wbr>subdir/lib/linux/arm/.keep?<wbr>rev=296927&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> (empty)<br>
><br>
> Added: cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/i386/.keep<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep?rev=296927&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/resource_dir_with_arch_<wbr>subdir/lib/linux/i386/.keep?<wbr>rev=296927&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> (empty)<br>
><br>
> Added: cfe/trunk/test/Driver/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/x86_64/.keep<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep?rev=296927&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/resource_dir_with_arch_<wbr>subdir/lib/linux/x86_64/.keep?<wbr>rev=296927&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> (empty)<br>
><br>
> Added: cfe/trunk/test/Driver/arch-<wbr>specific-libdir-rpath.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arch-specific-libdir-rpath.c?rev=296927&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>arch-specific-libdir-rpath.c?<wbr>rev=296927&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/Driver/arch-<wbr>specific-libdir-rpath.c (added)<br>
> +++ cfe/trunk/test/Driver/arch-<wbr>specific-libdir-rpath.c Fri Mar 3 17:20:49 2017<br>
> @@ -0,0 +1,50 @@<br>
> +// Test that the driver adds an arch-specific subdirectory in<br>
> +// {RESOURCE_DIR}/lib/linux to the linker search path and to '-rpath' for native<br>
> +// compilations.<br>
> +//<br>
> +// -rpath only gets added during native compilation. To keep the test simple,<br>
> +// just test for x86_64-linux native compilation.<br>
> +// REQUIRES: x86_64-linux<br>
> +//<br>
> +// Add LIBPATH but no RPATH for -fsanitizer=address w/o -shared-libasan<br>
> +// RUN: %clang %s -### 2>&1 -fsanitize=undefined \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>LIBPATH,NO-RPATH %s<br>
> +//<br>
> +// Add LIBPATH, RPATH for -fsanitize=address -shared-libasan<br>
> +// RUN: %clang %s -### 2>&1 -target x86_64-linux \<br>
> +// RUN: -fsanitize=address -shared-libasan \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>LIBPATH,RPATH %s<br>
> +//<br>
> +// Add LIBPATH, RPATH with -fsanitize=address for Android<br>
> +// RUN: %clang %s -### 2>&1 -target x86_64-linux-android -fsanitize=address \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>LIBPATH,RPATH %s<br>
> +//<br>
> +// Add LIBPATH, RPATH for OpenMP<br>
> +// RUN: %clang %s -### 2>&1 -fopenmp \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>LIBPATH,RPATH %s<br>
> +//<br>
> +// Add LIBPATH but no RPATH for ubsan (or any other sanitizer)<br>
> +// RUN: %clang %s -### 2>&1 -fsanitize=undefined \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>LIBPATH,NO-RPATH %s<br>
> +//<br>
> +// Add LIBPATH but no RPATH if no sanitizer or runtime is specified<br>
> +// RUN: %clang %s -### 2>&1 \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>LIBPATH,NO-RPATH %s<br>
> +//<br>
> +// Do not add LIBPATH or RPATH if arch-specific subdir doesn't exist<br>
> +// RUN: %clang %s -### 2>&1 \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,NO-<wbr>LIBPATH,NO-RPATH %s<br>
> +//<br>
> +//<br>
> +// FILEPATH: "-x" "c" "[[FILE_PATH:.*]]/{{.*}}.c"<br>
> +// LIBPATH: -L[[FILE_PATH]]/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/x86_64<br>
> +// RPATH: "-rpath" "[[FILE_PATH]]/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/x86_64"<br>
> +// NO-LIBPATH-NOT: -L{{.*}}Inputs/resource_dir<br>
> +// NO-RPATH-NOT: "-rpath" {{.*}}/Inputs/resource_dir<br>
><br>
> Added: cfe/trunk/test/Driver/arch-<wbr>specific-libdir.c<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arch-specific-libdir.c?rev=296927&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>arch-specific-libdir.c?rev=<wbr>296927&view=auto</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/Driver/arch-<wbr>specific-libdir.c (added)<br>
> +++ cfe/trunk/test/Driver/arch-<wbr>specific-libdir.c Fri Mar 3 17:20:49 2017<br>
> @@ -0,0 +1,53 @@<br>
> +// Test that the driver adds an arch-specific subdirectory in<br>
> +// {RESOURCE_DIR}/lib/linux to the search path.<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target i386-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>ARCHDIR-i386 %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target i386-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,NO-<wbr>ARCHDIR %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target i686-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>ARCHDIR-i386 %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target i686-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,NO-<wbr>ARCHDIR %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target x86_64-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>ARCHDIR-x86_64 %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target x86_64-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,NO-<wbr>ARCHDIR %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target arm-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>ARCHDIR-arm %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target arm-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,NO-<wbr>ARCHDIR %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target aarch64-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir_with_arch_subdir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,<wbr>ARCHDIR-aarch64 %s<br>
> +//<br>
> +// RUN: %clang %s -### 2>&1 -target aarch64-unknown-linux \<br>
> +// RUN: -resource-dir=%S/Inputs/<wbr>resource_dir \<br>
> +// RUN: | FileCheck --check-prefixes=FILEPATH,NO-<wbr>ARCHDIR %s<br>
> +//<br>
> +//<br>
> +// FILEPATH: "-x" "c" "[[FILE_PATH:.*]]/{{.*}}.c"<br>
> +// ARCHDIR-i386: -L[[FILE_PATH]]/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/i386<br>
> +// ARCHDIR-x86_64: -L[[FILE_PATH]]/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/x86_64<br>
> +// ARCHDIR-arm: -L[[FILE_PATH]]/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/arm<br>
> +// ARCHDIR-aarch64: -L[[FILE_PATH]]/Inputs/<wbr>resource_dir_with_arch_subdir/<wbr>lib/linux/aarch64<br>
> +//<br>
> +// Have a stricter check for no-archdir - that the driver doesn't add any<br>
> +// subdirectory from the provided resource directory.<br>
> +// NO-ARCHDIR-NOT: -L[[FILE_PATH]]/Inputs/<wbr>resource_dir<br>
><br>
> Modified: cfe/trunk/test/lit.cfg<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=296927&r1=296926&r2=296927&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/lit.<wbr>cfg?rev=296927&r1=296926&r2=<wbr>296927&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/lit.cfg (original)<br>
> +++ cfe/trunk/test/lit.cfg Fri Mar 3 17:20:49 2017<br>
> @@ -397,6 +397,10 @@ if platform.system() not in ['Darwin', '<br>
> if config.host_triple == config.target_triple:<br>
> config.available_features.add(<wbr>"native")<br>
><br>
> +# Test Driver/arch-specific-libdir-<wbr>rpath.c is restricted to x86_64-linux<br>
> +if re.match(r'^x86_64.*-linux', config.target_triple):<br>
> + config.available_features.add(<wbr>"x86_64-linux")<br>
> +<br>
> # Case-insensitive file system<br>
> def is_filesystem_case_<wbr>insensitive():<br>
> handle, path = tempfile.mkstemp(prefix='case-<wbr>test', dir=config.test_exec_root)<br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>