Merge branch 'master' into leiflindholm/arm64

Conflicts:
	include/grub/util/install.h
This commit is contained in:
Vladimir Serbinenko 2013-11-25 13:02:27 +01:00
commit d6c92cdc34
82 changed files with 2897 additions and 353 deletions

View file

@ -492,7 +492,11 @@ AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
# on x86 clang doesn't support .code16
# on arm clang doesn't support .arch directive
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm ); then
# on mips clang doesn't support privilegied instructions, doubleword store/load
# and crashes with hand-written assembly
if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
|| test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
|| test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
fi
@ -522,6 +526,21 @@ if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test
TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
fi
# on mips redirect cache flushing function to non-existant one.
if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[grub_cv_cc_mflush_func=yes],
[grub_cv_cc_mflush_func=no])
])
if test "x$grub_cv_cc_mflush_func" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
fi
fi
# Force no alignment to save space on i386.
if test "x$target_cpu" = xi386; then
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
@ -660,8 +679,8 @@ if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
continue
fi
CFLAGS="$TARGET_CFLAGS -static"
LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib"
CFLAGS="$TARGET_CFLAGS"
LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
asm (".globl start; start:");
asm (".globl _start; _start:");
@ -729,9 +748,7 @@ if test "$target_cpu" = x86_64; then
[grub_cv_cc_mcmodel=yes],
[grub_cv_cc_mcmodel=no])
])
if test "x$grub_cv_cc_mcmodel" = xno; then
AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
else
if test "x$grub_cv_cc_mcmodel" = xyes; then
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
fi
fi
@ -769,10 +786,17 @@ CFLAGS="$TARGET_CFLAGS"
# Position independent executable.
grub_CHECK_PIC
[# Need that, because some distributions ship compilers that include
# `-fPIC' in the default specs.
if [ x"$pic_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
[# On most platforms we don't want PIC as it only makes relocations harder
# and code less efficient. On mips we want to have one got table per module
# and reload $gp in every function.
# GCC implements it using symbol __gnu_local_gp in non-PIC as well.
# However with clang we need PIC for this reloading to happen.
# Since default varies across dictributions use either -fPIC or -fno-PIC
# explicitly.
if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then
TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
elif [ x"$pic_possible" = xyes ]; then
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
fi]
CFLAGS="$TARGET_CFLAGS"
@ -807,7 +831,7 @@ fi
# Set them to their new values for the tests below.
CC="$TARGET_CC"
if test "x$TARGET_APPLE_LINKER" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
fi
@ -833,7 +857,7 @@ fi
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
if test "x$TARGET_APPLE_LINKER" = x1 ; then
CFLAGS="$TARGET_CFLAGS -nostdlib"
CFLAGS="$TARGET_CFLAGS -nostdlib -static"
else
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
fi