[Driver][NetBSD] -r: imply -nostdlib like GCC
Similar to D116843 for Gnu.cpp Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D119655
This commit is contained in:
parent
cbd9d136ef
commit
d241ce0f97
@ -236,7 +236,8 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
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)) {
|
||||
if (!Args.hasArg(options::OPT_shared)) {
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
|
||||
@ -294,7 +295,8 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
}
|
||||
}
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
|
||||
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
|
||||
options::OPT_r)) {
|
||||
// Use the static OpenMP runtime with -static-openmp
|
||||
bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
|
||||
!Args.hasArg(options::OPT_static);
|
||||
@ -330,7 +332,8 @@ void netbsd::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_shared) || Args.hasArg(options::OPT_pie))
|
||||
CmdArgs.push_back(
|
||||
Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
|
||||
|
||||
@ -467,3 +467,11 @@
|
||||
// RUN: %clang -target powerpc-unknown-netbsd -### -c %s 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=POWERPC-SECUREPLT %s
|
||||
// POWERPC-SECUREPLT: "-target-feature" "+secure-plt"
|
||||
|
||||
// -r suppresses default -l and crt*.o like -nostdlib.
|
||||
// RUN: %clang -no-canonical-prefixes -target x86_64-unknown-netbsd -r \
|
||||
// RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
|
||||
// RUN: | FileCheck -check-prefix=RELOCATABLE %s
|
||||
// RELOCATABLE: "-r"
|
||||
// RELOCATABLE-NOT: "-l
|
||||
// RELOCATABLE-NOT: crt{{[^.]+}}.o
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user