summaryrefslogtreecommitdiff
path: root/gnu/egcs/gcc/gcse.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-12-02 09:00:27 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-12-02 09:00:27 +0000
commit22703df0df76accb65607f28070a9771b5bb42de (patch)
tree2f2aa0ebf948ee4580b10bb0a41b7f258b40d0e8 /gnu/egcs/gcc/gcse.c
parent560fab27442ac85618b1720e90581c295ae1ea83 (diff)
Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stack
attack protection scheme, into gcc. This protection is enabled by default. It can be turned off by using the -fno-stack-protector flag. Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and myself; beer drinking by myself. Please note that system upgrades with this new code will require a new libc and ld.so to be build and installed before the propolice-enabled compiler can be installed.
Diffstat (limited to 'gnu/egcs/gcc/gcse.c')
-rw-r--r--gnu/egcs/gcc/gcse.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/gnu/egcs/gcc/gcse.c b/gnu/egcs/gcc/gcse.c
index d7fde36ecd8..3dab465ee4b 100644
--- a/gnu/egcs/gcc/gcse.c
+++ b/gnu/egcs/gcc/gcse.c
@@ -1394,6 +1394,7 @@ hash_expr_1 (x, mode, do_not_record_p)
return 0;
}
hash += (unsigned) MEM;
+ hash += MEM_ALIAS_SET (x);
x = XEXP (x, 0);
goto repeat;
@@ -1526,6 +1527,14 @@ expr_equiv_p (x, y)
case REG:
return REGNO (x) == REGNO (y);
+ case MEM:
+ /* Can't merge two expressions in different alias sets, since we can
+ decide that the expression is transparent in a block when it isn't,
+ due to it being set with the different alias set. */
+ if (MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y))
+ return 0;
+ break;
+
/* For commutative operations, check both orders. */
case PLUS:
case MULT:
@@ -3709,7 +3718,7 @@ cprop_insn (insn, alter_jumps)
/* Find an assignment that sets reg_used and is available
at the start of the block. */
set = find_avail_set (regno, insn);
- if (! set)
+ if (! set || set->expr->volatil)
continue;
pat = set->expr;
@@ -4189,9 +4198,26 @@ insert_insn_end_bb (expr, bb, pre)
}
}
- new_insn = emit_insn_before (pat, insn);
- if (BLOCK_HEAD (bb) == insn)
- BLOCK_HEAD (bb) = new_insn;
+ /* If we found all the parameter loads, then we want to insert
+ before the first parameter load.
+
+ If we did not find all the parameter loads, then we might have
+ stopped on the head of the block, which could be a CODE_LABEL.
+ If we inserted before the CODE_LABEL, then we would be putting
+ the insn in the wrong basic block. In that case, put the insn
+ after the CODE_LABEL.
+
+ ?!? Do we need to account for NOTE_INSN_BASIC_BLOCK here? */
+ if (GET_CODE (insn) != CODE_LABEL)
+ {
+ new_insn = emit_insn_before (pat, insn);
+ if (BLOCK_HEAD (bb) == insn)
+ BLOCK_HEAD (bb) = new_insn;
+ }
+ else
+ {
+ new_insn = emit_insn_after (pat, insn);
+ }
}
else
{