[uClibc]Re: bogus change to gcc-uClibc?

Miles Bader miles at lsi.nec.co.jp
Mon Feb 25 08:57:04 UTC 2002


I spoke too soon; gcc-uClibc is broken in (at least) two other ways:

 (1) It uses the `-isystem' option incorrectly for specifying it's
     system include dirs, and

 (2) It doesn't work correctly when linking and also compiling with the
     same command
     (e.g. `cc -o foo foo.c', instead of `cc -c foo.c; cc -o foo foo.o')

The patch below attempts to fix these problems (as well as the issue
with -Wl, I mentioned in my previous email):


--- gcc-uClibc.c.~1.30.~	Mon Feb 25 10:49:33 2002
+++ gcc-uClibc.c	Mon Feb 25 17:48:01 2002
@@ -172,8 +172,8 @@ int main(int argc, char **argv)
 	xstrcat(&(rpath[0]), "-Wl,-rpath,", devprefix, "/lib", NULL);
 	xstrcat(&(rpath[1]), "-Wl,-rpath,", builddir, "/lib", NULL);
 
-	xstrcat(&(uClibc_inc[0]), "-isystem", devprefix, "/include/", NULL);
-	xstrcat(&(uClibc_inc[1]), "-isystem", builddir, "/include/", NULL);
+	xstrcat(&(uClibc_inc[0]), devprefix, "/include/", NULL);
+	xstrcat(&(uClibc_inc[1]), builddir, "/include/", NULL);
 
 	xstrcat(&(crt0_path[0]), devprefix, "/lib/crt0.o", NULL);
 	xstrcat(&(crt0_path[1]), builddir, "/lib/crt0.o", NULL);
@@ -291,10 +291,6 @@ int main(int argc, char **argv)
 			continue;
 		} else if (strstr(argv[j],static_linking) != NULL) {
 			continue;
-		} else if (strncmp("-Wl,",argv[j], 4) == 0) {
-		    continue;
-		} else if (strncmp("-v",argv[j], 2) == 0) {
-		    continue;
 		} else {
 			gcc_argument[k++] = argv[j];
 			gcc_argument[k] = '\0';
@@ -332,9 +328,25 @@ int main(int argc, char **argv)
 		if (use_start) {
 			gcc_argv[i++] = crt0_path[use_build_dir];
 		}
+	}
+
+	if (use_stdinc && source_count) {
+		gcc_argv[i++] = nostdinc;
+		gcc_argv[i++] = "-isystem";
+		gcc_argv[i++] = uClibc_inc[use_build_dir];
+		gcc_argv[i++] = "-isystem";
+		gcc_argv[i++] = GCC_INCDIR;
+		if (incstr) 
+			gcc_argv[i++] = incstr;
+	}
+
+	if (source_count) {
 		for ( l = 0 ; l < k ; l++ ) {
 			if (gcc_argument[l]) gcc_argv[i++] = gcc_argument[l];
 		}
+	}
+
+	if (linking && source_count) {
 		if (use_stdlib) {
 			//gcc_argv[i++] = "-Wl,--start-group";
 			gcc_argv[i++] = "-lgcc";
@@ -351,18 +363,8 @@ int main(int argc, char **argv)
 			//gcc_argv[i++] = GCC_LIB_DIR "crtn.o" ;
 		}
 #endif
-	} else {
-	    if (use_stdinc && source_count) {
-		gcc_argv[i++] = nostdinc;
-		gcc_argv[i++] = uClibc_inc[use_build_dir];
-		gcc_argv[i++] = "-isystem" GCC_INCDIR;
-		if( incstr )
-		    gcc_argv[i++] = incstr;
-	    }
-	    for ( l = 0 ; l < k ; l++ ) {
-		if (gcc_argument[l]) gcc_argv[i++] = gcc_argument[l];
-	    }
 	}
+
 	gcc_argv[i++] = NULL;
 
 	if (verbose) {


-Miles
-- 
Come now, if we were really planning to harm you, would we be waiting here, 
 beside the path, in the very darkest part of the forest?



More information about the uClibc mailing list