> (gdb) run
>
> Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand.
> 0x8fe13184 in __dyld_stub_binding_helper_interface ()
So 'dyld' is the 'dynamic link editor' for Mac OS X.
It's lazy, so it binds only when needed. That's why the program only works when the function is c-called first.
The work-around is to set the 'DYLD_BIND_AT_LAUNCH' flag, which:
> When this is set, the dynamic linker binds all
> undefined symbols the program needs at launch time.
> This includes function symbols that can are nor-
> mally lazily bound at the time of their first call.
I'm still looking for a real solution.
Thanks.
Yann,
PS: Once again, this project is great. You managed to make the implementation so simple and elegant...
Thanks again. :-)
On Dec 30, 2007 3:03 AM, Paolo Bonzini <
address@hidden> wrote:
Dhaemon wrote:
> Hi,
> Paolo Bonzini wrote:
> > This is wrong:
> > jit_calli(printf);
> > jit_finish(display_message);
> > jit_finish *includes* jit_calli, as in the original
printf.c:
>
> Yes, but the purpose of the 'jit_calli(printf)' is just to show that
> calling printf works, but not 'display_message'.
> In other words, the error still happens when I remove 'jit_calli(printf)'.
> Without any modification, the official 'printf.c' fails too.
I'll try again then, it wasn't clear to me. :-)
Paolo