summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/gcc/gcc-4.5/gcc-poison-parameters.patch
blob: ba20e8b15e9338ef0f2e41445899a75a9e06169a (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
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_5-branch/gcc/config.in
===================================================================
--- gcc-4_5-branch.orig/gcc/config.in
+++ gcc-4_5-branch/gcc/config.in
@@ -138,6 +138,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_5-branch/gcc/configure
===================================================================
--- gcc-4_5-branch.orig/gcc/configure
+++ gcc-4_5-branch/gcc/configure
@@ -915,6 +915,7 @@ enable_version_specific_runtime_libs
 with_slibdir
 enable_poison_system_directories
 enable_plugin
+enable_target_optspace
 '
       ac_precious_vars='build_alias
 host_alias
@@ -25658,6 +25659,13 @@ $as_echo "#define ENABLE_PLUGIN 1" >>con
 
 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_5-branch/gcc/configure.ac
===================================================================
--- gcc-4_5-branch.orig/gcc/configure.ac
+++ gcc-4_5-branch/gcc/configure.ac
@@ -4659,6 +4659,11 @@ if test x"$enable_plugin" = x"yes"; then
   AC_DEFINE(ENABLE_PLUGIN, 1, [Define to enable plugin 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_5-branch/gcc/opts.c
===================================================================
--- gcc-4_5-branch.orig/gcc/opts.c
+++ gcc-4_5-branch/gcc/opts.c
@@ -953,6 +953,11 @@ decode_options (unsigned int argc, const
   else
     set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
 
+#ifndef ENABLE_TARGET_OPTSPACE
+  if (optimize_size == 1)
+    error ("Do not use -Os option if --enable-target-optspace is not set.");
+#endif
+
   if (first_time_p)
     {
       /* Initialize whether `char' is signed.  */