From c904778ea6e61e3584d8acd336212c9b2fb0bb75 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 15 Oct 2003 09:24:35 +0000 Subject: 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 --- extra/gcc-uClibc/gcc-uClibc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/gcc-uClibc/gcc-uClibc.c b/extra/gcc-uClibc/gcc-uClibc.c index 95abe8a3b..b08613006 100644 --- a/extra/gcc-uClibc/gcc-uClibc.c +++ b/extra/gcc-uClibc/gcc-uClibc.c @@ -178,6 +178,7 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) 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 @@ int main(int argc, char **argv) libraries[m] = '\0'; argv[i] = '\0'; break; + case 'x': /* Set target language */ + minusx = 1; + break; case 'v': /* verbose */ if (argv[i][2] == 0) verbose = 1; printf("Invoked as %s\n", argv[0]); @@ -435,6 +439,9 @@ int main(int argc, char **argv) #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 @@ crash_n_burn: } #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 { -- cgit v1.2.3