On 13 September 2004 17:03, Volker Stolz wrote:

> I looked into the SF-bug [ 1012521 ] getUserEntryForID dies where a
> reentrant 
> function from libc would cause an illegal instruction. First, I
> thought the 
> maybe we'd forgotten to pass -D_POSIX_PTHREAD_SEMANTICS, but it's
> there after all. 
> It looks like something doesn't work right when Solaris wraps the
> reentrant 
> functions in the following way:
> 
> <pwd.h> does something along the lines of
> 
> static int
> getpwuid_r(__uid, __pwd, __buf, __len, __res)
>         uid_t __uid;
>         struct passwd *__pwd;
>         char *__buf;
>         int __len;
>         struct passwd **__res;
> {
>         extern int __posix_getpwuid_r();
>         return (__posix_getpwuid_r(__uid, __pwd, __buf, __len,
> __res)); }

Oh bum.  The header file is inserting ordinary function definitions in
the code, which means we have to tell the mangler about these.  I
believe there are already examples of this - check out the
i386-*-solaris2 case just above the code for "Warning - retaining
unknown function..." in ghc-asm.lprl.

You need to ensure that these functions just get passed through the
mangler unharmed, i.e. no prologue/epilogue processing.  I'm not sure
how best to do this - the mangler currently seems to do
prologue/epilogue processing for *all* code blocks on sparc.  You might
have to use a new code chunk type for these functions, and avoid the
prologue/epilogue processing for those chunks.

A better solution would be to avoid all this mess somehow.  Perhaps use
C wrappers for getpwuid_r, or something?

Cheers,
        Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to