1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/function.c.patch,v 1.2 2004/06/20 00:10:52 joerg Exp $
3 diff -u ../gcc.orig/function.c function.c
4 --- ../gcc.orig/function.c 2004-06-19 22:27:11.000000000 +0200
5 +++ function.c 2004-06-20 01:16:04.000000000 +0200
10 +#include "protector.h"
12 #ifndef TRAMPOLINE_ALIGNMENT
13 #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
15 /* Array of INSN_UIDs to hold the INSN_UIDs for each sibcall epilogue
17 static GTY(()) varray_type sibcall_epilogue;
19 +/* Current boundary mark for character arrays. */
20 +static int temp_boundary_mark = 0;
23 /* In order to evaluate some expressions, such as function calls returning
24 structures in memory, we need to temporarily allocate stack locations.
26 /* The size of the slot, including extra space for alignment. This
27 info is for combine_temp_slots. */
28 HOST_WIDE_INT full_size;
29 + /* Boundary mark of a character array and the others. This info is for propolice. */
33 /* This structure is used to record MEMs or pseudos used to replace VAR, any
35 whose lifetime is controlled by CLEANUP_POINT_EXPRs. KEEP is 3
36 if we are to allocate something at an inner level to be treated as
37 a variable in the block (e.g., a SAVE_EXPR).
38 + KEEP is 5 if we allocate a place to return structure.
40 TYPE is the type that will be used for the stack slot. */
44 struct temp_slot *p, *best_p = 0;
46 + int char_array = (flag_propolice_protection
47 + && keep == 1 && search_string_def (type));
49 /* If SIZE is -1 it means that somebody tried to allocate a temporary
50 of a variable size. */
53 && objects_must_conflict_p (p->type, type)
54 && (best_p == 0 || best_p->size > p->size
55 - || (best_p->size == p->size && best_p->align > p->align)))
56 + || (best_p->size == p->size && best_p->align > p->align))
57 + && (! char_array || p->boundary_mark != 0))
59 if (p->align == align && p->size == size)
64 p->type = best_p->type;
65 + p->boundary_mark = best_p->boundary_mark;
70 p->full_size = frame_offset - frame_offset_old;
73 + p->boundary_mark = char_array ? ++temp_boundary_mark : 0;
79 if (! q->in_use && GET_MODE (q->slot) == BLKmode)
81 - if (p->base_offset + p->full_size == q->base_offset)
82 + if (p->base_offset + p->full_size == q->base_offset &&
83 + p->boundary_mark == q->boundary_mark)
85 /* Q comes after P; combine Q into P. */
87 p->full_size += q->full_size;
90 - else if (q->base_offset + q->full_size == p->base_offset)
91 + else if (q->base_offset + q->full_size == p->base_offset &&
92 + p->boundary_mark == q->boundary_mark)
94 /* P comes after Q; combine P into Q. */
100 - new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func);
102 + assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func)
103 + : assign_stack_local_for_pseudo_reg (decl_mode, GET_MODE_SIZE (decl_mode), 0);
106 PUT_MODE (reg, decl_mode);
107 @@ -3930,7 +3947,8 @@
108 constant with that register. */
109 temp = gen_reg_rtx (Pmode);
111 - if (validate_change (object, &XEXP (x, 1), temp, 0))
112 + if (validate_change (object, &XEXP (x, 1), temp, 0)
113 + && !flag_propolice_protection)
114 emit_insn_before (gen_move_insn (temp, new_offset), object);