Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Chris Friesen" <cfriesen@nortel.com>
To: linux-mips@linux-mips.org
Subject: problems with dlsym() on MIPS, looking for advice
Date: Mon, 26 May 2008 11:51:56 -0600	[thread overview]
Message-ID: <483AF8BC.7020603@nortel.com> (raw)

I think this is a userspace/toolchain issue, so if that's offtopic for 
this list please let me know of a better resource.

We're using glibc 2.3.6 and gcc 3.4.4.  We've got some library code 
(that gets preloaded for debugging) something like this:

ee_sigaction_fptr = dlsym(RTLD_DEFAULT, "sigaction"); 
   if (ee_sigaction_fptr == sigaction) 
      	ee_sigaction_fptr = dlsym(RTLD_NEXT, "sigaction");

We have declared our own sigaction procedure which is extern in this 
code.  On non-MIPS arches (powerpc, x86, x86_64) the RTLD_DEFAULT call 
returns the address of our external procedure and the RTLD_NEXT call 
returns the real sigaction address in its appropriate library.

On MIPS, the DEFAULT returns the address of this libraries undefined 
symbol for the extern and NEXT returns our external procedure.  Putting 
in a second RTLD_NEXT call returned the real sigaction address.

This worked for most procedures we are looking for. However, during 
booting, we have an app that uses a specific library which has an extern 
for sigaction as well and now in the preloaded code we need a fourth 
call to dlsym to skip that one.

We tried recoding the above debug code to do one DEFAULT call and a loop 
of NEXT calls until it returns NULL.  It didn't.  It just kept returning 
the last pointer all the time. 


Has anyone seen anything like this?  Is there a known issue with dlsym() 
and certain toolchains?  (Maybe something like 
"http://busybox.net/lists/uclibc/2007-January/017150.html"?)


Any help you can provide would be appreciated.

Thanks,

Chris

             reply	other threads:[~2008-05-26 17:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26 17:51 Chris Friesen [this message]
     [not found] ` <20080129132739.5D6B.YORIKO@sm.sony.co.jp>
2008-07-02 12:47   ` do-lookup.h regarding to mips/dlsym and libstdc++ Daniel Jacobowitz
2008-07-03  5:05     ` Yoriko Komatsuzaki

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=483AF8BC.7020603@nortel.com \
    --to=cfriesen@nortel.com \
    --cc=linux-mips@linux-mips.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