aboutsummaryrefslogtreecommitdiff
blob: 47a1a051d134ff4354b71c2e4930f7bbd5e6b773 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
--- a/configure	2013-02-05 23:36:20.000000000 +0100
+++ b/configure	2013-02-12 01:59:04.000000000 +0100
@@ -670,6 +670,7 @@
 CFLAGS
 CC
 EXTRA_CONFIGARGS_LIBJAVA
+enable_esp
 target_subdir
 host_subdir
 build_subdir
@@ -748,6 +749,7 @@
 enable_libquadmath
 enable_libquadmath_support
 enable_libada
+enable_esp
 enable_libssp
 enable_libstdcxx
 enable_static_libjava
@@ -1464,6 +1466,11 @@
   --disable-libquadmath-support
                           disable libquadmath support for Fortran
   --enable-libada         build libada directory
+  --enable-esp            Enable Stack protector and Position independent
+                          executable as default if we have suppot for it when
+                          compiling and link with -z relro and -z now as
+                          default. Linux targets supported i*86, x86_64, x32,
+                          powerpc, powerpc64, ia64 and arm.
   --enable-libssp         build libssp directory
   --disable-libstdcxx     do not build libstdc++-v3 directory
   --enable-static-libjava[=ARG]
@@ -3068,6 +3075,24 @@
   noconfigdirs="$noconfigdirs gnattools"
 fi
 
+# Check whether --enable-esp was given and target have the support.
+# Check whether --enable-esp was given.
+if test "${enable_esp+set}" = set; then :
+  enableval=$enable_esp;
+  case $target in
+    i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
+      enable_esp=yes
+      ;;
+    *)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** --enable-esp is not supported on this $target target." >&5
+$as_echo "$as_me: WARNING: *** --enable-esp is not supported on this $target target." >&2;}
+      ;;
+  esac
+
+fi
+
+
+
 # Check whether --enable-libssp was given.
 if test "${enable_libssp+set}" = set; then :
   enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
@@ -14453,6 +14478,11 @@
     esac ;;
 esac
 
+# Disable -fstack-protector on stage1
+if test x$enable_esp = xyes; then
+  stage1_cflags="$stage1_cflags -fno-stack-protector"
+fi
+
 
 
 # Enable --enable-checking in stage1 of the compiler.
--- a/gcc/configure	2013-02-01 21:26:24.000000000 +0100
+++ b/gcc/configure	2013-02-12 01:59:20.000000000 +0100
@@ -600,6 +600,8 @@
 
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+enable_crtbeginP
+enable_esp
 enable_plugin
 pluginlibs
 CLOOGINC
@@ -920,6 +922,7 @@
 enable_plugin
 enable_libquadmath_support
 with_linker_hash_style
+enable_esp
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1633,6 +1636,11 @@
   --enable-plugin         enable plugin support
   --disable-libquadmath-support
                           disable libquadmath support for Fortran
+  --enable-esp            Enable Stack protector and Position independent
+                          executable as default if we have suppot for it when
+                          compiling and link with -z relro and -z now as
+                          default. Linux targets supported i*86, x86_64, x32,
+                          powerpc, powerpc64, ia64 and arm.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -27419,6 +27427,59 @@
 
 fi
 
+# --------------
+# Esp checks
+# --------------
+
+# Check whether --enable-esp was given and target have the support.
+# Check whether --enable-esp was given.
+if test "${enable_esp+set}" = set; then :
+  enableval=$enable_esp; enable_esp=$enableval
+else
+  enable_esp=no
+fi
+
+if test $enable_esp = yes ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5
+$as_echo_n "checking if $target support esp... " >&6; }
+  case "$target" in
+    i?86*-*-linux* | x86_64-*-linux* | powerpc-*-linux* | powerpc64-*-linux* | arm*-*-linux* | ia64-*-linux*)
+      enable_esp=yes
+
+$as_echo "#define ENABLE_ESP 1" >>confdefs.h
+
+      ;;
+    *)
+      enable_esp=no
+      ;;
+  esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5
+$as_echo "$enable_esp" >&6; }
+fi
+
+if test $enable_esp = yes ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5
+$as_echo_n "checking checking for crtbeginP.o support... " >&6; }
+    if test x$enable_esp = xyes ; then
+      case "$target" in
+        ia64*-*-linux*)
+          enable_crtbeginP=no ;;
+        *-*-linux*)
+          if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then
+            enable_crtbeginP=yes
+
+$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h
+
+          fi
+          ;;
+        *) enable_crtbeginP=no ;;
+      esac
+    fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5
+$as_echo "$enable_crtbeginP" >&6; }
+fi
+
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)