[Bug debug/68229] .debug_pubnames length field is too large

2017-08-03 Thread todd.allen at ccur dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68229

--- Comment #6 from Todd Allen  ---
They released a patch last year:

https://bugzilla.redhat.com/show_bug.cgi?id=1278872

[Bug debug/68229] New: .debug_pubnames length field is too large

2015-11-05 Thread todd.allen at ccur dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68229

Bug ID: 68229
   Summary: .debug_pubnames length field is too large
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: todd.allen at ccur dot com
  Target Milestone: ---

Created attachment 36659
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36659&action=edit
Example program

For C programs that use system header files (those rarities :) the length field
of .debug_pubnames is too large.  Obviously, this requires -gpubnames.

The problem occurs if there are enum types in the system header files that are
not marked for emission in the object file.  size_of_pubnames() still counts
them, but output_pubnames() does not emit them.  So the size ends up being too
large.

This is a big problem for dwarf readers because, when reading a linked
executable, they will use the length field for the contribution from one object
file to determine the location of the contribution for the next object file. 
If it's wrong, they can skip whole contributions and possibly (likely) end up
at a random byte in the middle of some subsequent contribution.

I'll include an example.  This example is small enough that the result is that
the contribution from the second object file is skipped entirely and it
overruns the end of the section.  It would require a few more object files
before there was enough material for it to end up in the middle of a subsequent
contribution.

[Bug debug/68229] .debug_pubnames length field is too large

2015-11-05 Thread todd.allen at ccur dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68229

--- Comment #1 from Todd Allen  ---
Created attachment 36660
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36660&action=edit
Patch to correct gcc 4.8.2

This patch was against gcc-4.8.2-16.2.el7_0 from RHEL 7.0.  But it should be
pretty clear how it applies to vanilla gcc.  In fact, it might just apply with
slight line number differences.

[Bug debug/68229] .debug_pubnames length field is too large

2015-11-05 Thread todd.allen at ccur dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68229

--- Comment #2 from Todd Allen  ---
Yeah, the patch code is clumsy.  I wrote it that way to mirror the use of a
continue in output_pubnames().

[Bug debug/68229] .debug_pubnames length field is too large

2015-11-06 Thread todd.allen at ccur dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68229

--- Comment #4 from Todd Allen  ---
It appears to have been fixed in gcc-4.9.0 by Sterling Augustine, 2013-07-25,
with the new include_pubname_in_output function.  I don't have a 4.9.0
compiler, but I did test it with gcc-4.9.2 on Fedora 21, and that worked.  I'll
take up the issue with RedHat, since it's RHEL 7.0 that provides gcc-4.8.x
still.