Bug 176413 - ld --as-needed behaviour changed
ld --as-needed behaviour changed
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: binutils (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-12-22 08:16 EST by Dmitry V. Levin
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-12-22 08:23:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
zv.c (114 bytes, text/plain)
2005-12-22 08:16 EST, Dmitry V. Levin
no flags Details

  None (edit)
Description Dmitry V. Levin 2005-12-22 08:16:46 EST
The --as-needed behaviour seems to be changed in 2.16:

$ readelf -d /usr/lib/libz.so |grep -w NEEDED
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
$ readelf -d /usr/lib/libpng.so |grep -w NEEDED
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libm.so.6]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
$ gcc -Wall -W zv.c -c

When linking with old ld (binutils-2.15.94.0.2.2-2 from FC4):
$ gcc zv.o -o zv -Wl,--as-needed -lz
$ readelf -d zv |grep -w NEEDED
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
$ gcc zv.o -o zv -Wl,--as-needed -lpng
$ readelf -d zv |grep -w NEEDED
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]

When linking with new ld (binutils-2.16.91.0.3-2 from FC-devel):
$ gcc zv.o -o zv -Wl,--as-needed -lz
$ readelf -d zv |grep -w NEEDED
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
$ gcc zv.o -o zv -Wl,--as-needed -lpng
zv.o: In function `main':
zv.c:(.text+0x23): undefined reference to `zlibVersion'
collect2: ld returned 1 exit status

Despite of the fact that new behaviour better fits to documentation
(http://sourceware.org/ml/binutils/2005-05/msg00611.html),
I must say that old behaviour better fits to my needs.
Comment 1 Dmitry V. Levin 2005-12-22 08:16:46 EST
Created attachment 122526 [details]
zv.c
Comment 2 Jakub Jelinek 2005-12-22 08:23:37 EST
Yes, the behaviour changed, but why are you filling it as a bug here?
You are free to argue upstream about the change, but we as the distro aren't
going to diverge from upstream in this.
Comment 3 Dmitry V. Levin 2005-12-22 08:31:05 EST
1. To ensure this is really upstream change not yours since I tested your
packages.
2. To find out your opinion on this change.
3. For reference.

Sorry for (ab)using bugzilla.

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