From ae86ce61658f2039b1e8ccf22ed1ed4bcb2670c1 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sat, 27 Aug 2005 21:03:52 +0000 Subject: [PATCH] Sync GCC 3.4's propolice with Etoh's official version. This fixes the reorder bug in -O2+, which killed Samba from pkgsrc and mutt. --- .../cc34/cc_prep/patches/c-cppbuiltin.c.patch | 22 +++++++ .../cc34/cc_prep/patches/combine.c.patch | 10 +-- .../cc34/cc_prep/patches/function.c.patch | 39 +++++++++-- .../cc34/cc_prep/patches/integrate.c.patch | 11 ++-- gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch | 4 +- .../cc34/cc_prep/patches/optabs.c.patch | 5 +- .../cc34/cc_prep/patches/simplify-rtx.c.patch | 10 +-- .../cc34/cc_prep/patches/toplev.c.patch | 45 +++++++------ gnu/usr.bin/cc34/cc_prep/protector.c | 24 ++++++- .../cc34/doc/patches/invoke.texi.patch | 65 ++++++++++++++++--- 10 files changed, 179 insertions(+), 56 deletions(-) create mode 100644 gnu/usr.bin/cc34/cc_prep/patches/c-cppbuiltin.c.patch diff --git a/gnu/usr.bin/cc34/cc_prep/patches/c-cppbuiltin.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/c-cppbuiltin.c.patch new file mode 100644 index 0000000000..f9908a1d7e --- /dev/null +++ b/gnu/usr.bin/cc34/cc_prep/patches/c-cppbuiltin.c.patch @@ -0,0 +1,22 @@ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/c-cppbuiltin.c.patch,v 1.1 2005/08/27 21:03:51 joerg Exp $ + +Index: c-cppbuiltin.c +=================================================================== +RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/c-cppbuiltin.c,v +retrieving revision 1.1 +diff -u -r1.1 c-cppbuiltin.c +--- c-cppbuiltin.c 20 Jun 2004 02:14:48 -0000 1.1 ++++ c-cppbuiltin.c 27 Aug 2005 16:40:43 -0000 +@@ -408,6 +408,12 @@ + if (c_dialect_objc () && flag_next_runtime) + cpp_define (pfile, "__NEXT_RUNTIME__"); + ++ /* Make the choice of the stack protector runtime visible to source code. */ ++ if (flag_propolice_protection) ++ cpp_define (pfile, "__SSP__=1"); ++ if (flag_stack_protection) ++ cpp_define (pfile, "__SSP_ALL__=2"); ++ + /* A straightforward target hook doesn't work, because of problems + linking that hook's body when part of non-C front ends. */ + # define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM) diff --git a/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch index ecd9e9048f..25221ce668 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch @@ -1,4 +1,4 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/combine.c.patch,v 1.4 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/combine.c,v @@ -6,7 +6,7 @@ retrieving revision 1.2 diff -u -r1.2 combine.c --- combine.c 20 Dec 2004 19:23:23 -0000 1.2 +++ combine.c 20 Dec 2004 20:48:09 -0000 -@@ -1401,6 +1401,10 @@ +@@ -1402,6 +1402,10 @@ && ! fixed_regs[REGNO (dest)] && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (dest)))))) return 1; @@ -17,7 +17,7 @@ diff -u -r1.2 combine.c return 0; } -@@ -3781,7 +3785,20 @@ +@@ -3782,7 +3786,20 @@ rtx inner_op0 = XEXP (XEXP (x, 0), 1); rtx inner_op1 = XEXP (x, 1); rtx inner; @@ -39,7 +39,7 @@ diff -u -r1.2 combine.c /* Make sure we pass the constant operand if any as the second one if this is a commutative operation. */ if (CONSTANT_P (inner_op0) && GET_RTX_CLASS (code) == 'c') -@@ -4146,6 +4163,13 @@ +@@ -4147,6 +4164,13 @@ they are now checked elsewhere. */ if (GET_CODE (XEXP (x, 0)) == PLUS && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1))) @@ -53,7 +53,7 @@ diff -u -r1.2 combine.c return gen_binary (PLUS, mode, gen_binary (PLUS, mode, XEXP (XEXP (x, 0), 0), XEXP (x, 1)), -@@ -4273,8 +4297,14 @@ +@@ -4274,8 +4298,14 @@ } /* Canonicalize (minus A (plus B C)) to (minus (minus A B) C) for diff --git a/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch index f7921149ec..6a5ee147eb 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch @@ -1,4 +1,4 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch,v 1.4 2005/05/24 06:29:33 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch,v 1.5 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/function.c,v @@ -69,7 +69,24 @@ diff -u -r1.2 function.c p->next = temp_slots; temp_slots = p; -@@ -771,6 +783,7 @@ +@@ -757,6 +769,16 @@ + way the frame grows. We include the extra space if and only if it + is above this slot. */ + #ifdef FRAME_GROWS_DOWNWARD ++ /* The stack protector can share a character buffer with another buffer ++ in the different block only when the size of the first is bigger ++ than the second. p->size is used for this comparison. ++ But, in some situation, p->size is bigger than the actual size. ++ So, we should change p->size with its aligned size. */ ++ if (flag_propolice_protection ++ && char_array ++ && (frame_offset_old - frame_offset > ++ CEIL_ROUND (size, align / BITS_PER_UNIT))) ++ frame_offset_old = frame_offset + CEIL_ROUND (size, align / BITS_PER_UNIT); + p->size = frame_offset_old - frame_offset; + #else + p->size = size; +@@ -771,6 +793,7 @@ p->full_size = frame_offset - frame_offset_old; #endif p->address = 0; @@ -77,7 +94,7 @@ diff -u -r1.2 function.c p->next = temp_slots; temp_slots = p; } -@@ -935,14 +948,16 @@ +@@ -935,14 +958,16 @@ int delete_q = 0; if (! q->in_use && GET_MODE (q->slot) == BLKmode) { @@ -96,7 +113,7 @@ diff -u -r1.2 function.c { /* P comes after Q; combine P into Q. */ q->size += p->size; -@@ -3955,7 +3973,8 @@ +@@ -3949,7 +3974,8 @@ constant with that register. */ temp = gen_reg_rtx (Pmode); XEXP (x, 0) = new; @@ -106,3 +123,17 @@ diff -u -r1.2 function.c emit_insn_before (gen_move_insn (temp, new_offset), object); else { +@@ -6172,7 +6198,12 @@ + + /* Recreate the block tree from the note nesting. */ + reorder_blocks_1 (get_insns (), block, &block_stack); +- BLOCK_SUBBLOCKS (block) = blocks_nreverse (BLOCK_SUBBLOCKS (block)); ++ ++ /* In propolice-protection mode, disable to change the order of SUBBLOCKS ++ by the reason that the order is reversed from its ++ declaration sequence. */ ++ if (! flag_propolice_protection) ++ BLOCK_SUBBLOCKS (block) = blocks_nreverse (BLOCK_SUBBLOCKS (block)); + + /* Remove deleted blocks from the block fragment chains. */ + reorder_fix_fragments (block); diff --git a/gnu/usr.bin/cc34/cc_prep/patches/integrate.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/integrate.c.patch index 51c1e179a3..694b8ff365 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/integrate.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/integrate.c.patch @@ -1,4 +1,4 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/integrate.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/integrate.c.patch,v 1.4 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/integrate.c,v @@ -6,22 +6,25 @@ retrieving revision 1.1 diff -u -r1.1 integrate.c --- integrate.c 20 Jun 2004 02:14:49 -0000 1.1 +++ integrate.c 20 Dec 2004 20:48:11 -0000 -@@ -393,6 +393,10 @@ +@@ -393,6 +393,11 @@ /* These args would always appear unused, if not for this. */ TREE_USED (copy) = 1; -+ /* The inlined variable is marked as INLINE not to sweep by propolice */ ++ /* The inlined variable is marked as INLINE not to change the location ++ by stack protector. */ + if (flag_propolice_protection && TREE_CODE (copy) == VAR_DECL) + DECL_COPIED (copy) = 1; + /* Set the context for the new declaration. */ if (!DECL_CONTEXT (decl)) /* Globals stay global. */ -@@ -1970,6 +1974,10 @@ +@@ -1970,6 +1975,12 @@ seq = get_insns (); end_sequence (); +#ifdef ARGS_GROWS_DOWNWARD ++ /* Mark this pointer as the top of the argument ++ block. The pointer minus one is in the block. */ + if (flag_propolice_protection && GET_CODE (seq) == SET) + RTX_INTEGRATED_P (SET_SRC (seq)) = 1; +#endif diff --git a/gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch index 7f35eb3e7b..cda818ad4c 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch @@ -1,4 +1,4 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/loop.c.patch,v 1.4 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/loop.c,v @@ -6,7 +6,7 @@ retrieving revision 1.2 diff -u -r1.2 loop.c --- loop.c 20 Dec 2004 19:23:24 -0000 1.2 +++ loop.c 20 Dec 2004 20:48:11 -0000 -@@ -6514,6 +6514,14 @@ +@@ -6525,6 +6525,14 @@ if (GET_CODE (*mult_val) == USE) *mult_val = XEXP (*mult_val, 0); diff --git a/gnu/usr.bin/cc34/cc_prep/patches/optabs.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/optabs.c.patch index 1843331214..3b59e786cc 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/optabs.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/optabs.c.patch @@ -1,4 +1,4 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/optabs.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/optabs.c.patch,v 1.4 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/optabs.c,v @@ -6,10 +6,11 @@ retrieving revision 1.1 diff -u -r1.1 optabs.c --- optabs.c 20 Jun 2004 02:14:50 -0000 1.1 +++ optabs.c 20 Dec 2004 20:48:12 -0000 -@@ -678,6 +678,26 @@ +@@ -678,6 +678,27 @@ if (target) target = protect_from_queue (target, 1); ++ /* Keep the frame and offset pattern at the use of stack protection. */ + if (flag_propolice_protection + && binoptab->code == PLUS + && op0 == virtual_stack_vars_rtx diff --git a/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch index cf45e04463..4bbcdcd1f7 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch @@ -1,4 +1,4 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/simplify-rtx.c.patch,v 1.4 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/simplify-rtx.c,v @@ -6,7 +6,7 @@ retrieving revision 1.2 diff -u -r1.2 simplify-rtx.c --- simplify-rtx.c 20 Dec 2004 19:23:24 -0000 1.2 +++ simplify-rtx.c 20 Dec 2004 20:48:13 -0000 -@@ -2287,6 +2287,7 @@ +@@ -2329,6 +2329,7 @@ int n_ops = 2, input_ops = 2, input_consts = 0, n_consts; int first, changed; int i, j; @@ -14,7 +14,7 @@ diff -u -r1.2 simplify-rtx.c memset (ops, 0, sizeof ops); -@@ -2312,6 +2313,10 @@ +@@ -2354,6 +2355,10 @@ switch (this_code) { case PLUS: @@ -25,7 +25,7 @@ diff -u -r1.2 simplify-rtx.c case MINUS: if (n_ops == 7) return NULL_RTX; -@@ -2473,11 +2478,24 @@ +@@ -2515,11 +2520,24 @@ && GET_CODE (ops[n_ops - 1].op) == CONST_INT && CONSTANT_P (ops[n_ops - 2].op)) { @@ -55,7 +55,7 @@ diff -u -r1.2 simplify-rtx.c } /* Count the number of CONSTs that we generated. */ -@@ -2495,6 +2513,59 @@ +@@ -2537,6 +2555,59 @@ || (n_ops + n_consts == input_ops && n_consts <= input_consts))) return NULL_RTX; diff --git a/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch b/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch index 7eb27a0345..fc46b412d0 100644 --- a/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch +++ b/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch @@ -1,23 +1,20 @@ -$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch,v 1.4 2005/08/27 21:03:51 joerg Exp $ =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/toplev.c,v retrieving revision 1.2 -diff -u -r1.2 toplev.c ---- toplev.c 20 Dec 2004 19:23:24 -0000 1.2 -+++ toplev.c 20 Dec 2004 20:48:13 -0000 -@@ -97,6 +97,10 @@ - declarations for e.g. AIX 4.x. */ - #endif - -+#ifdef STACK_PROTECTOR +diff -u -r1.3 toplev.c +--- toplev.c 24 May 2005 06:29:31 -0000 1.3 ++++ toplev.c 27 Aug 2005 16:40:53 -0000 +@@ -79,6 +79,7 @@ + #include "coverage.h" + #include "value-prof.h" + #include "alloc-pool.h" +#include "protector.h" -+#endif -+ - #ifndef HAVE_conditional_execution - #define HAVE_conditional_execution 0 - #endif -@@ -979,6 +983,15 @@ + + #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO) + #include "dwarf2out.h" +@@ -979,6 +980,15 @@ minimum function alignment. Zero means no alignment is forced. */ int force_align_functions_log; @@ -33,7 +30,7 @@ diff -u -r1.2 toplev.c typedef struct { const char *const string; -@@ -1154,7 +1167,9 @@ +@@ -1154,7 +1164,9 @@ {"mem-report", &mem_report, 1 }, { "trapv", &flag_trapv, 1 }, { "wrapv", &flag_wrapv, 1 }, @@ -44,17 +41,19 @@ diff -u -r1.2 toplev.c }; /* Here is a table, controlled by the tm.h file, listing each -m switch -@@ -2686,6 +2701,9 @@ - - insns = get_insns (); +@@ -3163,6 +3175,11 @@ + remove_unnecessary_notes (); + reorder_blocks (); ++ /* In propolice-protection mode, we will change the variables in the ++ stack to be able to detect buffer overflows. */ + if (flag_propolice_protection) -+ prepare_stack_protection (inlinable); ++ prepare_stack_protection (DECL_INLINE (decl)); + - /* Dump the rtl code if we are dumping rtl. */ + ggc_collect (); - if (open_dump_file (DFI_rtl, decl)) -@@ -4483,6 +4501,12 @@ + /* Initialize some variables used by the optimizers. */ +@@ -4485,6 +4502,12 @@ /* The presence of IEEE signaling NaNs, implies all math can trap. */ if (flag_signaling_nans) flag_trapping_math = 1; diff --git a/gnu/usr.bin/cc34/cc_prep/protector.c b/gnu/usr.bin/cc34/cc_prep/protector.c index 98adaacb68..7bc033be14 100644 --- a/gnu/usr.bin/cc34/cc_prep/protector.c +++ b/gnu/usr.bin/cc34/cc_prep/protector.c @@ -1,4 +1,4 @@ -/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/protector.c,v 1.1 2004/06/19 10:34:17 joerg Exp $ */ +/* $DragonFly: src/gnu/usr.bin/cc34/cc_prep/protector.c,v 1.2 2005/08/27 21:03:51 joerg Exp $ */ /* RTL buffer overflow protection function for GNU C compiler Copyright (C) 2003 Free Software Foundation, Inc. @@ -68,8 +68,14 @@ static int current_function_defines_short_string; static int current_function_has_variable_string; static int current_function_defines_vsized_array; static int current_function_is_inlinable; + +/* Nonzero if search_string_def finds the variable which contains an array. */ static int is_array; +/* Nonzero if search_string_def finds a byte-pointer variable, + which may be assigned to alloca output. */ +static int may_have_alloca_pointer; + static rtx guard_area, _guard; static rtx function_first_insn, prologue_insert_point; @@ -277,12 +283,15 @@ search_string_from_argsandvars (int caller) current_function_defines_short_string = FALSE; current_function_has_variable_string = FALSE; current_function_defines_vsized_array = FALSE; + may_have_alloca_pointer = FALSE; /* Search a string variable from local variables. */ blocks = DECL_INITIAL (current_function_decl); string_p = search_string_from_local_vars (blocks); - if (! current_function_defines_vsized_array && current_function_calls_alloca) + if (! current_function_defines_vsized_array + && may_have_alloca_pointer + && current_function_calls_alloca) { current_function_has_variable_string = TRUE; return TRUE; @@ -433,6 +442,14 @@ search_string_def (tree type) break; case POINTER_TYPE: + /* Check if pointer variables, which may be a pointer assigned + by alloca function call, are declared. */ + if (TYPE_MAIN_VARIANT (TREE_TYPE(type)) == char_type_node + || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == signed_char_type_node + || TYPE_MAIN_VARIANT (TREE_TYPE(type)) == unsigned_char_type_node) + may_have_alloca_pointer = TRUE; + break; + case REFERENCE_TYPE: case OFFSET_TYPE: default: @@ -938,7 +955,6 @@ arrange_var_order (tree block) if (! DECL_EXTERNAL (types) && ! TREE_STATIC (types) && TREE_CODE (types) == VAR_DECL && ! DECL_ARTIFICIAL (types) - /* && ! DECL_COPIED (types): gcc3.4 can sweep inlined string. */ && DECL_RTL_SET_P (types) && GET_CODE (DECL_RTL (types)) == MEM && GET_MODE (DECL_RTL (types)) == BLKmode @@ -2278,6 +2294,8 @@ push_frame_of_insns (rtx insn, HOST_WIDE_INT push_size, HOST_WIDE_INT boundary) /* Copy the various flags, and other information. */ memcpy (insn, first, sizeof (struct rtx_def) - sizeof (rtunion)); PATTERN (insn) = PATTERN (first); + INSN_CODE (insn) = INSN_CODE (first); + LOG_LINKS (insn) = LOG_LINKS (first); REG_NOTES (insn) = REG_NOTES (first); /* then remove the first insn of splitted insns. */ diff --git a/gnu/usr.bin/cc34/doc/patches/invoke.texi.patch b/gnu/usr.bin/cc34/doc/patches/invoke.texi.patch index 29938e0e6c..615846f010 100644 --- a/gnu/usr.bin/cc34/doc/patches/invoke.texi.patch +++ b/gnu/usr.bin/cc34/doc/patches/invoke.texi.patch @@ -1,12 +1,12 @@ -$DragonFly: src/gnu/usr.bin/cc34/doc/patches/invoke.texi.patch,v 1.1 2004/12/21 13:10:48 joerg Exp $ +$DragonFly: src/gnu/usr.bin/cc34/doc/patches/invoke.texi.patch,v 1.2 2005/08/27 21:03:52 joerg Exp $ Index: invoke.texi =================================================================== RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/doc/invoke.texi,v -retrieving revision 1.2 -diff -u -r1.2 invoke.texi ---- invoke.texi 20 Dec 2004 19:23:25 -0000 1.2 -+++ invoke.texi 20 Dec 2004 20:57:46 -0000 +retrieving revision 1.4 +diff -u -r1.4 invoke.texi +--- invoke.texi 10 Aug 2005 15:50:46 -0000 1.4 ++++ invoke.texi 27 Aug 2005 16:44:10 -0000 @@ -183,7 +183,8 @@ -fno-optional-diags -fpermissive @gol -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol @@ -17,7 +17,20 @@ diff -u -r1.2 invoke.texi -Wnon-virtual-dtor -Wreorder @gol -Weffc++ -Wno-deprecated @gol -Wno-non-template-friend -Wold-style-cast @gol -@@ -675,7 +676,8 @@ +@@ -227,7 +228,7 @@ + -Wno-multichar -Wnonnull -Wpacked -Wpadded @gol + -Wparentheses -Wpointer-arith -Wredundant-decls @gol + -Wreturn-type -Wsequence-point -Wshadow @gol +--Wsign-compare -Wstrict-aliasing @gol ++-Wsign-compare -Wstack-protector -Wstrict-aliasing @gol + -Wswitch -Wswitch-default -Wswitch-enum @gol + -Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol + -Wunknown-pragmas -Wunreachable-code @gol +@@ -675,10 +676,12 @@ + -fshort-double -fshort-wchar @gol + -fverbose-asm -fpack-struct -fstack-check @gol + -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol ++-fstack-protector -fstack-protector-all @gol -fargument-alias -fargument-noalias @gol -fargument-noalias-global -fleading-underscore @gol -ftls-model=@var{model} @gol @@ -27,7 +40,7 @@ diff -u -r1.2 invoke.texi @end table @menu -@@ -1434,6 +1436,20 @@ +@@ -1437,6 +1440,20 @@ destructors, but will only work if your C library supports @code{__cxa_atexit}. @@ -48,7 +61,43 @@ diff -u -r1.2 invoke.texi @item -fno-weak @opindex fno-weak Do not use weak symbol support, even if it is provided by the linker. -@@ -11225,6 +11241,54 @@ +@@ -2986,6 +3003,10 @@ + complex; GCC will refuse to optimize programs when the optimization + itself is likely to take inordinate amounts of time. + ++@item -Wstack-protector ++@opindex Wstack-protector ++Warn when not issuing stack smashing protection for some reason. ++ + @item -Werror + @opindex Werror + Make all warnings into errors. +@@ -11232,6 +11253,24 @@ + @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit + of 128KB@. Note that this may only work with the GNU linker. + ++@item -fstack-protector ++@item -fstack-protector-all ++@opindex fstack-protector ++@opindex fstack-protector-all ++@opindex fno-stack-protector ++Generate code to protect an application from a stack smashing ++attack. The features are (1) the insertion of random value next to the ++frame pointer to detect the integrity of the stack, (2) the reordering ++of local variables to place buffers after pointers to avoid the ++corruption of pointers that could be used to further corrupt arbitrary ++memory locations, (3) the copying of pointers in function arguments to ++an area preceding local variable buffers to prevent the corruption of ++pointers that could be used to further corrupt arbitrary memory ++locations, and the (4) omission of instrumentation code from some ++functions to decrease the performance overhead. If the integrity ++would be broken, the program is aborted. If stack-protector-all is ++specified, instrumentation codes are generated at every functions. ++ + @cindex aliasing of parameters + @cindex parameters, aliased + @item -fargument-alias +@@ -11271,6 +11310,54 @@ The default without @option{-fpic} is @code{initial-exec}; with @option{-fpic} the default is @code{global-dynamic}. -- 2.41.0