public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "deepadeepthi98 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug driver/111527] COLLECT_GCC_OPTIONS option hits single-variable limits too early
Date: Mon, 06 May 2024 11:42:24 +0000	[thread overview]
Message-ID: <bug-111527-4-esLBcxu9Mf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111527-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111527

--- Comment #7 from Deepthi H <deepadeepthi98 at gmail dot com> ---
We've a solution for this issue.

When gcc/g++ is called using the @response-file.rsp syntax, gcc should forward
the argument to its subprocesses. Previously the files were expanded which
could lead to excessively long argument lists and 'cc1: execv: Argument list
too long' errors.

In particular, CMake and Ninja tend to create a lot of '-isystem' include
directories, requiring allowing the forwarding in spec files by using %@{i*}.

In xputenv method, If the ENV variable size greater then 128kb then we split
the ENV variable(i.e COLLECT_GCC_OPTIONS) where each chunk will be 128kb in
length.

GCC passes the entire command line, including expanded @rsp-files to the
collect2 in environment variable COLLECT_GCC_OPTIONS. This can exceed the build
environment's kernel's environment variable length limit. In this workaround,
environment variables longer than 128kb are split into multiple variables and
stitched back together in collect2.

The patch is attached here. 
And, the patch output of the example code given in 'Description' as below:

=======
sunild@BFT-LPT-I-051:~$ $GCC_PATH/gcc -c a.c -DA=$big_100k_var
-DB=$big_100k_var -v
Using built-in specs.
COLLECT_GCC=/home/sunild/GCC_Driver/bin/home/sunild/GCC_Driver/build/bin/gcc
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/sunild/GCC_Driver/build
--enable-languages=c --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240426 (experimental) (GCC)
COLLECT_GCC_OPTIONS_0='-c' '-D'
'A=00000000000000000000000000000000000000000000000000000000
COLLECT_GCC_OPTIONS_1=000000000000000000000000000000000000000000000000000000000000000000000
COLLECT_GCC_OPTIONS_COUNT=2

=======

Let us know your comments on this solution. Such a solution is acceptable to
change the gcc driver?

  parent reply	other threads:[~2024-05-06 11:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 19:06 [Bug driver/111527] New: " slyfox at gcc dot gnu.org
2023-09-22  5:22 ` [Bug driver/111527] " rguenth at gcc dot gnu.org
2023-09-22  8:15 ` slyfox at gcc dot gnu.org
2024-03-16  9:52 ` deepadeepthi98 at gmail dot com
2024-03-16  9:53 ` deepadeepthi98 at gmail dot com
2024-03-16 20:18 ` slyfox at gcc dot gnu.org
2024-05-06 11:39 ` deepadeepthi98 at gmail dot com
2024-05-06 11:42 ` deepadeepthi98 at gmail dot com [this message]
2024-05-06 16:02 ` pinskia at gcc dot gnu.org
2024-05-15 10:58 ` deepadeepthi98 at gmail dot com
2024-05-15 11:00 ` deepadeepthi98 at gmail dot com
2024-05-18 21:33 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111527-4-esLBcxu9Mf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).