Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 453575

Summary: Large size difference in compiled library (and executable binaries) generated by compat-gcc-32-c++ and gcc-c++-3.4
Product: Red Hat Enterprise Linux 4 Reporter: Steve <sfernand>
Component: gcc34Assignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 4.6CC: jwest, marcobillpeter, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-06-07 05:52:55 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:
Attachments:
Description Flags
readelf-wi.tar.gz mentioned in description
none
test_debug_info.cc mentioned in description
none
readelf-SW.tar.gz mentioned in description none

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 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 "?".