public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled
@ 2012-08-28 23:26 bugdal at aerifal dot cx
  2012-08-28 23:28 ` [Bug debug/54395] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bugdal at aerifal dot cx @ 2012-08-28 23:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

             Bug #: 54395
           Summary: DWARF tables should go in non-mapped section unless
                    exceptions are enabled
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bugdal@aerifal.cx


On systems where GCC uses DWARF for debugging information, the DWARF tables are
stored in the .eh_frame section, which the linker maps into the LOAD segment
for the program, and which is not safely strippable with the strip command
(because it messes up section numbering). This is of course necessary if
exceptions are enabled (for languages that require them, or for -fexceptions in
"GNU C" code), but it's harmful when they're not wanted. It would be nice if
GCC had a way to store a "purely for debugging" version of the tables in a
separate section that could safely be stripped, that would not get loaded in a
LOAD segment, and that would not artificially inflate the size(1) of the object
files (which is frustrating when trying to measure relative improvements in
optimizing the size of object files).

At present, -fno-asynchronous-unwind-tables -fno-unwind-tables can eliminate
the problem, but it also conflicts with debugging; it seems impossible to
generate object files that are debugging-enabled but that don't push (part of)
the debugging data into the mapped-at-runtime part of the program.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debug/54395] DWARF tables should go in non-mapped section unless exceptions are enabled
  2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
@ 2012-08-28 23:28 ` pinskia at gcc dot gnu.org
  2012-08-28 23:39 ` bugdal at aerifal dot cx
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-08-28 23:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-08-28 23:28:00 UTC ---
You need then also at runtime for doing a backtrace() which is why you need
then at runtime.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debug/54395] DWARF tables should go in non-mapped section unless exceptions are enabled
  2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
  2012-08-28 23:28 ` [Bug debug/54395] " pinskia at gcc dot gnu.org
@ 2012-08-28 23:39 ` bugdal at aerifal dot cx
  2012-08-28 23:40 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bugdal at aerifal dot cx @ 2012-08-28 23:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> 2012-08-28 23:38:49 UTC ---
I can see the argument that some users would want/need that, and perhaps even
that you want backtrace() to be available in the default configuration, but I
still think there should be a configuration where debugging works without
adding unstrippable tables in sections that will be mapped at runtime.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debug/54395] DWARF tables should go in non-mapped section unless exceptions are enabled
  2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
  2012-08-28 23:28 ` [Bug debug/54395] " pinskia at gcc dot gnu.org
  2012-08-28 23:39 ` bugdal at aerifal dot cx
@ 2012-08-28 23:40 ` pinskia at gcc dot gnu.org
  2012-08-28 23:52 ` bugdal at aerifal dot cx
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-08-28 23:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-08-28 23:40:11 UTC ---
Also these tables are part of the ABI so removing them will cause a break.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debug/54395] DWARF tables should go in non-mapped section unless exceptions are enabled
  2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
                   ` (2 preceding siblings ...)
  2012-08-28 23:40 ` pinskia at gcc dot gnu.org
@ 2012-08-28 23:52 ` bugdal at aerifal dot cx
  2012-08-29  6:04 ` [Bug debug/54395] GCC should be able to put DWARF tables in a non-mapped/strippable section for debug-only use jakub at gcc dot gnu.org
  2012-08-29 12:43 ` bugdal at aerifal dot cx
  5 siblings, 0 replies; 7+ messages in thread
From: bugdal at aerifal dot cx @ 2012-08-28 23:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

--- Comment #4 from Rich Felker <bugdal at aerifal dot cx> 2012-08-28 23:52:24 UTC ---
Would you care to elaborate on how it would break anything? They're already
easily removable with -fno-asynchronous-unwind-tables -fno-unwind-tables. The
problem is just that it's impossible to remove them and still have working
debugging (unless you want to revert to using stabs or something and adding
back a frame pointer...). My request is that it be possible to move them to a
strippable/non-mapped section to use them purely as debugging information and
not treat them as "part of the program".


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debug/54395] GCC should be able to put DWARF tables in a non-mapped/strippable section for debug-only use
  2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
                   ` (3 preceding siblings ...)
  2012-08-28 23:52 ` bugdal at aerifal dot cx
@ 2012-08-29  6:04 ` jakub at gcc dot gnu.org
  2012-08-29 12:43 ` bugdal at aerifal dot cx
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-08-29  6:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-08-29 06:04:41 UTC ---
If you for whatever crazy reason don't want .eh_frame emitted, just use
-fno-asynchronous-unwind-tables, and, if you have old binutils, also
-fno-dwarf2-cfi-asm (with recentish as which supports .cfi_sections, or very
old ones which don't support .cfi_* directives at all you don't need that
option).
Then with -g .debug_frame section is created instead of .eh_frame, the former
is non-allocated standard DWARF2+ section, the latter is an optimized version
thereof with GNU extensions for encoding addresses etc. and allocatable.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug debug/54395] GCC should be able to put DWARF tables in a non-mapped/strippable section for debug-only use
  2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
                   ` (4 preceding siblings ...)
  2012-08-29  6:04 ` [Bug debug/54395] GCC should be able to put DWARF tables in a non-mapped/strippable section for debug-only use jakub at gcc dot gnu.org
@ 2012-08-29 12:43 ` bugdal at aerifal dot cx
  5 siblings, 0 replies; 7+ messages in thread
From: bugdal at aerifal dot cx @ 2012-08-29 12:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54395

--- Comment #6 from Rich Felker <bugdal at aerifal dot cx> 2012-08-29 12:43:23 UTC ---
I seem to remember gcc -g -fno-asynchronous-unwind-tables -fno-unwind-tables
producing a warning that these options are incompatible and that debugging will
not work, but at the moment it seems to be doing the right thing. Was I
imagining things or are there some gcc versions where the combination is
problematic?

I'd like to investigate the situation/behavior a bit longer before closing this
bug, but it seems like you may have provided a solution. If this solution does
work, however, I still think the documentation is lacking; it's not clear that
these options would not remove the tables in a way that interferes with
debugging.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-29 12:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 23:26 [Bug debug/54395] New: DWARF tables should go in non-mapped section unless exceptions are enabled bugdal at aerifal dot cx
2012-08-28 23:28 ` [Bug debug/54395] " pinskia at gcc dot gnu.org
2012-08-28 23:39 ` bugdal at aerifal dot cx
2012-08-28 23:40 ` pinskia at gcc dot gnu.org
2012-08-28 23:52 ` bugdal at aerifal dot cx
2012-08-29  6:04 ` [Bug debug/54395] GCC should be able to put DWARF tables in a non-mapped/strippable section for debug-only use jakub at gcc dot gnu.org
2012-08-29 12:43 ` bugdal at aerifal dot cx

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).