1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-25 16:47:38 +01:00

Support building with older compilers.

Add a check for __builtin_unreachable.
This commit is contained in:
Ladislav Michl 2012-11-13 11:19:47 +01:00 committed by Arun Sharma
parent ae3dd9417a
commit 10b064ffe9
4 changed files with 19 additions and 2 deletions

View file

@ -285,6 +285,17 @@ if test x$have__builtin___clear_cache = xyes; then
fi fi
AC_MSG_RESULT([$have__builtin___clear_cache]) AC_MSG_RESULT([$have__builtin___clear_cache])
AC_MSG_CHECKING([for __builtin_unreachable])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]], [[__builtin_unreachable()]])],
[have__builtin_unreachable=yes],
[have__builtin_unreachable=no])
if test x$have__builtin_unreachable = xyes; then
AC_DEFINE([HAVE__BUILTIN_UNREACHABLE], [1],
[Defined if __builtin_unreachable() is available])
fi
AC_MSG_RESULT([$have__builtin_unreachable])
AC_MSG_CHECKING([for __sync atomics]) AC_MSG_CHECKING([for __sync atomics])
AC_LINK_IFELSE( AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]], [[ [AC_LANG_PROGRAM([[]], [[

View file

@ -72,6 +72,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
# endif # endif
#endif #endif
#if defined(HAVE__BUILTIN_UNREACHABLE)
# define unreachable() __builtin_unreachable()
#else
# define unreachable() do { } while (1)
#endif
#ifdef DEBUG #ifdef DEBUG
# define UNW_DEBUG 1 # define UNW_DEBUG 1
#else #else

View file

@ -96,7 +96,7 @@ arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
: : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc) : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc)
); );
} }
__builtin_unreachable(); unreachable();
#else #else
printf ("%s: implement me\n", __FUNCTION__); printf ("%s: implement me\n", __FUNCTION__);
#endif #endif

View file

@ -109,7 +109,7 @@ sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
"r" (c->sigcontext_pc) "r" (c->sigcontext_pc)
); );
} }
__builtin_unreachable(); unreachable();
#endif #endif
return -UNW_EINVAL; return -UNW_EINVAL;
} }