Commit d5738a57 authored by Michael Weiser's avatar Michael Weiser Committed by Niels Möller

Add arm endianness-aware assembly infrastructure

Introduce m4 macros to conditionally handle differences of little- and
big-endian arm in assembler code.
parent 8c210b4e
......@@ -51,6 +51,14 @@ define(<ALIGN>,
<.align ifelse(ALIGN_LOG,yes,<m4_log2($1)>,$1)
>)
define(<IF_BE>, <ifelse(
WORDS_BIGENDIAN,yes,<$1>,
WORDS_BIGENDIAN,no,<$2>,
<errprint(<Unsupported endianness value>,WORDS_BIGENDIAN,<
>)
m4exit(1)>)>)
define(<IF_LE>, <IF_BE(<$2>, <$1>)>)
dnl Struct defining macros
dnl STRUCTURE(prefix)
......
......@@ -7,6 +7,7 @@ define(<TYPE_PROGBITS>, <@ASM_TYPE_PROGBITS@>)dnl
define(<ALIGN_LOG>, <@ASM_ALIGN_LOG@>)dnl
define(<W64_ABI>, <@W64_ABI@>)dnl
define(<RODATA>, <@ASM_RODATA@>)dnl
define(<WORDS_BIGENDIAN>, <@ASM_WORDS_BIGENDIAN@>)dnl
divert(1)
@ASM_MARK_NOEXEC_STACK@
divert
......@@ -205,7 +205,11 @@ LSH_FUNC_STRERROR
# getenv_secure is used for fat overrides,
# getline is used in the testsuite
AC_CHECK_FUNCS(secure_getenv getline)
AC_C_BIGENDIAN
ASM_WORDS_BIGENDIAN=unknown
AC_C_BIGENDIAN([AC_DEFINE([WORDS_BIGENDIAN], 1)
ASM_WORDS_BIGENDIAN=yes],
[ASM_WORDS_BIGENDIAN=no])
AC_CACHE_CHECK([for __builtin_bswap64],
nettle_cv_c_builtin_bswap64,
......@@ -820,6 +824,7 @@ AC_SUBST(ASM_TYPE_PROGBITS)
AC_SUBST(ASM_MARK_NOEXEC_STACK)
AC_SUBST(ASM_ALIGN_LOG)
AC_SUBST(W64_ABI)
AC_SUBST(ASM_WORDS_BIGENDIAN)
AC_SUBST(EMULATOR)
AC_SUBST(LIBNETTLE_MAJOR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment