Bug 510958

Summary: Overlapping .debug_ranges (C++)
Product: Red Hat Enterprise Linux 5 Reporter: Jan Kratochvil <jan.kratochvil>
Component: gcc44Assignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5.4CC: cww, jan.kratochvil, mnowak, pmuller, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gcc44-4.4.4-13.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 509124 Environment:
Last Closed: 2011-01-14 00:00:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 509124    
Attachments:
Description Flags
ascend.C reproducer from the customer. none

Description Jan Kratochvil 2009-07-12 20:52:44 UTC
Created attachment 351404 [details]
ascend.C reproducer from the customer.

+++ This bug was initially created as a clone of Bug #509124 +++

--- Additional comment from jan.kratochvil on 2009-07-09 15:52:36 EDT ---

(2) [->gcc]
Another problem is with the content of .debug_ranges offset 0x60 (DW_TAG_compile_unit).

eu-readelf displays these cases correctly - shown on an executable (not an object file) as the relocations get resolved there and it gets more visible:

DWARF section [35] '.debug_ranges' at offset 0x1190:
 [     0]  0x00000000004006bd <_ZN1CC2Ev+0x11>..0x00000000004006e5 <_ZN1CC2Ev+0x39>
           0x00000000004006f6 <_ZN1CC2Ev+0x4a>..0x000000000040070c <_ZN1CC1Ev>
 [    30]  0x000000000040071d <_ZN1CC1Ev+0x11>..0x0000000000400745 <_ZN1CC1Ev+0x39>
           0x0000000000400756 <_ZN1CC1Ev+0x4a>..0x000000000040076c <_ZN1A1fEv>
 [    60]  0x00000000004006ac <_ZN1CC2Ev>..0x000000000040076c <_ZN1A1fEv>
           0x000000000040076c <_ZN1A1fEv>..0x0000000000400776
           0x00000000004006ac <_ZN1CC2Ev>..0x000000000040070c <_ZN1CC1Ev>
           0x000000000040070c <_ZN1CC1Ev>..0x000000000040076c <_ZN1A1fEv>


One can see a real target binary problem in this case - the offset 0x60 has overlapping entries.  This is forbidden by DWARF3:
    http://dwarf.freestandards.org/Dwarf3.pdf 2.17.3
    Address range entries in a range list may not overlap.

This problem is reproducible on: gcc43-c++-4.3.2-7.el5.x86_64
This problem is reproducible on: gcc44-c++-4.4.0-6.el5.x86_64
But it is not reproducible on: gcc-c++-4.1.2-44.el5.x86_64

GCC produces:
        .quad   .Ltext0 # Offset 0x60
        .quad   .Letext0
        .quad   .LFB2   # Offset 0x70
        .quad   .LFE2
        .quad   .LFB5   # Offset 0x80
        .quad   .LFE5
        .quad   .LFB4   # Offset 0x90
        .quad   .LFE4
        .quad   0x0
        .quad   0x0

but .LFB5 .. .LFE5 and .LFB4 .. .LFE4 lay inside .text (.Ltext0 .. .Letext0).

This problem produces the readelf message:
readelf: Warning: There is an overlap [0xb0 - 0x0] in .debug_ranges section.


Fixed by Jakub upstream:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40713#c2

Requested as a part of the binutils Bug 509124 - issue 313140.

Comment 1 Jakub Jelinek 2009-07-13 15:09:22 UTC
As the fix already is in redhat/gcc-4_4-branch, it will be automatically solved when gcc44 is updated.

Comment 2 RHEL Program Management 2009-11-06 18:46:50 UTC
This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Comment 7 errata-xmlrpc 2011-01-14 00:00:14 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0102.html