This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _Unwind_FindEnclosingFunction vs darwin


Jack Howarth wrote:
> On Fri, Dec 18, 2009 at 03:01:08PM +0000, Andrew Haley wrote:
>> _Unwind_Find_FDE is a standard function.  Does Darwin support that?
>>
> 
> Andrew,
>     I believe we do have _Unwind_Find_FDE on darwin10 but it
> is only functional if compact unwind information isn't used.
> This is currently the case in gcc trunk since I disabled
> the darwin10 linker's default of using compact unwind info
> to avoid issues with the new epilog unwind info on the
> darwin10 linker.
>      Shouldn't we be able to add something like...
> 
>  void *
>  darwin10_Unwind_FindEnclosingFunction (void *pc)
>  {
>    struct dwarf_eh_bases bases;
>    const struct dwarf_fde *fde = _Unwind_Find_FDE (pc-1, &bases);
>    if (fde)
>      return bases.func;
>    else
>      return NULL;
>  }
> 
> and use...
> 
> #undefine _Unwind_FindEnclosingFunction(PC) 
> #define _Unwind_FindEnclosingFunction(PC) darwin10_Unwind_FindEnclosingFunction(PC)
> 
> to avoid the system _Unwind_FindEnclosingFunction() on darwin10?

Sure.

> I assume that darwin10_Unwind_FindEnclosingFunction code would have to go into
> libjava/darwin.cc. However, I am unclear where to place...
> 
> #undefine _Unwind_FindEnclosingFunction(PC) 
> #define _Unwind_FindEnclosingFunction(PC) darwin10_Unwind_FindEnclosingFunction(PC)

It can either go in include/config.h if it's autoconf'd or perhaps in
one of the libgcj include files.

The easiest thing would be to add

#ifdef USING_DARWIN_CRT
#undefine _Unwind_FindEnclosingFunction(PC)
#define _Unwind_FindEnclosingFunction(PC) darwin10_Unwind_FindEnclosingFunction(PC)
#endif

to include/posix.h.

Please make sure that darwin10_Unwind_FindEnclosingFunction is not exported from
anywhere.  I'd just declare it static inline in include/posix.h.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]