public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35925] New: -g1 causes "Error: file number 1 already allocated"
@ 2008-04-13 17:29 mrs at mythic-beasts dot com
2008-04-14 23:56 ` [Bug debug/35925] " wilson at gcc dot gnu dot org
2008-04-29 21:03 ` mrs at mythic-beasts dot com
0 siblings, 2 replies; 3+ messages in thread
From: mrs at mythic-beasts dot com @ 2008-04-13 17:29 UTC (permalink / raw)
To: gcc-bugs
$ echo "void foo(void) { }" >test.c
$ gcc -g1 -S test.c
$ gcc -g1 -c test.s
test.s: Assembler messages:
test.s:79: Error: file number 1 already allocated
If "-g1" is changed to "-g", "-g0" or "-g2", or is removed, the error goes
away.
This causes problems when building glibc with CFLAGS="-g1". glibc's configure
script invokes gcc as above in order to test whether --noexecstack is
available. It gets an error and wrongly concludes that --noexecstack is not
available, which means libc.so doesn't get the benefit of a non-executable
stack.
Is this supposed to work, or should glibc work around it, perhaps by not
passing CFLAGS to the second invocation of gcc?
--
Summary: -g1 causes "Error: file number 1 already allocated"
Product: gcc
Version: 4.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mrs at mythic-beasts dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35925
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug debug/35925] -g1 causes "Error: file number 1 already allocated"
2008-04-13 17:29 [Bug c/35925] New: -g1 causes "Error: file number 1 already allocated" mrs at mythic-beasts dot com
@ 2008-04-14 23:56 ` wilson at gcc dot gnu dot org
2008-04-29 21:03 ` mrs at mythic-beasts dot com
1 sibling, 0 replies; 3+ messages in thread
From: wilson at gcc dot gnu dot org @ 2008-04-14 23:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from wilson at gcc dot gnu dot org 2008-04-14 23:56 -------
There is a conflict between the gcc and gas debug info support here. This
can't be fixed in gcc. It will have to be fixed in binutils.
-g1 tells gcc to emit debug info, but not line number info. We do emit file
and line number info for function definitions. This involves emitting a .file
1 "tmp.c" directive to add an entry to the dwarf2 file table.
-g tells gas to try to emit debug info. Gas sees that there is no line number
info, and so tries to generate some itself. However, gas is allocating entries
from the same dwarf2 file table that gcc is allocating from, leading to
conflicts. Since gcc runs first, gcc can't avoid the conflicts.
I can make this work for a trivial example if I change gcc to emit the .file
directive for function info earlier. However, this doesn't solve the problem,
it just delays it. If I change the testcase so that it includes another source
file, then it fails again, this time complaining that file number 2 is already
used. This one is impossible to fix in gcc.
Binutils needs to be changed to either not emit line number debug info for a
file compiled with gcc -g1, or else to allocate virtual file numbers for its
debug info, and then only give them physical file numbers when it is finished
parsing the entire file, and hence knows how many file numbers that gcc used.
I suggest filing a bug with the binutils folks pointing back at this bug
report.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35925
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug debug/35925] -g1 causes "Error: file number 1 already allocated"
2008-04-13 17:29 [Bug c/35925] New: -g1 causes "Error: file number 1 already allocated" mrs at mythic-beasts dot com
2008-04-14 23:56 ` [Bug debug/35925] " wilson at gcc dot gnu dot org
@ 2008-04-29 21:03 ` mrs at mythic-beasts dot com
1 sibling, 0 replies; 3+ messages in thread
From: mrs at mythic-beasts dot com @ 2008-04-29 21:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mrs at mythic-beasts dot com 2008-04-29 21:02 -------
Thanks for the explanation. I have filed a bug on glibc with a simple
workaround (http://sources.redhat.com/bugzilla/show_bug.cgi?id=6428). Changing
binutils is not necessary to fix glibc's configure check.
--
mrs at mythic-beasts dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35925
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-04-29 21:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-13 17:29 [Bug c/35925] New: -g1 causes "Error: file number 1 already allocated" mrs at mythic-beasts dot com
2008-04-14 23:56 ` [Bug debug/35925] " wilson at gcc dot gnu dot org
2008-04-29 21:03 ` mrs at mythic-beasts dot com
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).