r285140 - [Myriad] Find libc++ adjacent to libstdc++
Douglas Katzman via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 25 16:02:30 PDT 2016
Author: dougk
Date: Tue Oct 25 18:02:30 2016
New Revision: 285140
URL: http://llvm.org/viewvc/llvm-project?rev=285140&view=rev
Log:
[Myriad] Find libc++ adjacent to libstdc++
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/myriad-toolchain.c
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=285140&r1=285139&r2=285140&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Oct 25 18:02:30 2016
@@ -5169,18 +5169,13 @@ MyriadToolChain::MyriadToolChain(const D
}
if (GCCInstallation.isValid()) {
- // The contents of LibDir are independent of the version of gcc.
- // This contains libc, libg, libm, libstdc++, libssp.
- // The 'ma1x00' and 'nofpu' variants are irrelevant.
- SmallString<128> LibDir(GCCInstallation.getParentLibPath());
- llvm::sys::path::append(LibDir, "../sparc-myriad-elf/lib");
- addPathIfExists(D, LibDir, getFilePaths());
-
// This directory contains crt{i,n,begin,end}.o as well as libgcc.
// These files are tied to a particular version of gcc.
SmallString<128> CompilerSupportDir(GCCInstallation.getInstallPath());
addPathIfExists(D, CompilerSupportDir, getFilePaths());
}
+ // libstd++ and libc++ must both be found in this one place.
+ addPathIfExists(D, D.Dir + "/../sparc-myriad-elf/lib", getFilePaths());
}
MyriadToolChain::~MyriadToolChain() {}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=285140&r1=285139&r2=285140&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Oct 25 18:02:30 2016
@@ -11313,6 +11313,8 @@ void tools::Myriad::Linker::ConstructJob
!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
bool UseDefaultLibs =
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs);
+ // Silence warning if the args contain both -nostdlib and -stdlib=.
+ Args.getLastArg(options::OPT_stdlib_EQ);
if (T.getArch() == llvm::Triple::sparc)
CmdArgs.push_back("-EB");
@@ -11353,19 +11355,25 @@ void tools::Myriad::Linker::ConstructJob
if (UseDefaultLibs) {
if (NeedsSanitizerDeps)
linkSanitizerRuntimeDeps(TC, CmdArgs);
- if (C.getDriver().CCCIsCXX())
- CmdArgs.push_back("-lstdc++");
+ if (C.getDriver().CCCIsCXX()) {
+ if (TC.GetCXXStdlibType(Args) == ToolChain::CST_Libcxx) {
+ CmdArgs.push_back("-lc++");
+ CmdArgs.push_back("-lc++abi");
+ } else
+ CmdArgs.push_back("-lstdc++");
+ }
if (T.getOS() == llvm::Triple::RTEMS) {
CmdArgs.push_back("--start-group");
CmdArgs.push_back("-lc");
+ CmdArgs.push_back("-lgcc"); // circularly dependent on rtems
// You must provide your own "-L" option to enable finding these.
CmdArgs.push_back("-lrtemscpu");
CmdArgs.push_back("-lrtemsbsp");
CmdArgs.push_back("--end-group");
} else {
CmdArgs.push_back("-lc");
+ CmdArgs.push_back("-lgcc");
}
- CmdArgs.push_back("-lgcc");
}
if (UseStartfiles) {
CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=285140&r1=285139&r2=285140&view=diff
==============================================================================
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Tue Oct 25 18:02:30 2016
@@ -1,10 +1,11 @@
// RUN: %clang -no-canonical-prefixes -### -target sparc-myriad-rtems-elf %s \
+// RUN: -ccc-install-dir %S/Inputs/basic_myriad_tree/bin \
// RUN: --gcc-toolchain=%S/Inputs/basic_myriad_tree 2>&1 | FileCheck %s -check-prefix=LINK_WITH_RTEMS
// LINK_WITH_RTEMS: Inputs{{.*}}crti.o
// LINK_WITH_RTEMS: Inputs{{.*}}crtbegin.o
-// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2/../../..{{/|\\\\}}../sparc-myriad-elf/lib"
// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/lib/gcc/sparc-myriad-elf/4.8.2"
-// LINK_WITH_RTEMS: "--start-group" "-lc" "-lrtemscpu" "-lrtemsbsp" "--end-group" "-lgcc"
+// LINK_WITH_RTEMS: "-L{{.*}}Inputs/basic_myriad_tree/bin/../sparc-myriad-elf/lib"
+// LINK_WITH_RTEMS: "--start-group" "-lc" "-lgcc" "-lrtemscpu" "-lrtemsbsp" "--end-group"
// LINK_WITH_RTEMS: Inputs{{.*}}crtend.o
// LINK_WITH_RTEMS: Inputs{{.*}}crtn.o
More information about the cfe-commits
mailing list