Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 453575 - Large size difference in compiled library (and executable binaries) generated by compat-gcc-32-c++ and gcc-c++-3.4
Summary: Large size difference in compiled library (and executable binaries) generated...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc34
Version: 4.6
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-01 13:06 UTC by Steve
Modified: 2018-10-19 20:14 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-06-07 05:52:55 UTC
Target Upstream Version:


Attachments (Terms of Use)
readelf-wi.tar.gz mentioned in description (deleted)
2008-07-01 13:06 UTC, Steve
no flags Details
test_debug_info.cc mentioned in description (deleted)
2008-07-01 13:08 UTC, Steve
no flags Details
readelf-SW.tar.gz mentioned in description (deleted)
2008-07-01 13:10 UTC, Steve
no flags Details

Description Steve 2008-07-01 13:06:44 UTC
Description of problem:
------------------------- Original report ------------------------------
A customer is noticing extremely large file size differences when the same code
is compiled in RHEL 3 and RHEL 4.

* Compilation Options:
RHEL4: /usr/bin/g++ -g -Wno-deprecated -w -Wno-non-template-friend
RHEL3: /usr/bin/g++ -g -Wno-deprecated -w -Wno-non-template-friend

* built library Size Differences;
RHEL4
-rw-rw-r-- 1 jilee ngns 12352698 Apr 7 14:40 libGroups.so

RHEL3
-rw-rw-r-- 1 jilee ngns 5924409 Apr 7 14:34 libGroups.so

* %readelf -S
RHEL4
[27] .debug_info PROGBITS 00000000 1d461b 84c1a1 00 0 0 1

RHEL3
[26] .debug_info PROGBITS 00000000 1cab86 263afb 00 0 0 1

* GCC versions;

RHEL4: gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)

RHEL3: gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20)

For the information, if they don't use -g option, the size is similar. Even, if
they use -g1 the size gets smaller as well, the default option is -g2, and they
needs to use -g2 for their applications.

What could be causing this?

Regards,
David Joo
------------------------- Original report ------------------------------

Jakub replied to the tech-list post about this problem (pasted in the next
comment), which the customer provided with the issue tracker report. However,
I'm sorry, I couldn't extract a whole lot of information from the readelf output
that Jakub requested[1]

However, I did some testing myself, and noticed that even with simple (hello
world type) C++ code[2], all other parameters remaining the same[3], when
compat-gcc-32-c++ and gcc-c++-3.4 were used to compile the code on RHEL 4, the
differences are still large (the gcc34 binaries are almost twice as large as the
gcc32 binaries).

The major difference I noticed were:

a. There are 2 new sections in the gcc-3.4 generated binary -- the .debug_loc
and .debug_ranges sections, which were not present in the binary compiled using
gcc-3.2 (I could not figure out any gcc options to suppress the generation of
these extra sections).

b. The .debug_ranges section is present only in C++ binaries.

Following this I asked for the output of the command:

$ readelf -S -W <the library>

and also a copies of their library compiled with gcc32 as well as gcc34.

From the readelf output[4], I noticed that the largest contributor to the size
differences are the ".rodata", ".gcc_except_table", ".debug_abbrev" and
".debug_info" sections.

Since the customer is developing a space constrained version of application
based on our OS (try 40M as the space), double size of application is something
that they can't live with. Also, because of their application, they need to used
full debugging option, reducing the debug level is also not an option.

So, the customer would like to know:

a. The underlying cause for the size differences
b. What options can be used to reduce the differences between 3.2 and 3.4

regards,
- steve

[1] attachment named readelf-wi.tar.gz
[2] attachment named test_debug_info.cc
[3] ie: Compilation options: "-g -Os'
[4] attachment named readelf-SW.tar.gz

Comment 1 Steve 2008-07-01 13:06:46 UTC
Created attachment 310659 [details]
readelf-wi.tar.gz mentioned in description

Comment 3 Steve 2008-07-01 13:08:35 UTC
Created attachment 310660 [details]
test_debug_info.cc mentioned in description

Comment 4 Steve 2008-07-01 13:10:08 UTC
Created attachment 310661 [details]
readelf-SW.tar.gz mentioned in description

Comment 9 RHEL Product and Program Management 2008-10-31 16:46:25 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 "?".


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