[LLVMdev] Trouble Resolving Objective-C Symbols in lli

Reid Spencer
Sat, 21 Jul 2007 05:09:52 -0000

Hi Andy,

On Sat, 2007-07-21 at 14:56 +1000, Andy Kitchen wrote:
> Hey Reid,
>
>         I don't recall who originally asked for help with this, but
>         here's a
>         patch that could fix it. Please try this and let me know if it
>         works. If
>         so, I'll commit it. The patch isn't complete (it should do
>         something in
>         the error condition) but it should allow you to find symbols
>         whose
>         address is 0.
>
> It was me who was having the issues with Objective-C in the
> interpreter.

Okay, sorry, I didn't remember.

> Thankyou, I did try the patch, and it doesn't seem to work, or at
> least for my one program. In JIT mode it still segfaults and in
> interpreter mode it cannot resolve the
> symbol.

Bummer.

> I am at my wits end with this problem, the dlopen documentation states
> that if it
> explicidly fails, it will return a NULL pointer. However it doesn't
> say anything about
> succeeding with a NULL pointer. If the simple Objective-C program is
> still failing, even
> when checking if the lt_dlerror() code is set. I see two
> possibilities:
>
>
> a) The error code is being set even when the symbol is found and has a
> 0 address

unlikely

> b) The error is caused by some other problem, maybe further upstream,
> indicated by the
> fact that the JIT interpreter crashes with a segfault. Because normal
> unresolved
> symbols will not crash the interpreter even in JIT mode.

This is probably it. The JIT probably doesn't know what to do with a
symbol whose address is 0, so, just for grins, it tries dereferencing
it.

What exactly are these symbols? How would one differentiate them if they
all have 0 address? What should the JIT do with them?

> I'm using the 2.0 release, and I'm about to get the bleeding edge
SVN
> version to try,
> however my mac is quite slow and will take an hour or two to compile
> the source code.

I don't think much has changed in this area since 2.0, but you could
try.

> My knowleage of the Obj-C runtime is quite limited and I am new to the
> LLVM
> architecture. So I'm sorry if I can't be of more assistance code
wise.
> But I'm currently
> reading up on both in my spare time.

I don't know the Obj-C runtime at all so that makes you an expert
compared to me :)

Reading up will probably help a lot.

Best Regards,

Reid.

>
>
> Andy.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev