forked from OSchip/llvm-project
[Driver] Support GCC detection for GCC compiled with --enable-version-specific-runtime-libs
GCC's compiled with --enable-version-specific-runtime-libs change the paths where includes and libs are found. This patch adds support for these cases Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D118700
This commit is contained in:
parent
f978497d67
commit
ca80c24386
|
@ -2803,6 +2803,11 @@ void Generic_GCC::AddMultilibPaths(const Driver &D,
|
|||
D, GCCInstallation.getInstallPath() + SelectedMultilib.gccSuffix(),
|
||||
Paths);
|
||||
|
||||
// Add lib/gcc/$triple/$libdir
|
||||
// For GCC built with --enable-version-specific-runtime-libs.
|
||||
addPathIfExists(D, GCCInstallation.getInstallPath() + "/../" + OSLibDir,
|
||||
Paths);
|
||||
|
||||
// GCC cross compiling toolchains will install target libraries which ship
|
||||
// as part of the toolchain under <prefix>/<triple>/<libdir> rather than as
|
||||
// any part of the GCC installation in
|
||||
|
@ -2981,6 +2986,15 @@ bool Generic_GCC::addGCCLibStdCxxIncludePaths(
|
|||
TripleStr, Multilib.includeSuffix(), DriverArgs, CC1Args))
|
||||
return true;
|
||||
|
||||
// Try /gcc/$triple/$version/include/c++/ (gcc --print-multiarch is not
|
||||
// empty). Like above but for GCC built with
|
||||
// --enable-version-specific-runtime-libs.
|
||||
if (addLibStdCXXIncludePaths(LibDir.str() + "/gcc/" + TripleStr + "/" +
|
||||
Version.Text + "/include/c++/",
|
||||
TripleStr, Multilib.includeSuffix(), DriverArgs,
|
||||
CC1Args))
|
||||
return true;
|
||||
|
||||
// Detect Debian g++-multiarch-incdir.diff.
|
||||
if (addLibStdCXXIncludePaths(LibDir.str() + "/../include/c++/" + Version.Text,
|
||||
DebianMultiarch, Multilib.includeSuffix(),
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// RUN: %clangxx %s -### -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs_multilib --target=x86_64-redhat-linux 2>&1 | FileCheck %s -check-prefix=X64-STDCPLUS
|
||||
// RUN: %clangxx %s -### -stdlib=libc++ --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs_multilib --target=x86_64-redhat-linux 2>&1 | FileCheck %s -check-prefix=X64-LIBCPLUS
|
||||
// RUN: %clangxx %s -m32 -### -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs_multilib --target=x86_64-redhat-linux 2>&1 | FileCheck %s -check-prefix=X32-STDCPLUS
|
||||
// RUN: %clangxx %s -m32 -### -stdlib=libc++ --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs_multilib --target=x86_64-redhat-linux 2>&1 | FileCheck %s -check-prefix=X32-LIBCPLUS
|
||||
|
||||
int main() {}
|
||||
|
||||
// X64-STDCPLUS: "-internal-isystem" "{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++/"
|
||||
// X64-STDCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0"
|
||||
// X64-STDCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../lib64"
|
||||
|
||||
// X64-LIBCPLUS-NOT: "-internal-isystem" "{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++/"
|
||||
// X64-LIBCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0"
|
||||
// X64-LIBCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../lib64"
|
||||
|
||||
// X32-STDCPLUS: "-internal-isystem" "{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++/"
|
||||
// X32-STDCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/32"
|
||||
// X32-STDCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../lib32"
|
||||
|
||||
// X32-LIBCPLUS-NOT: "-internal-isystem" "{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++/"
|
||||
// X32-LIBCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/32"
|
||||
// X32-LIBCPLUS: "-L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../lib32"
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clangxx %s -### -stdlib=libstdc++ --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs --target=x86_64-redhat-linux 2>&1 | FileCheck %s -check-prefix=STDCPLUS
|
||||
// RUN: %clangxx %s -### -stdlib=libc++ --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs --target=x86_64-redhat-linux 2>&1 | FileCheck %s -check-prefix=LIBCPLUS
|
||||
|
||||
int main() {}
|
||||
|
||||
// STDCPLUS: "-internal-isystem" "{{[^ ]*}}gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++/"
|
||||
// STDCPLUS: "-L{{.*}}gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux/10.2.0"
|
||||
// STDCPLUS: "-L{{.*}}gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux/10.2.0/../lib64"
|
||||
|
||||
// LIBCPLUS-NOT: "-internal-isystem" "{{[^ ]*}}gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++/"
|
||||
// LIBCPLUS: "-L{{.*}}gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux/10.2.0"
|
||||
// LIBCPLUS: "-L{{.*}}gcc_version_parsing_rt_libs/lib/gcc/x86_64-redhat-linux/10.2.0/../lib64"
|
Loading…
Reference in New Issue