Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: loading of module's dependencies broken with '-z now' in LDFLAGS



On Thu, 5 Nov 2015 11:59:42 +0100
Kamil Dudka <kdudka@xxxxxxxxxx> wrote:
> the build system of Fedora recently started to call linker with '-z now'. 
> The ld(1) man page regarding this option says:
> 
>     "When generating an executable or shared library, mark it to tell the
>     dynamic linker to resolve all symbols when the program is started, or
>     when the shared library is linked to using dlopen, instead of deferring
>     function call resolution to the point when the function is first called."
> 
> This breaks loading of zsh modules that depend on other zsh modules.
> For instance, the following command fails:
> 
> $ zsh -c 'zmodload zsh/zftp' 
> zsh:1: failed to load module `zsh/zftp': /usr/lib64/zsh/5.1.1/zsh/zftp.so: 
> undefined symbol: freehostent

[from zsh/net/tcp].

There is certainly nothing in the current zsh build system as set up for
Linux that does this; however, there is some evidence that it got partly
thought about.  To pursue this example (I think it generalises), the
Src/Modules/zftp.mdd file that defines

moddeps="zsh/net/tcp"

to say that zftp depends on zsh/net/tcp.  In Src/Modules/Makefile, this
results in (together with the implicit dependency on the main shell):

LINKMODS_zftp =  tcp.$(DL_EXT)  $(dir_top)/Src/libzsh-$(VERSION).$(DL_EXT) 

So far so good --- however, LINKDMODS_zftp isn't actually mentioned
again.  A bit of research says that's because configuration says
we should use the alternative (empty) NOLINKMODS_zftp; the LINKMODS
version is only defined to be used for a few OSes in configure.ac.

I guess we need to generate something like LINKMODS_whatever that
tells it to link against the .so's as libraries?  If someone can say
definitively, it might not be too hard to implement.

> ... whereas the following command succeeds:
> 
> $ zsh -c 'zmodload zsh/net/tcp && zmodload zsh/zftp' 
> 
> Do I understand it correctly that the only solution is to tweak the build 
> system not to use '-z now' while linking zsh modules?

For now, that's probably the case.

pws



Messages sorted by: Reverse Date, Date, Thread, Author