]> granicus.if.org Git - clang/commitdiff
Add C/C++ header locations for the Freescale SDK.
authorHal Finkel <hfinkel@anl.gov>
Tue, 18 Sep 2012 22:25:07 +0000 (22:25 +0000)
committerHal Finkel <hfinkel@anl.gov>
Tue, 18 Sep 2012 22:25:07 +0000 (22:25 +0000)
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

lib/Driver/ToolChains.cpp
test/Driver/Inputs/freescale_ppc_tree/lib/.keep [new file with mode: 0644]
test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o [new file with mode: 0644]
test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o [new file with mode: 0644]
test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o [new file with mode: 0644]
test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o [new file with mode: 0644]
test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o [new file with mode: 0644]
test/Driver/linux-ld.c

index 0fd520284030ae4416cafd5199efd90dba9d57b6..2517b3093f8def50f93ed1b871f086a715c793b6 100644 (file)
@@ -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
+    // <sysroot>/usr/lib/<triple>/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 <sysroot>/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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
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 (file)
index 0000000..e69de29
index cb2efbbcf316a03f93971a28474da893d39859ff..c1bbd875f85df6da59352c3ba1bf68e830307163 100644 (file)
 // 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/../.."