зеркало из https://github.com/microsoft/clang-1.git
Driver: add support for new style multiarch in Ubuntu 13.04
Patch by Sanne Wouda. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176557 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6a19a97e57
Коммит
f2e7c35ade
|
@ -2597,7 +2597,7 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
|||
addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/include");
|
||||
}
|
||||
|
||||
/// \brief Helper to add the thre variant paths for a libstdc++ installation.
|
||||
/// \brief Helper to add the three variant paths for a libstdc++ installation.
|
||||
/*static*/ bool Linux::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
|
||||
const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args) {
|
||||
|
@ -2609,6 +2609,22 @@ void Linux::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
|
|||
return true;
|
||||
}
|
||||
|
||||
/// \brief Helper to add an extra variant path for an (Ubuntu) multilib
|
||||
/// libstdc++ installation.
|
||||
/*static*/ bool Linux::addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
|
||||
Twine TargetArchDir,
|
||||
Twine MultiLibSuffix,
|
||||
const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args) {
|
||||
if (!addLibStdCXXIncludePaths(Base+Suffix, TargetArchDir + MultiLibSuffix,
|
||||
DriverArgs, CC1Args))
|
||||
return false;
|
||||
|
||||
addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir + Suffix
|
||||
+ MultiLibSuffix);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args) const {
|
||||
if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
|
||||
|
@ -2636,8 +2652,14 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
|
|||
StringRef Version = GCCInstallation.getVersion().Text;
|
||||
StringRef TripleStr = GCCInstallation.getTriple().str();
|
||||
|
||||
if (addLibStdCXXIncludePaths(LibDir.str() + "/../include",
|
||||
"/c++/" + Version.str(),
|
||||
TripleStr,
|
||||
GCCInstallation.getMultiarchSuffix(),
|
||||
DriverArgs, CC1Args))
|
||||
return;
|
||||
|
||||
const std::string IncludePathCandidates[] = {
|
||||
LibDir.str() + "/../include/c++/" + Version.str(),
|
||||
// Gentoo is weird and places its headers inside the GCC install, so if the
|
||||
// first attempt to find the headers fails, try this pattern.
|
||||
InstallDir.str() + "/include/g++-v4",
|
||||
|
|
|
@ -501,6 +501,11 @@ public:
|
|||
std::vector<std::string> ExtraOpts;
|
||||
|
||||
private:
|
||||
static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
|
||||
Twine TargetArchDir,
|
||||
Twine MultiLibSuffix,
|
||||
const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args);
|
||||
static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
|
||||
const ArgList &DriverArgs,
|
||||
ArgStringList &CC1Args);
|
||||
|
|
|
@ -16,6 +16,34 @@
|
|||
// CHECK-UBUNTU-11-04: "-internal-externc-isystem" "[[SYSROOT]]/include"
|
||||
// CHECK-UBUNTU-11-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
|
||||
//
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
|
||||
// RUN: -target x86_64-unknown-linux-gnu \
|
||||
// RUN: --sysroot=%S/Inputs/ubuntu_13.04_multiarch_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-13-04 %s
|
||||
// CHECK-UBUNTU-13-04: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
|
||||
// CHECK-UBUNTU-13-04: "-isysroot" "[[SYSROOT:[^"]+]]"
|
||||
// CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7"
|
||||
// CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward"
|
||||
// CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7"
|
||||
// CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
|
||||
// CHECK-UBUNTU-13-04: "-internal-isystem" "{{.*}}/lib{{(64|32)?}}/clang/{{[0-9]\.[0-9]}}/include"
|
||||
// CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/x86_64-linux-gnu"
|
||||
// CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/include"
|
||||
// CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
|
||||
//
|
||||
// Test Ubuntu/Debian's new version of multiarch, with -m32.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
|
||||
// RUN: -target x86_64-unknown-linux-gnu -m32 \
|
||||
// RUN: --sysroot=%S/Inputs/ubuntu_13.04_multiarch_tree \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-13-04-M32 %s
|
||||
// CHECK-UBUNTU-13-04-M32: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
|
||||
// CHECK-UBUNTU-13-04-M32: "-triple" "i386-unknown-linux-gnu"
|
||||
// CHECK-UBUNTU-13-04-M32: "-isysroot" "[[SYSROOT:[^"]+]]"
|
||||
// CHECK-UBUNTU-13-04-M32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7"
|
||||
// CHECK-UBUNTU-13-04-M32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu/32"
|
||||
// CHECK-UBUNTU-13-04-M32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward"
|
||||
// CHECK-UBUNTU-13-04-M32: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7/32"
|
||||
//
|
||||
// Thoroughly exercise the Debian multiarch environment.
|
||||
// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
|
||||
// RUN: -target i686-linux-gnu \
|
||||
|
|
Загрузка…
Ссылка в новой задаче