tech-toolchain archive

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

Re: [RFC] Improving compatibility of NetBSD's unwind.h (or replacing it?)



On 07.12.2018 21:55, Michał Górny wrote:
> Hi,
> 
> While working on building more LLVM projects on NetBSD, I've noticed
> that libcxxabi fails to build due to incompatible unwind.h.  The example
> of problematic code is [1]:
> 
>   _Unwind_SetGR(context, __builtin_eh_return_data_regno(0),
>                 reinterpret_cast<uintptr_t>(unwind_exception));
>   _Unwind_SetGR(context, __builtin_eh_return_data_regno(1),
>                 static_cast<uintptr_t>(results.ttypeIndex));
>   _Unwind_SetIP(context, results.landingPad);
> 
> This fails to build because NetBSD's unwind.h expects the last argument
> to _Unwind_Set{GR,IP} to be a pointer.  However, it seems that other
> implementations expect an unsigned integer type instead.  The types used
> for the last argument of appropriate functions (and return type of their
> respective _Unwind_Get* counterparts) are:
> 
>                         SetGR/GetGR   SetIP/GetIP
>   gcc 7.3.0 on Linux    _Unwind_Word  _Unwind_Ptr   (-> unsigned [a])
>   clang                 _Unwind_Word  _Unwind_Word  (-> uintptr_t)
>   llvm-libunwind        uintptr_t     uintptr_t
>   libunwind 1.2.1       uns. long     uns. long
> 
>   [a] gcc is doing some __attribute__ magic on top of it
> 
> I think changing our header to use unsigned integer type alike other
> implementations is the way to go.  Does this sound like the right thing
> to do?
> 
> [1]:https://github.com/llvm-mirror/libcxxabi/blob/master/src/cxa_personality.cpp#L528
> 

There is a lot of such pain in other LLVM projects like compiler-rt.
Changing the type to be compatible with other implementations sounds
good to me.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index