Change Native Client x86 usr include and link path to match SDK expectations
GNU multilib style uses x86_64-nacl/include and x86_64-nacl/usr/include
but the SDK expects i686-nacl/usr/include for its files. Change the driver
to use this.
Fixes https://code.google.com/p/nativeclient/issues/detail?id=4108
Differential Revision: http://reviews.llvm.org/D11271
llvm-svn: 246040
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index cb4ec03..cae992e 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -2328,7 +2328,7 @@
switch (Triple.getArch()) {
case llvm::Triple::x86: {
file_paths.push_back(FilePath + "x86_64-nacl/lib32");
- file_paths.push_back(FilePath + "x86_64-nacl/usr/lib32");
+ file_paths.push_back(FilePath + "i686-nacl/usr/lib");
prog_paths.push_back(ProgPath + "x86_64-nacl/bin");
file_paths.push_back(ToolPath + "i686-nacl");
break;
@@ -2380,12 +2380,21 @@
SmallString<128> P(D.Dir + "/../");
switch (getTriple().getArch()) {
+ case llvm::Triple::x86:
+ // x86 is special because multilib style uses x86_64-nacl/include for libc
+ // headers but the SDK wants i686-nacl/usr/include. The other architectures
+ // have the same substring.
+ llvm::sys::path::append(P, "i686-nacl/usr/include");
+ addSystemInclude(DriverArgs, CC1Args, P.str());
+ llvm::sys::path::remove_filename(P);
+ llvm::sys::path::remove_filename(P);
+ llvm::sys::path::remove_filename(P);
+ llvm::sys::path::append(P, "x86_64-nacl/include");
+ addSystemInclude(DriverArgs, CC1Args, P.str());
+ return;
case llvm::Triple::arm:
llvm::sys::path::append(P, "arm-nacl/usr/include");
break;
- case llvm::Triple::x86:
- llvm::sys::path::append(P, "x86_64-nacl/usr/include");
- break;
case llvm::Triple::x86_64:
llvm::sys::path::append(P, "x86_64-nacl/usr/include");
break;