forked from OSchip/llvm-project
[Driver][Minix] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D128554
This commit is contained in:
parent
da0448a361
commit
066043c84f
|
@ -56,7 +56,8 @@ void tools::minix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
assert(Output.isNothing() && "Invalid output.");
|
assert(Output.isNothing() && "Invalid output.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
|
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
|
||||||
|
options::OPT_r)) {
|
||||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
|
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
|
||||||
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
|
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
|
||||||
CmdArgs.push_back(
|
CmdArgs.push_back(
|
||||||
|
@ -71,7 +72,8 @@ void tools::minix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
|
|
||||||
getToolChain().addProfileRTLibs(Args, CmdArgs);
|
getToolChain().addProfileRTLibs(Args, CmdArgs);
|
||||||
|
|
||||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
|
||||||
|
options::OPT_r)) {
|
||||||
if (D.CCCIsCXX()) {
|
if (D.CCCIsCXX()) {
|
||||||
if (getToolChain().ShouldLinkCXXStdlib(Args))
|
if (getToolChain().ShouldLinkCXXStdlib(Args))
|
||||||
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
|
getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||||
|
@ -79,7 +81,8 @@ void tools::minix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
|
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
|
||||||
|
options::OPT_r)) {
|
||||||
if (Args.hasArg(options::OPT_pthread))
|
if (Args.hasArg(options::OPT_pthread))
|
||||||
CmdArgs.push_back("-lpthread");
|
CmdArgs.push_back("-lpthread");
|
||||||
CmdArgs.push_back("-lc");
|
CmdArgs.push_back("-lc");
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
// -r suppresses default -l and crt*.o like -nostdlib.
|
||||||
|
// RUN: %clang -### %s --target=i386-unknown-minix -r 2>&1 \
|
||||||
|
// RUN: | FileCheck %s --check-prefix=CHECK-RELOCATABLE
|
||||||
|
// CHECK-RELOCATABLE: "-r"
|
||||||
|
// CHECK-RELOCATABLE-NOT: "-l
|
||||||
|
// CHECK-RELOCATABLE-NOT: /crt{{[^.]+}}.o
|
Loading…
Reference in New Issue