diff options
-rw-r--r-- | lib/Driver/Tools.cpp | 6 | ||||
-rw-r--r-- | test/Driver/nostdlib.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 695077058b..87358cc4b0 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3945,10 +3945,10 @@ void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-lm"); } - if (Args.hasArg(options::OPT_static)) - CmdArgs.push_back("--start-group"); - if (!Args.hasArg(options::OPT_nostdlib)) { + if (Args.hasArg(options::OPT_static)) + CmdArgs.push_back("--start-group"); + if (!D.CCCIsCXX) CmdArgs.push_back("-lgcc"); diff --git a/test/Driver/nostdlib.c b/test/Driver/nostdlib.c new file mode 100644 index 0000000000..c73212f895 --- /dev/null +++ b/test/Driver/nostdlib.c @@ -0,0 +1,4 @@ +// RUN: %clang -ccc-host-triple i686-pc-linux-gnu -### -nostdlib %s 2> %t +// RUN: FileCheck < %t %s +// +// CHECK-NOT: start-group |