http://sourceware.org/bugzilla/show_bug.cgi?id=14826

             Bug #: 14826
           Summary: ld flag --as-needed do not remove extra link
           Product: binutils
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassig...@sourceware.org
        ReportedBy: bioinfornat...@fedoraproject.org
    Classification: Unclassified


Hi,


with a simple file libFoo.d ld not remove all unused link

----------------libFoo.d--------------------------
size_t add( size_t a , size_t b ){ return a + b ; }
---------------------------------------------------

without --as-needed

----------------Terminal--------------------------
$ ldc2 -shared libFoo.d -of libFoo.so.1 -soname=libFoo.so.1  -v | grep gcc
/usr/lib64/ccache/gcc libFoo.so.o -shared -o libFoo.so.1 -Xlinker -L/usr/lib64
-Xlinker -lphobos-ldc -lrt -ldl -lpthread -lm -m64 -Wl,-soname,libFoo.so.1 

$ ldd -r -u libFoo.so.1
Unused direct dependencies:
    /lib64/librt.so.1
    /lib64/libdl.so.2
    /lib64/libpthread.so.0
    /lib64/libm.so.6
---------------------------------------------------

whith

----------------Terminal--------------------------
$ ldc2 -shared libFoo.d -of libFoo.so.1 -soname=libFoo.so.1  -v -L--as-needed|
grep gcc
/usr/lib64/ccache/gcc libFoo.so.o -shared -o libFoo.so.1 -Xlinker --as-needed
-Xlinker -L/usr/lib64 -Xlinker -lphobos-ldc -lrt -ldl -lpthread -lm -m64
-Wl,-soname,libFoo.so.1

$ ldd -r -u libFoo.so.1
Unused direct dependencies:
    /lib64/librt.so.1
    /lib64/libdl.so.2
    /lib64/libm.so.6
---------------------------------------------------

The we see here that --as-needed is able to remove only one unused link
libpthread . Why is not able to do same for others ?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to