On Sun, Feb 2, 2025 at 8:57 PM Geeta Dora
<techsolutionsbydesi...@gmail.com> wrote:
>
>  Thank you.  I wanted to mention that on Linux, even when using a response 
> file, we still encounter the same issue if the response file exceeds 128KB in 
> size.
>
> Does this imply that GCC enforces a limit on individual command-line 
> arguments (including those in response files) such that no argument should 
> exceed 128KB?

There are some known issue with GCC not using response files in some
cases where it should be.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45749
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86030 (COLLECT_GCC_OPTIONS).

The problem is GCC sometimes unwraps the response file and then passes
those options either via the command line or via an environment
variable and there is a combined limit. GCC should be using response
files instead of passing directly via command line/env variables but
nobody has implemented that yet. There is a patch floating around
trying to fix COLLECT_GCC_OPTIONS but it has not been approved and
from what I remember reading the patch it was causing some testsuite
regressions (which should be fixed, IIRC the testcase needs to be
updated but I could be wrong).

Thanks,
Andrew Pinski

PS cross posting between these 3 lists is not a good idea and
gcc-bugs@ is for automated emails from bugzilla and not exactly looked
at.


>
> Best Regards,
> Geeta D
>
> On Mon, Feb 3, 2025 at 10:08 AM Andrew Pinski <pins...@gmail.com> wrote:
>>
>> On Sun, Feb 2, 2025 at 8:31 PM Geeta Dora via Gcc-bugs
>> <gcc-b...@gcc.gnu.org> wrote:
>> >
>> > Dear GCC Developers,
>> >
>> > I encountered an issue where GCC fails to compile when the total
>> > command-line argument
>> > size exceeds 128KB.
>> >
>> > In contrast, Clang can handle the same compilation scenario without issues.
>> >
>> > Is this a known limitation in GCC, and are there any workarounds or plans
>> > to address this?
>> > Would response files (e.g., @file) be recommended for cases like this?
>>
>> Yes a response file will solve this issue. The limit for command lines
>> is much smaller under windows and that is why they were done in the
>> first place to workaround the limitations there.
>>
>> >
>> > I'm looking forward to hearing your thoughts.
>> >
>> > Reproduction Steps: (Applicable to all versions of gcc)
>> >
>> > 1) echo 'int main() { return 0; }' > test.c
>> > 2) ARGS=$(perl -e 'print "-I/tmp " x 16384')
>> > 3) gcc test.c $ARGS -o test
>> >
>> > gcc: fatal error: cannot execute ‘/usr/lib/gcc/x86_64-linux-gnu/11/cc1’:
>> > execv: Argument list too long
>> > compilation terminated.
>> >
>> > However, clang can able to produce output.
>>
>> Well clang is not exactly a driver and links directly against the
>> front-ends so it does not need to call out to other programs*.
>>
>> *) The exception is the linker so you will run into issues there if
>> you have a lot of files to link against.
>>
>> Thanks,
>> Andrew Pinski
>>
>> >
>> > Best Regards,
>> > Geeta D

Reply via email to