summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6/gcc-poison-parameters.patch
blob: 58bf32fd022aa3bf6ce8af6edad059d01943b666 (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
Upstream-Status: Pending

gcc: add poison parameters detection

Add the logic that, if not configured with "--enable-target-optspace",
gcc will meet error when build target app with "-Os" option.
This could avoid potential binary crash.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>

Index: gcc-4.6.0/gcc/config.in
===================================================================
--- gcc-4.6.0.orig/gcc/config.in
+++ gcc-4.6.0/gcc/config.in
@@ -150,6 +150,12 @@
 #endif
 
 
+/* Define to enable target optspace support. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_TARGET_OPTSPACE
+#endif
+
+
 /* Define if you want all operations on RTL (the basic data structure of the
    optimizer and back end) to be checked for dynamic type safety at runtime.
    This is quite expensive. */
Index: gcc-4.6.0/gcc/configure
===================================================================
--- gcc-4.6.0.orig/gcc/configure
+++ gcc-4.6.0/gcc/configure
@@ -26434,6 +26434,13 @@ $as_echo "#define ENABLE_LIBQUADMATH_SUP
 fi
 
 
+if test x"$enable_target_optspace" != x; then :
+
+$as_echo "#define ENABLE_TARGET_OPTSPACE 1" >>confdefs.h
+
+fi
+
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
Index: gcc-4.6.0/gcc/configure.ac
===================================================================
--- gcc-4.6.0.orig/gcc/configure.ac
+++ gcc-4.6.0/gcc/configure.ac
@@ -4907,6 +4907,11 @@ if test "${ENABLE_LIBQUADMATH_SUPPORT}"
 fi
 
 
+AC_SUBST(enable_target_optspace)
+if test x"$enable_target_optspace" != x; then
+  AC_DEFINE(ENABLE_TARGET_OPTSPACE, 1, [Define to enable target optspace support.])
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
Index: gcc-4.6.0/gcc/opts.c
===================================================================
--- gcc-4.6.0.orig/gcc/opts.c
+++ gcc-4.6.0/gcc/opts.c
@@ -605,6 +605,10 @@ default_options_optimization (struct gcc
     maybe_set_param_value (PARAM_MIN_CROSSJUMP_INSNS,
 			   default_param_value (PARAM_MIN_CROSSJUMP_INSNS),
 			   opts->x_param_values, opts_set->x_param_values);
+#ifndef ENABLE_TARGET_OPTSPACE
+  if (optimize_size == 1)
+    error ("Do not use -Os option if --enable-target-optspace is not set.");
+#endif
 
   /* Allow default optimizations to be specified on a per-machine basis.  */
   maybe_default_options (opts, opts_set,