[PATCH] pass @-files to collect2 and beyond

Mark Mitchell mark@codesourcery.com
Sun Apr 15 19:16:00 GMT 2007


Andrew Pinski wrote:
> On 4/13/07, Nathan Froyd <froydnj@codesourcery.com> wrote:
>> The attached patch adds special handling to the gcc driver and collect2
>> to pass @-file arguments to collect2 and subprocesses, respectively,
>> when they are passed @-file arguments.  The motivation behind this is to
>> avoid argv limits on some systems and/or large compiles.
> 
> Only problem is that if you do this, it will not work if you have a
> GCC that understands @ but an as/ld that does not understand @.  Maybe
> you need more magic than what you gave.

I don't think that's likely to be necessary.  Binutils has supported
response files for quite some time now.  And, most people get GCC and
Binutils as part of a single distribution.  And, if you're building your
own GCC, you can probably build your own Binutils to go with it.  In any
case, we can come back and address that later -- with appropriate
configury goo -- if necessary.

> Also I think you might need to quote arguments in the response files.
> That is:
> +              fprintf (temp_fp, "%s\n", outfiles[i]);
> Should be
> +              fprintf (temp_fp, "\"%s\"\n", outfiles[i]);
> 
> Also you have to make sure that '\' is translated to '"\\" when
> printing out the response file, otherwise it is treated as something
> different when reading it in.

Excellent point.

Nathan, the quoting rules are in libiberty/argv.c/buildargv; please
revise the patch to make it safe against quoting.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list