Author: vkalintiris Date: Sat Sep 26 13:26:01 2015 New Revision: 248673 URL: http://llvm.org/viewvc/llvm-project?rev=248673&view=rev Log: unwind: Allow the building of libunwind for MIPS.
Summary: Currently, libunwind doesn't support MIPS. However, with this patch we do allow the library to build, and we warn the user about the lack of support for MIPS. Also, the dummy unw_getcontext() implementation for MIPS just traps on function entry in order to avoid any confusion with silent/weird failures at runtime. This allows us to test an LLVM-based toolchain without the dependency on a GCC toolchain. Of course, C++ exception handling and other things that depend on stack unwinding will not work until we add a proper implementation of the stub functions. Reviewers: compnerd, logan Subscribers: dsanders, llvm-commits Differential Revision: http://reviews.llvm.org/D13160 Modified: libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/src/UnwindRegistersSave.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=248673&r1=248672&r2=248673&view=diff ============================================================================== --- libunwind/trunk/src/UnwindRegistersSave.S (original) +++ libunwind/trunk/src/UnwindRegistersSave.S Sat Sep 26 13:26:01 2015 @@ -87,6 +87,15 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext xorl %eax, %eax # return UNW_ESUCCESS ret +# elif defined(__mips__) + +# +# extern int unw_getcontext(unw_context_t* thread_state) +# +# Just trap for the time being. +DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) + teq $0, $0 + #elif defined(__ppc__) ; Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=248673&r1=248672&r2=248673&view=diff ============================================================================== --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Sat Sep 26 13:26:01 2015 @@ -41,7 +41,8 @@ #define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \ defined(__x86_64__) || \ - defined(__arm64__)) + defined(__arm64__) || \ + defined(__mips__)) #define _LIBUNWIND_BUILD_SJLJ_APIS defined(__arm__) #define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \ defined(__x86_64__)) Modified: libunwind/trunk/src/libunwind.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind.cpp?rev=248673&r1=248672&r2=248673&view=diff ============================================================================== --- libunwind/trunk/src/libunwind.cpp (original) +++ libunwind/trunk/src/libunwind.cpp Sat Sep 26 13:26:01 2015 @@ -64,6 +64,8 @@ _LIBUNWIND_EXPORT int unw_init_local(unw #elif defined(__or1k__) new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_or1k>( context, LocalAddressSpace::sThisAddressSpace); +#elif defined(__mips__) +#warning The MIPS architecture is not supported. #else #error Architecture not supported #endif _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits