Bug 367491 - -feliminate-dwarf2-dups generates _larger_ output
-feliminate-dwarf2-dups generates _larger_ output
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
x86_64 Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-11-05 16:17 EST by Jan Kratochvil
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-11-25 16:55:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
.tar.gz containing: ooo-dups.patch, dup0.c + dup1.c + dup.h (20.61 KB, patch)
2007-11-05 16:17 EST, Jan Kratochvil
no flags Details | Diff

  None (edit)
Description Jan Kratochvil 2007-11-05 16:17:19 EST
Description of problem:
Used -feliminate-dwarf2-dups to reduce debuginfo but it got much larger instead.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. patch fedora/openoffice.org/devel/openoffice.org.spec with ooo-dups.patch.
2. koji-build it: http://koji.fedoraproject.org/koji/taskinfo?taskID=225515

Actual results:
After removing the constant src files:
  rm -rf `find -name src`
The sum of bytes:
orig:  1313604736
built: 2452898960 (187% size of the original!)

There is still a lot of `DW.*' symbols like:
   54: 0000000000000085      0 NOTYPE  LOCAL  DEFAULT       29 DW.dup.h.d6c8bc4d.0
They can be harmlessly stripped by:
  strip -w -N "DW.*" *.debug

DW.*-stripped: 1442298539 (110% size of the original!)

Expected results:
<=100% size of the original.

Additional info:
I saw there also duplicite Compilation Units (not in the attached dup* example
but in the openoffice.org build):
  Compilation Unit @ offset 0x0:
   Length:        476
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  8
 <0><b>: Abbrev Number: 10 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0
     DW_AT_high_pc     : 0x758
     DW_AT_low_pc      : 0x710
     DW_AT_producer    : (indirect string, offset: 0x75): GNU C++ 4.1.2 20070925
(Red Hat 4.1.2-33)
     DW_AT_language    : 4      (C++)
     DW_AT_name        : (indirect string, offset: 0x43):
     DW_AT_comp_dir    : (indirect string, offset: 0x12d):

and in the same file:

  Compilation Unit @ offset 0x1e0:
   Length:        270
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  8
 <0><1eb>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_language    : 4      (C++)
     DW_AT_producer    : (indirect string, offset: 0x75): GNU C++ 4.1.2 20070925
(Red Hat 4.1.2-33)
     DW_AT_comp_dir    : (indirect string, offset: 0x12d):
     DW_AT_name        : (indirect string, offset: 0x43):

Unaware if this Compilation Units duplication counts for those whole 10% of the

The duplication-removal itself appears to be working there.

Not tested any other GCC version.
Going to update it but any comments are welcome.

ooo-dups.patch: openoffice.org .src.rpm patch for -feliminate-dwarf2-dups.

dup0.c + dup1.c + dup.h: Simple testcase:
  Reproduces the bogus DW.* symbol(s).
  The size of -feliminate-dwarf2-dups binary really gets smaller there, though.
  There are no duplicite Compilation Units seen.

orig{,.dump} vs. eliminated{,.dump}: Files extracted from the openoffice.org
build - the smallest files which grew using the options.
  Reproduces the bogus DW.* symbols.
  The size of -feliminate-dwarf2-dups binary gets larger than the original.
  There are duplicite Compilation Units seen.
Comment 1 Jan Kratochvil 2007-11-05 16:17:19 EST
Created attachment 248621 [details]
.tar.gz containing: ooo-dups.patch, dup0.c + dup1.c + dup.h
Comment 2 Jan Kratochvil 2007-11-25 16:55:30 EST
# They can be harmlessly stripped by:
#   strip -w -N "DW.*" *.debug

This is wrong as DWARF3 specifies:

# A debugging information entry that may be referenced by another compilation
# must have a global symbolic name.

Anyway closing this Bug - Nick Clifton started working on this general issue at
the elfutils branch com.redhat.elfutils.nickc.dwarftool.

Note You need to log in before you can comment on or make changes to this bug.