mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[Myriad]: Accept '-nostdlib' option
llvm-svn: 249166
This commit is contained in:
@@ -9760,6 +9760,8 @@ void tools::Myriad::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
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(Compilation &C, const JobAction &JA,
|
||||
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"));
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user