zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Kamil Dudka <kdudka@redhat.com>, zsh-workers@zsh.org
Subject: Re: loading of module's dependencies broken with '-z now' in LDFLAGS
Date: Thu, 05 Nov 2015 11:58:29 +0000	[thread overview]
Message-ID: <20151105115829.2bb4b3d8@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <5256226.5racBSergM@kdudka.brq.redhat.com>

On Thu, 5 Nov 2015 11:59:42 +0100
Kamil Dudka <kdudka@redhat.com> 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


  reply	other threads:[~2015-11-05 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 10:59 Kamil Dudka
2015-11-05 11:58 ` Peter Stephenson [this message]
2015-11-05 12:17   ` Peter Stephenson
2015-11-05 12:39     ` Kamil Dudka
2015-11-05 12:47       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151105115829.2bb4b3d8@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=kdudka@redhat.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).