Bug 229703

Summary: RFE: use default hash-style=both instead of only gnu
Product: [Fedora] Fedora Reporter: Luciano Rocha <lfrocha+rhbugzilla>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-02-22 20:51:30 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:

Description Luciano Rocha 2007-02-22 20:45:17 UTC
Current binaries built on FC6 fail to execute on other systems due to using new
gnu hash style.

As it is possible to use both styles (gnu and sysv) on an executable, I suggest
change gcc default options to build with both styles.

Tests with kdebase.src.rpm show:

i. 1.2% increase in uncompressed size: +2MB to 169MB (output of rpm2cpio |
LANG=C wc -c)

ii. 0.95% *decrease* in compressed size: -712KB from 73.2MB (size of
kdebase-3.5.6-0.1.i386.rpm)

Interestingly, most libraries and executables in kdebase, if bigger than 200KB,
tend to compress better if compiled with hash-style=both than if compiled with
hash-style=gnu.

With this two interesting cases, and as hard-disks tend to be bigger and
cheaper, removable storage slower, and compatibility is usually a benefit, I
suggest that Fedora defaults to compile with both hash styles.

Of course, I suggest further testing. It could be limited to kdebase and/or to
my build system. I did the test by recompiling kdebase-3.5.6. The
hash-style=both test was used with the following change to %build:

%configure \
    CC="${CC:-gcc} -Wl,--hash-style=both" \
    CXX="${CXX:-g++} -Wl,--hash-style=both" \

Comment 1 Jakub Jelinek 2007-02-22 20:51:30 UTC
Feel free to build your binaries that you want to reuse on other distributions
with that option.  All FC6+ rpms built with -Wl,--hash-style=gnu have rpm
generated dependency on the proper glibc, so you can't mistakenly install
them on older distributions.  Generally, running binaries built for a newer
distro on older doesn't work anyway (new symbols added to glibc and other symbol
versioned libraries).

Comment 2 Luciano Rocha 2007-02-22 21:01:17 UTC
There were some instances of vendors shipping pre-compiled binaries that only
worked in Fedora (like syslinux). For some cases, like that one, there's no
dependency on newer glibc and other symbol versioned libraries. Only on the hash
style. Without the sysv style, the executables die imediatly on startup with
"Floating point exception". With it, they run fine.

For most complex programs, however, the dependency on glibc versioned libraries
will apply. But for the sake of the others, and for reducing the size of binary
RPMs, hash style default of both would be nice.

Anyway, it's only food for thought.