changeset 1658:38b18a4707dd

More ccwrap debugging. "-" is an argument, not an option. Actually fall through to process --doubledash version of -singledash options. The -rpath-link line has the same visiblity as -L since it's link time path modification.
author Rob Landley <rob@landley.net>
date Fri, 20 Jun 2014 21:05:44 -0500
parents 84e47eac0f28
children 56b1418d6fc7
files sources/toys/ccwrap2.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sources/toys/ccwrap2.c	Fri Jun 20 06:02:12 2014 -0500
+++ b/sources/toys/ccwrap2.c	Fri Jun 20 21:05:44 2014 -0500
@@ -253,7 +253,7 @@
     if (!strcmp(c, "--")) SET_FLAG(Cdashdash);
 
     // is this an option?
-    if (*c == '-' && !GET_FLAG(Cdashdash)) c++;
+    if (*c == '-' && c[1] && !GET_FLAG(Cdashdash)) c++;
     else {
       srcfiles++;
       continue;
@@ -264,11 +264,13 @@
       // Passthrough double dash versions of single-dash options.
       if (!strncmp(c, "-print-", 7) || !strncmp(c, "-static", 7)
           || !strncmp(c, "-shared", 7)) c++;
-      else if (!strcmp(c, "-no-ctors")) {
-        CLEAR_FLAG(CPctordtor);
-        keepc--;
+      else {
+        if (!strcmp(c, "-no-ctors")) {
+          CLEAR_FLAG(CPctordtor);
+          keepc--;
+        }
+        continue;
       }
-      continue;
     }
 
     // -M and -MM imply -E and thus no linking.
@@ -387,13 +389,13 @@
       // Zab defaults, add dynamic linker
       outv[outc++] = "-nostdlib";
       outv[outc++] = GET_FLAG(Cstatic) ? "-static" : dynlink;
+
       // Copy libraries to output (first move fallback to end, break circle)
       libs = libs->next->next;
       libs->prev->next = 0;
       for (; libs; libs = libs->next)
         outv[outc++] = xmprintf("-L%s", libs->str);
-      if (GET_FLAG(Cstdlib))
-        outv[outc++] = xmprintf("-Wl,-rpath-link,%s/lib", topdir); // TODO: in?
+      outv[outc++] = xmprintf("-Wl,-rpath-link,%s/lib", topdir); // TODO: in?
 
       // TODO: -fprofile-arcs
       if (GET_FLAG(Cprofile)) xmprintf("%s/lib/gcrt1.o", topdir);