Bug 176413 - ld --as-needed behaviour changed
Summary: ld --as-needed behaviour changed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-12-22 13:16 UTC by Dmitry V. Levin
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-12-22 13:23:37 UTC
Type: ---
Embargoed:


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

Description Dmitry V. Levin 2005-12-22 13:16:46 UTC
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 13:16:46 UTC
Created attachment 122526 [details]
zv.c

Comment 2 Jakub Jelinek 2005-12-22 13:23:37 UTC
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 13:31:05 UTC
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.