- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gcc7?expand=0&rev=68
This commit is contained in:
Michael Matz 2017-08-02 12:19:53 +00:00 committed by Git OBS Bridge
parent 934e2d81ea
commit 2672abda31
42 changed files with 238 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -178,6 +178,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -252,6 +253,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -178,6 +178,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -252,6 +253,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -177,6 +177,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -251,6 +252,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -302,6 +302,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -1055,6 +1056,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

96
gcc7-stack-probe.diff Normal file
View File

@ -0,0 +1,96 @@
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 244266)
+++ gcc/common.opt (working copy)
@@ -2295,6 +2299,10 @@ fstack-check
Common Alias(fstack-check=, specific, no)
Insert stack checking code into the program. Same as -fstack-check=specific.
+fstack-clash-protection
+Common Report Var(flag_stack_clash_protection)
+Insert probes per page for dynamically allocated stack space
+
fstack-limit
Common Var(common_deferred_options) Defer
Index: gcc/explow.c
===================================================================
--- gcc/explow.c (revision 244266)
+++ gcc/explow.c (working copy)
@@ -1277,6 +1277,8 @@ get_dynamic_stack_size (rtx *psize, unsi
*psize = size;
}
+#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
+
/* Return an rtx representing the address of an area of memory dynamically
pushed on the stack.
@@ -1305,6 +1307,8 @@ allocate_dynamic_stack_space (rtx size,
HOST_WIDE_INT stack_usage_size = -1;
rtx_code_label *final_label;
rtx final_target, target;
+ rtx loop_lab, end_lab, last_size;
+ int probe_pass = 0;
/* If we're asking for zero bytes, it doesn't matter what we point
to since we can't dereference it. But return a reasonable
@@ -1440,6 +1444,24 @@ allocate_dynamic_stack_space (rtx size,
/* Don't let anti_adjust_stack emit notes. */
suppress_reg_args_size = true;
+ if (flag_stack_clash_protection)
+ {
+#ifndef STACK_GROWS_DOWNWARD
+ sorry("-fstack-clash-protection is incompatible with upward growing stack");
+#endif
+ size = copy_to_mode_reg (Pmode, convert_to_mode (Pmode, size, 1));
+ loop_lab = gen_label_rtx ();
+ end_lab = gen_label_rtx ();
+ emit_label (loop_lab);
+ emit_cmp_and_jump_insns (size, GEN_INT (PROBE_INTERVAL), LTU,
+ NULL_RTX, Pmode, 1, end_lab);
+ last_size = expand_binop (Pmode, sub_optab, size, GEN_INT (PROBE_INTERVAL), size,
+ 1, OPTAB_WIDEN);
+ gcc_assert (last_size == size);
+ size = GEN_INT (PROBE_INTERVAL);
+ }
+
+again:
/* Perform the required allocation from the stack. Some systems do
this differently than simply incrementing/decrementing from the
stack pointer, such as acquiring the space by calling malloc(). */
@@ -1499,6 +1521,15 @@ allocate_dynamic_stack_space (rtx size,
if (STACK_GROWS_DOWNWARD)
emit_move_insn (target, virtual_stack_dynamic_rtx);
}
+ if (flag_stack_clash_protection && probe_pass == 0)
+ {
+ probe_pass = 1;
+ emit_stack_probe (target);
+ emit_jump (loop_lab);
+ emit_label (end_lab);
+ size = last_size;
+ goto again;
+ }
suppress_reg_args_size = false;
@@ -1510,6 +1541,8 @@ allocate_dynamic_stack_space (rtx size,
emit_label (final_label);
target = final_target;
}
+ if (flag_stack_clash_protection)
+ emit_stack_probe (target);
target = align_dynamic_address (target, required_align);
@@ -1593,8 +1626,6 @@ emit_stack_probe (rtx address)
the current stack pointer. STACK_GROWS_DOWNWARD says whether to add
or subtract them from the stack pointer. */
-#define PROBE_INTERVAL (1 << STACK_CHECK_PROBE_INTERVAL_EXP)
-
#if STACK_GROWS_DOWNWARD
#define STACK_GROW_OP MINUS
#define STACK_GROW_OPTAB sub_optab

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -315,6 +315,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -441,6 +442,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 2 12:17:00 UTC 2017 - matz@suse.com
- Add gcc7-stack-probe.diff for support of -fstack-clash-protection.
-------------------------------------------------------------------
Thu Jul 20 09:06:13 UTC 2017 - schwab@suse.de

View File

@ -297,6 +297,7 @@ Patch9: gcc48-remove-mpfr-2.4.0-requirement.patch
Patch10: gcc5-no-return-gcc43-workaround.patch
Patch11: gcc7-remove-Wexpansion-to-defined-from-Wextra.patch
Patch12: float128-builtin-cpu-supports.patch
Patch13: gcc7-stack-probe.diff
# A set of patches from the RH srpm
Patch51: gcc41-ppc32-retaddr.patch
# Some patches taken from Debian
@ -1745,6 +1746,7 @@ ln -s nvptx-newlib/newlib .
%patch10
%patch11
%patch12 -p1
%patch13
%patch51
%patch60
%patch61