r249166 - [Myriad]: Accept '-nostdlib' option
Douglas Katzman via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 11:39:08 PDT 2015
Author: dougk
Date: Fri Oct 2 13:39:08 2015
New Revision: 249166
URL: http://llvm.org/viewvc/llvm-project?rev=249166&view=rev
Log:
[Myriad]: Accept '-nostdlib' option
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/myriad-toolchain.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=249166&r1=249165&r2=249166&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Oct 2 13:39:08 2015
@@ -9760,6 +9760,8 @@ void tools::Myriad::Linker::ConstructJob
const llvm::Triple &T = TC.getTriple();
ArgStringList CmdArgs;
bool UseStartfiles = !Args.hasArg(options::OPT_nostartfiles);
+ bool UseDefaultLibs = !Args.hasArg(options::OPT_nostdlib) &&
+ !Args.hasArg(options::OPT_nodefaultlibs);
std::string StartFilesDir, BuiltinLibDir;
TC.getCompilerSupportDir(StartFilesDir);
@@ -9796,27 +9798,31 @@ void tools::Myriad::Linker::ConstructJob
options::OPT_e, options::OPT_s, options::OPT_t,
options::OPT_Z_Flag, options::OPT_r});
- // The linker doesn't use these builtin paths unless directed to,
- // because it was not compiled for support with sysroots, nor does
- // it have a default of little-endian with FPU.
- CmdArgs.push_back(Args.MakeArgString("-L" + BuiltinLibDir));
- CmdArgs.push_back(Args.MakeArgString("-L" + StartFilesDir));
+ if (UseDefaultLibs) {
+ // The linker doesn't use these builtin paths unless directed to,
+ // because it was not compiled for support with sysroots, nor does
+ // it have a default of little-endian with FPU.
+ CmdArgs.push_back(Args.MakeArgString("-L" + BuiltinLibDir));
+ CmdArgs.push_back(Args.MakeArgString("-L" + StartFilesDir));
+ }
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
- if (T.getOS() == llvm::Triple::RTEMS) {
- CmdArgs.push_back("--start-group");
- CmdArgs.push_back("-lc");
- // 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");
+ if (UseDefaultLibs) {
+ if (T.getOS() == llvm::Triple::RTEMS) {
+ CmdArgs.push_back("--start-group");
+ CmdArgs.push_back("-lc");
+ // 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");
+ }
+ if (C.getDriver().CCCIsCXX())
+ CmdArgs.push_back("-lstdc++");
+ CmdArgs.push_back("-lgcc");
}
- if (C.getDriver().CCCIsCXX())
- CmdArgs.push_back("-lstdc++");
- CmdArgs.push_back("-lgcc");
if (UseStartfiles) {
CmdArgs.push_back(Args.MakeArgString(StartFilesDir + "/crtend.o"));
CmdArgs.push_back(Args.MakeArgString(StartFilesDir + "/crtn.o"));
Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=249166&r1=249165&r2=249166&view=diff
==============================================================================
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Fri Oct 2 13:39:08 2015
@@ -53,3 +53,7 @@
// RUN: %clang -target shave-myriad -c %s -o foo.o -### -MD -MF dep.d 2>&1 \
// RUN: | FileCheck %s -check-prefix=MDMF
// MDMF: "-S" "-MD" "-MF" "dep.d" "-MT" "foo.o"
+
+// RUN: %clang -target sparc-myriad -### -nostdlib %s 2>&1 | FileCheck %s --check-prefix=NOSTDLIB
+//
+// NOSTDLIB-NOT: "-lc"
More information about the cfe-commits
mailing list