bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lt_dlsym() Doesn't Allow for a Symbol with Address of 0.


From: Peter O'Gorman
Subject: Re: lt_dlsym() Doesn't Allow for a Symbol with Address of 0.
Date: Sun, 22 Jul 2007 16:19:38 -0500

On Sun, 2007-07-22 at 18:30 +0100, Ralph Corderoy wrote:
> Hi Peter,
> 
> > > I investigated a problem on the llvmdev mailing list where someone was
> > > trying to find the value of a symbol that has an address of 0.
> > > 
> > >     $ nm /System/Library/Frameworks/Foundation.framework/Foundation |
> > >     > grep .objc_class_name_NSAutoreleasePool
> > >     00000000 A .objc_class_name_NSAutoreleasePool
> > >     $
> > 
> > It is not possible to lookup this symbol on Mac OS X with dlsym()
> > because it does not have an underscore prefix.
> 
> I don't know if dlsym() is being used on Mac OS X, I just went looking
> there because I understand it behaviour.

Yes, dlsym is used on Mac OS X 10.3 and later, and it will return a
symbol not found error (and set dlerror) when you call
dlsym(h,".objc_foo") because it will look for _.objc_foo and not find
it. This is something that the llvm people will have to figure out on
their end. See the manpages for Mac OS X's dlsym at
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/dlsym.3.html
 for confirmation.

> 
> Thanks, my dlsym(3) on Ubuntu Linux warns me it can return NULL when the
> found symbol has an address of 0 and to use dlerror() twice to find out
> what really happened.

Yes, I agree with your analysis, lt_dlerror should return NULL if
dlerror() would have done so. If you want to send a patch to do this
(for HEAD - a quite different libltdl), please do so, if not, I guess
it's up to me :-)

I don't believe that changing this behavior in ltdl will actually help
in the llvm objc case though, sorry.

Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]