[systemd-devel] pcre in daemons

Lennart Poettering lennart at poettering.net
Thu Feb 27 14:08:16 PST 2014


On Wed, 26.02.14 20:54, Thomas H.P. Andersen (phomes at gmail.com) wrote:

> The todo says:
> "something pulls in pcre as shared object dependency into our daemons
> such as hostnamed"
> 
> Normal buiild:
> ldd ./systemd-hostnamed
>     linux-vdso.so.1 =>  (0x00007fff247bc000)
>     libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f7ec47f7000)
>     librt.so.1 => /lib64/librt.so.1 (0x00007f7ec45ef000)
>     libdl.so.2 => /lib64/libdl.so.2 (0x00007f7ec43ea000)
>     libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f7ec41cd000)
>     libc.so.6 => /lib64/libc.so.6 (0x00007f7ec3e0e000)
>     /lib64/ld-linux-x86-64.so.2 (0x00007f7ec4a2f000)
>     libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f7ec3ba7000)
>     liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f7ec3982000)
> 
> 
> With --disable-selinux:
> $ ldd ./systemd-hostnamed
>     linux-vdso.so.1 =>  (0x00007fff1a651000)
>     librt.so.1 => /lib64/librt.so.1 (0x00007f1c058d0000)
>     libdl.so.2 => /lib64/libdl.so.2 (0x00007f1c056cc000)
>     libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1c054ae000)
>     libc.so.6 => /lib64/libc.so.6 (0x00007f1c050ef000)
>     /lib64/ld-linux-x86-64.so.2 (0x00007f1c05aec000)
> 
> Not sure what to do about that though...

For some reason linking to libselinux has the result that libpcre is
pulled in as direct dependency, too. i.e. for some reason libselinux
seems to enforce ld's --copy-dt-needed-entries option when linking to
it. I have the suspicion this is caused because libselinux uses gcc
constructors/_init. Which is a pretty poor choice, of course, libselinux
really shouldn't use gcc constructors. In fact, nobody should ever use
gcc constructors... Also, if a library has gcc constructors it makes
--as-needed useless on it, apparently. It's quite understandable: after
all dropping the libs would result in different code to be executed,
since just loading the libs already results in code execution in the
library. So in order not to change behaviour ld exclude libraries with
constructors from --as-needed...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list