From f1b352538556711dc3f9e8b9bf5bf2e4abea8e25 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 31 Dec 2015 18:15:49 +0100 Subject: [PATCH] Add -mno-stack-arg-probe on mingw. This argument disables generation of calls to __chkstk_ms. Those calls are useless on GRUB as function is dummy. Yet they increase module size and use limited-range relocations which may not work under some memory layouts. We currently don't use such layouts on concerned platforms but lt's correct this. --- configure.ac | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configure.ac b/configure.ac index 3300545e0..f662e200e 100644 --- a/configure.ac +++ b/configure.ac @@ -910,6 +910,18 @@ if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xy TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions" fi +AC_CACHE_CHECK([whether -mno-stack-arg-probe works], [grub_cv_cc_mno_stack_arg_probe], [ + CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mno_stack_arg_probe=yes], + [grub_cv_cc_mno_stack_arg_probe=no]) +]) + +if test "x$grub_cv_cc_mno_stack_arg_probe" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe" +fi + + # By default, GCC 4.6 generates .eh_frame sections containing unwind # information in some cases where it previously did not. GRUB doesn't need # these and they just use up vital space. Restore the old compiler