D Linking library behaviour
bioinfornatics
bioinfornatics at fedoraproject.org
Fri Nov 9 00:22:52 PST 2012
Hi,
I see a problem with ldc and maybe other compiler as the same
problem. When I create a library as :
--------------- libFoo.d ---------------
size_t add( size_t a , size_t b ){ return a + b ; }
----------------------------------------
----------------- Terminal -------------
$ ldc2 -shared libFoo.d -of libFoo.so.1 -soname=libFoo.so.1
$ ldd libFoo.so.1
linux-vdso.so.1 => (0x00007fff14000000)
libphobos-ldc.so.59 => /lib64/libphobos-ldc.so.59
(0x00007fb01a820000)
librt.so.1 => /lib64/librt.so.1 (0x00007fb01a618000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fb01a410000)
libpthread.so.0 => /lib64/libpthread.so.0
(0x00007fb01a1f0000)
libm.so.6 => /lib64/libm.so.6 (0x00007fb019ef0000)
libc.so.6 => /lib64/libc.so.6 (0x00007fb019b38000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb019920000)
/lib64/ld-linux-x86-64.so.2 (0x0000003e6c000000)
----------------------------------------
libFoo library got some extra link which will never be used by
libFoo as:
- librt
- libpthread
- libm
- libc
I have try to said to the linker to use only link needed with:
----------------- Terminal -------------
$ ldc2 -shared libFoo.d -of libFoo.so.1 -soname=libFoo.so.1
-L--as-needed
----------------------------------------
--as-needed flag seem to be used in this case
http://tinyurl.com/bfbuhpx
but it do not remove these extra link maybe they are hardcoded.
So i would like to know:
- if other compiler has same beehaviour ?
- if --as-needed flag is safe ?
More information about the Digitalmars-d
mailing list