From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 132273858C35; Mon, 6 May 2024 11:42:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 132273858C35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714995747; bh=YXRosC+GsPnwOhF2x967rCJ8UwM4JriNGt4OG/lO0dU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=I2qZ4DFE+R8g7K0ETuSDAfxDnr8XK3TnyxJS/rggnrkxuP4mw5JlDHEQqFaSYodZI FQoT7rmyxEjPf7SPNJBLfecDb5A/pT7h5KY0PoRKOGFwg8N9BhMob35jIZtwc4oAa9 LgSJT+Nd5SxzgllO1l+g1FywhsNrGD0V7mrIE8nk= From: "deepadeepthi98 at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: driver X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: deepadeepthi98 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111527 --- Comment #7 from Deepthi H --- We've a solution for this issue. When gcc/g++ is called using the @response-file.rsp syntax, gcc should forw= ard 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 b= uild environment's kernel's environment variable length limit. In this workaroun= d, environment variables longer than 128kb are split into multiple variables a= nd stitched back together in collect2. The patch is attached here.=20 And, the patch output of the example code given in 'Description' as below: =3D=3D=3D=3D=3D=3D=3D sunild@BFT-LPT-I-051:~$ $GCC_PATH/gcc -c a.c -DA=3D$big_100k_var -DB=3D$big_100k_var -v Using built-in specs. COLLECT_GCC=3D/home/sunild/GCC_Driver/bin/home/sunild/GCC_Driver/build/bin/= gcc Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=3D/home/sunild/GCC_Driver/build --enable-languages=3Dc --disable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.1 20240426 (experimental) (GCC) COLLECT_GCC_OPTIONS_0=3D'-c' '-D' 'A=3D00000000000000000000000000000000000000000000000000000000 COLLECT_GCC_OPTIONS_1=3D000000000000000000000000000000000000000000000000000= 000000000000000000 COLLECT_GCC_OPTIONS_COUNT=3D2 =3D=3D=3D=3D=3D=3D=3D Let us know your comments on this solution. Such a solution is acceptable to change the gcc driver?=