[uClibc] RE: [uClibc-cvs] uClibc/extra/gcc-uClibc gcc-uClibc.c, 1.62, 1.63

Peter Kjellerstedt peter.kjellerstedt at axis.com
Wed Oct 15 11:39:20 UTC 2003


> -----Original Message-----
> From: Erik Andersen [mailto:andersen at uclibc.org] 
> Sent: 15 October 2003 11:25
> To: uclibc-cvs at uclibc.org
> Subject: [uClibc-cvs] uClibc/extra/gcc-uClibc gcc-uClibc.c,1.62,1.63
> 
> Update of /var/cvs/uClibc/extra/gcc-uClibc
> In directory winder:/tmp/cvs-serv31426/extra/gcc-uClibc
> 
> Modified Files:
> 	gcc-uClibc.c 
> Log Message:
> Brett Nash writes:
> 
> Hello,
>         Attached is a patch of some changes I made to the gcc 
> wrapper to
> get it to compile XFree CVS.
> 
> Basically it supports the use of '-' on the command line to read stdin
> for gcc, as well as setting the file type back to none before 
> adding the
> last too .o files if the file type was set on the command line.
> 
> It is applied against uClibc-0.9.20
> 
>         Regards,
>         nash
> 
> 
> 
> Index: gcc-uClibc.c
> ===================================================================
> RCS file: /var/cvs/uClibc/extra/gcc-uClibc/gcc-uClibc.c,v
> retrieving revision 1.62
> retrieving revision 1.63
> diff -u -d -r1.62 -r1.63
> --- gcc-uClibc.c	28 Aug 2003 05:51:04 -0000	1.62
> +++ gcc-uClibc.c	15 Oct 2003 09:24:35 -0000	1.63
> @@ -178,6 +178,7 @@
>  	int use_build_dir = 0, linking = 1, use_static_linking = 0;
>  	int use_stdinc = 1, use_start = 1, use_stdlib = 1, use_pic = 0;
>  	int source_count = 0, use_rpath = 0, verbose = 0;
> +	int minusx = 0;
>  	int i, j, k, l, m, n;
>  	char ** gcc_argv;
>  	char ** gcc_argument;
> @@ -316,7 +317,7 @@
>  	libpath[n] = '\0';
>  
>  	for ( i = 1 ; i < argc ; i++ ) {
> -		if (argv[i][0] == '-') { /* option */
> +		if (argv[i][0] == '-' && argv[i][1] != 0) { /* option */
>  			switch (argv[i][1]) {
>  				case 'c':		/* compile or
assemble */
>  				case 'S':		/* generate
assembler code */
> @@ -339,6 +340,9 @@
>  					libraries[m] = '\0';
>  					argv[i] = '\0';
>  					break;
> +				case 'x': 		/* Set target
language */
> +					minusx = 1;

Shouldn't the argument to -x be ignored? 
Otherwise it will be treated as a source file... 
I.e., I believe an i++ is needed here too.

> +					break;
>  				case 'v':		/* verbose */
>  					if (argv[i][2] == 0) verbose =
1;
>  					printf("Invoked as %s\n",
argv[0]);
> @@ -435,6 +439,9 @@
>  #endif
>  					break;
>  			}
> +		} else if (argv[i][0] == '-' && argv[i][1] == 0){
> +			/* Reading code from stdin - crazy eh? */
> +			++source_count;
>  		} else {				/* assume it is
an existing source file */
>  			++source_count;
>  		}
> @@ -623,6 +630,10 @@
>  		}
>  #ifdef __UCLIBC_CTOR_DTOR__
>  		if (ctor_dtor) {
> +			if (minusx != 0){
> +				gcc_argv[i ++] = "-x";
> +				gcc_argv[i ++] = "none";
> +			}
>  			if (use_pic) {
>  				gcc_argv[i++] = crtend_path[1];
>  			} else {



More information about the uClibc mailing list