blob: 0609be6708caf15e3e721deaf653deba5a87eb2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
|