From: Nick Lewycky Date: Sat, 4 Jun 2011 06:27:06 +0000 (+0000) Subject: On linux, -nostdlib was causing a --start-group with no --end-group to be passed X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80df02592ccc283b20b66959f74c6d61af28cadb;p=clang On linux, -nostdlib was causing a --start-group with no --end-group to be passed to the linker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132629 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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