Ensure that -mno-unaligned-access or some equivalent option is used.
This commit is contained in:
parent
35de6d4bac
commit
d74b9a1d1a
3 changed files with 23 additions and 24 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-11-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Ensure that -mno-unaligned-access or some equivalent option is used.
|
||||||
|
|
||||||
2013-11-30 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-30 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/lib/libgcrypt/mpi/longlong.h: Fix compilation error with
|
* grub-core/lib/libgcrypt/mpi/longlong.h: Fix compilation error with
|
||||||
|
|
20
acinclude.m4
20
acinclude.m4
|
@ -474,23 +474,3 @@ dnl program.
|
||||||
AC_DEFUN([grub_TRANSFORM],[dnl
|
AC_DEFUN([grub_TRANSFORM],[dnl
|
||||||
AC_SUBST(AS_TR_SH([$1]), [`AS_ECHO([$1]) | sed "$program_transform_name"`])dnl
|
AC_SUBST(AS_TR_SH([$1]), [`AS_ECHO([$1]) | sed "$program_transform_name"`])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl Check if the C compiler supports `-mno-unaligned-access'.
|
|
||||||
AC_DEFUN([grub_CHECK_NO_UNALIGNED_ACCESS],[
|
|
||||||
[# foobar
|
|
||||||
nua_possible=yes]
|
|
||||||
AC_MSG_CHECKING([whether `$CC' supports `-mno-unaligned-access'])
|
|
||||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
|
||||||
int main() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
]])])
|
|
||||||
|
|
||||||
[if eval "$ac_compile -S -mno-unaligned-access -o conftest.s" 2> /dev/null; then]
|
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
[rm -f conftest.s
|
|
||||||
else
|
|
||||||
nua_possible=no]
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
[fi]
|
|
||||||
])
|
|
||||||
|
|
23
configure.ac
23
configure.ac
|
@ -839,11 +839,26 @@ fi
|
||||||
|
|
||||||
CFLAGS="$TARGET_CFLAGS"
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
|
|
||||||
# -mno-unaligned-access
|
# -mno-unaligned-access -mstrict-align
|
||||||
if test "$target_cpu" = arm; then
|
if test "$target_cpu" = arm; then
|
||||||
grub_CHECK_NO_UNALIGNED_ACCESS
|
AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
|
||||||
if test x"$nua_possible" = xyes; then
|
grub_cv_target_cc_strict_align=unknown
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-unaligned-access"
|
for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
|
||||||
|
CFLAGS="$TARGET_CFLAGS $arg -Werror"
|
||||||
|
LDFLAGS="$TARGET_LDFLAGS"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
|
||||||
|
if test x"$flag" = x1; then
|
||||||
|
grub_cv_target_cc_strict_align="$arg"
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done])
|
||||||
|
|
||||||
|
if test x"$grub_cv_target_cc_strict_align" = xunknown; then
|
||||||
|
AC_MSG_ERROR([couldnt instruct compiler not to use unaligned access])
|
||||||
|
fi
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
|
||||||
|
if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
|
||||||
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue