7eb27a0345a48cd00b0ff3c0c99266131909f5ab
[dragonfly.git] / gnu / usr.bin / cc34 / cc_prep / patches / toplev.c.patch
1 $DragonFly: src/gnu/usr.bin/cc34/cc_prep/patches/toplev.c.patch,v 1.3 2004/12/21 13:10:48 joerg Exp $
2
3 ===================================================================
4 RCS file: /home/joerg/wd/repository/dragonflybsd/src/contrib/gcc-3.4/gcc/toplev.c,v
5 retrieving revision 1.2
6 diff -u -r1.2 toplev.c
7 --- toplev.c    20 Dec 2004 19:23:24 -0000      1.2
8 +++ toplev.c    20 Dec 2004 20:48:13 -0000
9 @@ -97,6 +97,10 @@
10                                    declarations for e.g. AIX 4.x.  */
11  #endif
12  
13 +#ifdef STACK_PROTECTOR
14 +#include "protector.h"
15 +#endif
16 +
17  #ifndef HAVE_conditional_execution
18  #define HAVE_conditional_execution 0
19  #endif
20 @@ -979,6 +983,15 @@
21     minimum function alignment.  Zero means no alignment is forced.  */
22  int force_align_functions_log;
23  
24 +#if defined(STACK_PROTECTOR) && defined(STACK_GROWS_DOWNWARD)
25 +/* Nonzero means use propolice as a stack protection method */
26 +int flag_propolice_protection = 1;
27 +int flag_stack_protection = 0;
28 +#else
29 +int flag_propolice_protection = 0;
30 +int flag_stack_protection = 0;
31 +#endif
32 +
33  typedef struct
34  {
35    const char *const string;
36 @@ -1154,7 +1167,9 @@
37    {"mem-report", &mem_report, 1 },
38    { "trapv", &flag_trapv, 1 },
39    { "wrapv", &flag_wrapv, 1 },
40 -  { "new-ra", &flag_new_regalloc, 1 }
41 +  { "new-ra", &flag_new_regalloc, 1 },
42 +  {"stack-protector", &flag_propolice_protection, 1 },
43 +  {"stack-protector-all", &flag_stack_protection, 1 }
44  };
45  
46  /* Here is a table, controlled by the tm.h file, listing each -m switch
47 @@ -2686,6 +2701,9 @@
48  
49    insns = get_insns ();
50  
51 +  if (flag_propolice_protection)
52 +    prepare_stack_protection (inlinable);
53 +
54    /* Dump the rtl code if we are dumping rtl.  */
55  
56    if (open_dump_file (DFI_rtl, decl))
57 @@ -4483,6 +4501,12 @@
58      /* The presence of IEEE signaling NaNs, implies all math can trap.  */
59      if (flag_signaling_nans)
60        flag_trapping_math = 1;
61 +
62 +  /* This combination makes optimized frame addressings and causes
63 +    a internal compilation error at prepare_stack_protection.
64 +    so don't allow it.  */
65 +  if (flag_stack_protection && !flag_propolice_protection)
66 +    flag_propolice_protection = TRUE;
67  }
68  
69  /* Initialize the compiler back end.  */