This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/77576] New: gcc-ar doesn't work if all options are read from file
- From: "likan_999.student at sina dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 13 Sep 2016 04:09:46 +0000
- Subject: [Bug lto/77576] New: gcc-ar doesn't work if all options are read from file
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77576
Bug ID: 77576
Summary: gcc-ar doesn't work if all options are read from file
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: likan_999.student at sina dot com
Target Milestone: ---
For some build tools, they use @file intensively, i.e. putting command line
arguments into a file, and run
gcc-ar @some-file
This will break, basically due to these code snippet in gcc/gcc-ar.c:
if (is_ar && av[1] && av[1][0] != '-')
av[1] = concat ("-", av[1], NULL);
This basically says, if the first argument doesn't start with '-', prepend one
to it. So the command passes to underlying at is
ar --plugin=... -@some-file
and obviously ar doesn't recognize -@ as an option.
A quick and dirty fix would be changing the condition to
if (is_ar && av[1] && av[1][0] != '-' && av[1][0] != '@')
however, a better change would inspect the file content and prepend '-' to the
first argument. But that involves some bigger change.
Can anyone fix this?
Thanks.