diff options
author | 2004-01-22 05:12:05 +0000 | |
---|---|---|
committer | 2004-01-22 05:12:05 +0000 | |
commit | 295e53d0aed10ee350c1e27a9bf2ff53a1e9f425 (patch) | |
tree | 5c1c20cebebf7ef4f1b486b220af93c324cb496d | |
parent | initial release of propolice gcc 3.3.2 (diff) | |
download | wireguard-openbsd-295e53d0aed10ee350c1e27a9bf2ff53a1e9f425.tar.xz wireguard-openbsd-295e53d0aed10ee350c1e27a9bf2ff53a1e9f425.zip |
to fix the issue "missing return at end of function and ProPolice", calculate_can_reach_end skips the NOTE_INSN_FUNCTION_END with _ssp_ label to the original NOTE_INSN_FUNCTION_END.
ok otto
-rw-r--r-- | gnu/egcs/gcc/jump.c | 26 | ||||
-rw-r--r-- | gnu/egcs/gcc/protector.c | 2 | ||||
-rw-r--r-- | gnu/egcs/gcc/protector.h | 1 |
3 files changed, 28 insertions, 1 deletions
diff --git a/gnu/egcs/gcc/jump.c b/gnu/egcs/gcc/jump.c index 32eebd1eb6c..bebe2f8af6f 100644 --- a/gnu/egcs/gcc/jump.c +++ b/gnu/egcs/gcc/jump.c @@ -65,6 +65,7 @@ Boston, MA 02111-1307, USA. */ #include "real.h" #include "except.h" #include "toplev.h" +#include "protector.h" /* ??? Eventually must record somehow the labels used by jumps from nested functions. */ @@ -2533,6 +2534,31 @@ calculate_can_reach_end (last, check_deleted, delete_final_note) return 1; } + /* If the NOTE_INSN_FUNCTION_END is generated by the stack protector, + skip to the label insn before protector's epilogue insns. */ + if (flag_propolice_protection + && insn != NULL_RTX + && GET_CODE (insn) == NOTE + && NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END + && NOTE_SOURCE_FILE (insn) + && strcmp (NOTE_SOURCE_FILE (insn), SSP_DUMMY_FILE) == 0) + { + /* found ssp handler and skip to the first insn of ssp handler */ + int n_labels = 1; + + while (insn != NULL_RTX) + { + if (GET_CODE (insn) == CODE_LABEL && n_labels-- <= 0) + { + return calculate_can_reach_end (insn, check_deleted, + delete_final_note); + } + + insn = PREV_INSN (insn); + } + return 0; + } + return 0; } diff --git a/gnu/egcs/gcc/protector.c b/gnu/egcs/gcc/protector.c index 41c034256fd..ea2b65fa55d 100644 --- a/gnu/egcs/gcc/protector.c +++ b/gnu/egcs/gcc/protector.c @@ -883,7 +883,7 @@ rtl_epilogue (insn) /* Mark the end of the function body. If control reaches this insn, the function can drop through without returning a value. */ - emit_note (NULL_PTR, NOTE_INSN_FUNCTION_END); + emit_note (SSP_DUMMY_FILE, NOTE_INSN_FUNCTION_END); if (end_label) emit_label (end_label); diff --git a/gnu/egcs/gcc/protector.h b/gnu/egcs/gcc/protector.h index 710ff2f88c4..9391ab4fafa 100644 --- a/gnu/egcs/gcc/protector.h +++ b/gnu/egcs/gcc/protector.h @@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */ /* declaration of GUARD variable */ #define GUARD_m Pmode #define UNITS_PER_GUARD MAX(BIGGEST_ALIGNMENT / BITS_PER_UNIT, GET_MODE_SIZE (GUARD_m)) +#define SSP_DUMMY_FILE "_ssp_" #ifndef L_stack_smash_handler |