]> granicus.if.org Git - clang/commitdiff
On linux, -nostdlib was causing a --start-group with no --end-group to be passed
authorNick Lewycky <nicholas@mxc.ca>
Sat, 4 Jun 2011 06:27:06 +0000 (06:27 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sat, 4 Jun 2011 06:27:06 +0000 (06:27 +0000)
to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132629 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/nostdlib.c [new file with mode: 0644]

index 695077058b970d8fd1b81630ae4f92f91d7575fc..87358cc4b065e32a72974b9a5a5a117a41a12e3d 100644 (file)
@@ -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 (file)
index 0000000..c73212f
--- /dev/null
@@ -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