# HG changeset patch # User Rob Landley # Date 1403262132 18000 # Node ID 84e47eac0f280b7427aaefc9b16afea8677c2b03 # Parent 00928b6d7895cd2bdc714097087632671db2d947 First round of bug fixes for new ccwrap. diff -r 00928b6d7895 -r 84e47eac0f28 sources/toys/ccwrap2.c --- a/sources/toys/ccwrap2.c Thu Jun 19 05:58:51 2014 -0500 +++ b/sources/toys/ccwrap2.c Fri Jun 20 06:02:12 2014 -0500 @@ -111,6 +111,7 @@ { struct dlist *new = xmalloc(sizeof(struct dlist)); + new->str = str; if (*list) { new->next = *list; new->prev = (*list)->prev; @@ -149,9 +150,9 @@ }; #define MASK_BIT(X) (1<next->next; libs->prev->next = 0; - while (libs) outv[outc++] = xmprintf("-L%s", libs->str); + 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? @@ -403,13 +404,13 @@ } if (!GET_FLAG(Cprofile) && GET_FLAG(Cstart)) outv[outc++] = xmprintf("%s/lib/%scrt1.o", topdir, - GETFLAG(Cshared) ? "S" : ""); + GET_FLAG(Cshared) ? "S" : ""); } } // Copy unclaimed arguments memcpy(outv+outc, keepv, keepc*sizeof(char *)); - outv += outc; + outc += keepc; if (srcfiles && GET_FLAG(Clink)) { if (GET_FLAG(Cx)) outv[outc++] = "-xnone"; @@ -433,9 +434,9 @@ outv[outc++] = xmprintf("%s/lib/crtn.o", topdir); } } - outv[outc++] = 0; + outv[outc] = 0; -for(i=0; i