linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Gilles Depeyrot <Gilles.Depeyrot@wanadoo.fr>
Cc: linuxppc-user <linuxppc-user@lists.linuxppc.org>,
	linuxppc-dev <linuxppc-dev@lists.linuxppc.org>
Subject: Re: LinuxPPC1999: shared libraries and dlopen not working ?
Date: Sun, 20 Jun 1999 09:51:27 -0400	[thread overview]
Message-ID: <19990620095127.A12081@drow.res.cmu.edu> (raw)
In-Reply-To: <199906201323.PAA19742@wanadoo.fr>; from Gilles Depeyrot on Sun, Jun 20, 1999 at 03:22:25PM +0200


On Sun, Jun 20, 1999 at 03:22:25PM +0200, Gilles Depeyrot wrote:
> Hi,
> 
> I'm having trouble getting shared libraries and dlopen to work under
> LinuxPPC1999.
> 
> I have attached three small files dltest.c, lib1.c and lib2.c. lib1 and
> lib2 must be built as shared libraries and dltest as an executable.
> 
> The test does the following:
> 
> /* dltest
>  * test functionality of dlopen(), dlsym() and dladdr()
>  *
>  * dlopen()  test, w/ and w/o .init function
>  * dlsym()   test, can we retrieve address from symbol
>  * dladdr()  test, given an address, can we find where its from
>  */
> 
> It fails on the first dlopen...

First of all: learn to use dlerror().  It is your friend in places like
this.  It tells me: "Invalid mode for dlopen()".  From glibc I see this
(use the source, Luke!):

  if ((mode & RTLD_BINDING_MASK) == 0)
    /* One of the flags must be set.  */
    _dl_signal_error (EINVAL, file, _("invalid mode for dlopen()"));

You didn't give it a binding mask.  RTLD_GLOBAL isn't enough.  Give it
one of RLTD_NOW or RTLD_LAZY or'd with RTLD_GLOBAL.

All your tests pass after that change.


Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         dan@debian.org         |  |       dmj+@andrew.cmu.edu      |
\--------------------------------/  \--------------------------------/

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

      reply	other threads:[~1999-06-20 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-20 13:22 LinuxPPC1999: shared libraries and dlopen not working ? Gilles Depeyrot
1999-06-20 13:51 ` Daniel Jacobowitz [this message]

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=19990620095127.A12081@drow.res.cmu.edu \
    --to=drow@false.org \
    --cc=Gilles.Depeyrot@wanadoo.fr \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=linuxppc-user@lists.linuxppc.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.
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).