On 9 February 2017 at 14:33, Hal Finkel via cfe-commits < cfe-commits@lists.llvm.org> wrote:
> On 02/08/2017 07:21 PM, Chandler Carruth wrote: > > It's blast from the past time! > > On Tue, Sep 18, 2012 at 3:28 PM Hal Finkel <hfin...@anl.gov> wrote: > >> Author: hfinkel >> Date: Tue Sep 18 17:25:07 2012 >> New Revision: 164177 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=164177&view=rev >> Log: >> 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! >> >> Added: >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/ >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/ >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/ >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> powerpc-fsl-linux/ >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> powerpc-fsl-linux/4.6.2/ >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> powerpc-fsl-linux/4.6.2/crtbegin.o >> cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> powerpc-fsl-linux/4.6.2/crtend.o >> Modified: >> cfe/trunk/lib/Driver/ToolChains.cpp >> cfe/trunk/test/Driver/linux-ld.c >> >> Modified: cfe/trunk/lib/Driver/ToolChains.cpp >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ >> ToolChains.cpp?rev=164177&r1=164176&r2=164177&view=diff >> ============================================================ >> ================== >> --- cfe/trunk/lib/Driver/ToolChains.cpp (original) >> +++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Sep 18 17:25:07 2012 >> @@ -1291,6 +1291,10 @@ >> "/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(), >> > > So, this is really bad it turns out. > > We use this directory to walk every installed GCC version. But because > this is just a normal lib directory on many systems (ever Debian and Ubuntu > system for example) this goes very badly. It goes even more badly because > of the (questionable) design of LLVM's directory iterator: > > It ends up stat'ing *every single file* in /usr/lib/<triple> .... =[ For > the current Ubuntu LTS for example, this causes roughly 3900 spurrious stat > syscalls for every invocation of the Clang driver. > > Can we do something different here? > > > Wow. Hrmm, okay. Why are we stating every file? > That mistake seems to be baked into the design of llvm's directory_iterator. =( In any case, are we just searching for a directory with the right triple? > Or are we searching for the version-number directory and doing that by > looking at every entry? > The latter. > -Hal > > > > >> + >> // 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 @@ >> const std::string InstallSuffixes[] = { >> "/../../..", >> "/../../../..", >> + "/../..", >> "/../../../.." >> }; >> // Only look at the final, weird Ubuntu suffix for i386-linux-gnu. >> @@ -2374,6 +2379,9 @@ >> 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) { >> >> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> Inputs/freescale_ppc_tree/lib/.keep?rev=164177&view=auto >> ============================================================ >> ================== >> (empty) >> >> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> Inputs/freescale_ppc_tree/usr/lib/crt1.o?rev=164177&view=auto >> ============================================================ >> ================== >> (empty) >> >> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> Inputs/freescale_ppc_tree/usr/lib/crti.o?rev=164177&view=auto >> ============================================================ >> ================== >> (empty) >> >> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> Inputs/freescale_ppc_tree/usr/lib/crtn.o?rev=164177&view=auto >> ============================================================ >> ================== >> (empty) >> >> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> powerpc-fsl-linux/4.6.2/crtbegin.o >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/ >> crtbegin.o?rev=164177&view=auto >> ============================================================ >> ================== >> (empty) >> >> Added: cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/ >> powerpc-fsl-linux/4.6.2/crtend.o >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/ >> crtend.o?rev=164177&view=auto >> ============================================================ >> ================== >> (empty) >> >> Modified: cfe/trunk/test/Driver/linux-ld.c >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ >> linux-ld.c?rev=164177&r1=164176&r2=164177&view=diff >> ============================================================ >> ================== >> --- cfe/trunk/test/Driver/linux-ld.c (original) >> +++ cfe/trunk/test/Driver/linux-ld.c Tue Sep 18 17:25:07 2012 >> @@ -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/../.." >> >> >> _______________________________________________ >> cfe-commits mailing list >> cfe-comm...@cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > > -- > Hal Finkel > Lead, Compiler Technology and Programming Languages > Leadership Computing Facility > Argonne National Laboratory > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits