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?)



In article <1544216124.17308.17.camel%gentoo.org@localhost>,
MichaŠ Górny  <mgorny%gentoo.org@localhost> 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
>
First we have to figure out why we have so many:

./external/bsd/llvm/dist/clang/lib/Headers/unwind.h
./external/bsd/libc++/dist/libcxxrt/src/unwind.h

Ok, these 4 can be excluded I guess:
./external/gpl3/binutils/dist/include/mach-o/unwind.h
./external/gpl3/binutils.old/dist/include/mach-o/unwind.h
./external/gpl3/gdb/dist/include/mach-o/unwind.h
./external/gpl3/gdb.old/dist/include/mach-o/unwind.h

This I wrote IIRC, and it could/should be normalized:
./lib/libexecinfo/unwind.h 

./sys/lib/libunwind/unwind.h

Are the others the same?

christos



Home | Main Index | Thread Index | Old Index