From: Hal Finkel Date: Tue, 18 Sep 2012 22:25:07 +0000 (+0000) Subject: Add C/C++ header locations for the Freescale SDK. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02014b485394cc93e0a2bd386e94424a5707ea69;p=clang Add C/C++ header locations for the Freescale SDK. The Freescale SDK is based on OpenEmbedded, and this might be useful for other OpenEmbedded-based configurations as well. With minor modifications, patch by Tobias von Koch! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164177 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 0fd5202840..2517b3093f 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1291,6 +1291,10 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( "/gcc/" + CandidateTriple.str(), "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(), + // The Freescale PPC SDK has the gcc libraries in + // /usr/lib//x.y.z so have a look there as well. + "/" + CandidateTriple.str(), + // Ubuntu has a strange mis-matched pair of triples that this happens to // match. // FIXME: It may be worthwhile to generalize this and look for a second @@ -1300,6 +1304,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( const std::string InstallSuffixes[] = { "/../../..", "/../../../..", + "/../..", "/../../../.." }; // Only look at the final, weird Ubuntu suffix for i386-linux-gnu. @@ -2374,6 +2379,9 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, InstallDir.str() + "/include/g++-v4", // Android standalone toolchain has C++ headers in yet another place. LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(), + // Freescale SDK C++ headers are directly in /usr/include/c++, + // without a subdirectory corresponding to the gcc version. + LibDir.str() + "/../include/c++", }; for (unsigned i = 0; i < llvm::array_lengthof(IncludePathCandidates); ++i) { diff --git a/test/Driver/Inputs/freescale_ppc_tree/lib/.keep b/test/Driver/Inputs/freescale_ppc_tree/lib/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o b/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index cb2efbbcf3..c1bbd875f8 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -462,3 +462,23 @@ // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.." // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib" // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib" +// +// Test linker invocation for Freescale SDK (OpenEmbedded). +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target powerpc-fsl-linux \ +// RUN: --sysroot=%S/Inputs/freescale_ppc_tree \ +// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC %s +// CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-FSL-PPC: "-m" "elf32ppclinux" +// CHECK-FSL-PPC: "{{.*}}/crt1.o" +// CHECK-FSL-PPC: "{{.*}}/crtbegin.o" +// CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target powerpc64-fsl-linux \ +// RUN: --sysroot=%S/Inputs/freescale_ppc64_tree \ +// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC64 %s +// CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-FSL-PPC64: "-m" "elf64ppc" +// CHECK-FSL-PPC64: "{{.*}}/crt1.o" +// CHECK-FSL-PPC64: "{{.*}}/crtbegin.o" +// CHECK-FSL-PPC64: "-L[[SYSROOT]]/usr/lib64/powerpc64-fsl-linux/4.6.2/../.."