summarylogtreecommitdiffstats
path: root/no-combine-stack-adjustments.patch
diff options
context:
space:
mode:
Diffstat (limited to 'no-combine-stack-adjustments.patch')
-rw-r--r--no-combine-stack-adjustments.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/no-combine-stack-adjustments.patch b/no-combine-stack-adjustments.patch
new file mode 100644
index 000000000000..0609be6708ca
--- /dev/null
+++ b/no-combine-stack-adjustments.patch
@@ -0,0 +1,27 @@
+Index: b/configure.ac
+===================================================================
+--- a/configure.ac
++++ b/configure.ac
+@@ -127,6 +127,22 @@
+ if test "x$no_reorder_functions_flag" = xyes; then
+ STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-reorder-functions"
+ fi
++ # GCC >= 4.6 supports -fno-combine-stack-adjustments; this defends us
++ # against optimisations that confuse the stack games played by GRUB
++ # itself.
++ AC_CACHE_CHECK([whether gcc has -fno-combine-stack-adjustments],
++ no_combine_stack_adjustments_flag, [
++ saved_CFLAGS=$CFLAGS
++ CFLAGS="-fno-combine-stack-adjustments"
++ AC_TRY_COMPILE(,
++ ,
++ no_combine_stack_adjustments_flag=yes,
++ no_combine_stack_adjustments_flag=no)
++ CFLAGS=$saved_CFLAGS
++ ])
++ if test "x$no_combine_stack_adjustments_flag" = xyes; then
++ GRUB_CFLAGS="$GRUB_CFLAGS -fno-combine-stack-adjustments"
++ fi
+ fi
+ fi
+