public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug driver/111527] New: COLLECT_GCC_OPTIONS option hits single-variable limits too early Date: Thu, 21 Sep 2023 19:06:00 +0000 [thread overview] Message-ID: <bug-111527-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111527 Bug ID: 111527 Summary: COLLECT_GCC_OPTIONS option hits single-variable limits too early Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Tl;DR: linux allows you to pass up to 2MB of command line arguments to the tools limiting each individual option to 128KB. Unfortunately `gcc` collects all the options into a single `COLLECT_GCC_OPTIONS` variable and hits the smaller 128KB limit. This causes periodic problems for distributions that install each individual package into a separate directory. One of them is `NixOS`. Could `gcc` be amended not to use single limiting `COLLECT_GCC_OPTIONS` variable and use, say, direct arguments to pass options around? Or even use response file if it hits `-E2BIG`? Fake reproducer: 2 huge variables that programs normally accept, but not `gcc`: $ big_100k_var=$(printf "%0*d" 100000 0) # this works: 200KB of options for `printf` external command $ $(which printf) "%s %s" $big_100k_var $big_100k_var >/dev/null; echo $? 0 # this fails: 200KB of options for `gcc`, fails in `cc1` $ touch a.c; gcc -c a.c -DA=$big_100k_var -DB=$big_100k_var gcc: fatal error: cannot execute 'cc1': execv: Argument list too long compilation terminated. Thanks! MOre words In `nixpkgs` repository each package gets installed into it's own unique directory: /nix/store/hash1-foo/include/foo.h /nix/store/hash2-bar/include/bar.h ... If any of those encounter `__FILE__` macros in static inline functions they usually embed full path to header files into final binaries as is. I wanted to remap all those paths into form that does not contain hashes: -fmacro-prefix-map=/nix/store/hash1-foo/include/foo.h=/nix/store/00000000-foo/include/foo.h -fmacro-prefix-map=/nix/store/hash2-bar/include/bar.h=/nix/store/00000000-bar/include/bar.h ... When I got to packages that use about ~100 include directories I started getting errors from `cc1`: ``` Command line: `gcc -m64 -mcx16 $remap_options /build/qemu-8.1.0/build/meson-private/tmpbyikv8nc/testfile.c \ -o /build/qemu-8.1.0/build/meson-private/tmpbyikv8nc/output.exe -D_FILE_OFFSET_BITS=64 \ -O0 -Wl,--start-group -laio -Wl,--end-group -Wl,--allow-shlib-undefined` -> 1 stderr: gcc: fatal error: cannot execute 'cc1': execv: Argument list too long compilation terminated. ``` The limit felt too low and I found the `COLLECT_GCC_OPTIONS` variable.
next reply other threads:[~2023-09-21 19:06 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-21 19:06 slyfox at gcc dot gnu.org [this message] 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 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@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: linkBe 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).