diff options
| author | Ross Burton <ross@burtonini.com> | 2021-03-08 18:01:50 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-10 10:30:39 +0000 |
| commit | 036dd67bf6a35f212ef966228f3fee7a5a9c6cbe (patch) | |
| tree | 1ee9ae5af41920d03917466c8c256e1199e96562 /meta/recipes-devtools | |
| parent | 81adf49416eeaa16accd028e4c24db2a818cd44b (diff) | |
| download | poky-036dd67bf6a35f212ef966228f3fee7a5a9c6cbe.tar.gz | |
gcc: add an option for --enable-poison-system-directories to be fatal
Extend --enable-poison-system-directories so that it can be an error
instead of a warning by default.
(From OE-Core rev: 1fcaa5f452b2c6b93a6f3dfd57f894cbef5e3379)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch index 30a8486016..333d543dd9 100644 --- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch | |||
| @@ -44,7 +44,7 @@ diff --git a/gcc/config.in b/gcc/config.in | |||
| 44 | index 809e7b26823..5adeaeed36b 100644 | 44 | index 809e7b26823..5adeaeed36b 100644 |
| 45 | --- a/gcc/config.in | 45 | --- a/gcc/config.in |
| 46 | +++ b/gcc/config.in | 46 | +++ b/gcc/config.in |
| 47 | @@ -224,6 +224,12 @@ | 47 | @@ -224,6 +224,16 @@ |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | 50 | ||
| @@ -52,6 +52,10 @@ index 809e7b26823..5adeaeed36b 100644 | |||
| 52 | +#ifndef USED_FOR_TARGET | 52 | +#ifndef USED_FOR_TARGET |
| 53 | +#undef ENABLE_POISON_SYSTEM_DIRECTORIES | 53 | +#undef ENABLE_POISON_SYSTEM_DIRECTORIES |
| 54 | +#endif | 54 | +#endif |
| 55 | +/* Define to warn for use of native system header directories */ | ||
| 56 | +#ifndef USED_FOR_TARGET | ||
| 57 | +#undef POISON_BY_DEFAULT | ||
| 58 | +#endif | ||
| 55 | + | 59 | + |
| 56 | + | 60 | + |
| 57 | /* Define if you want all operations on RTL (the basic data structure of the | 61 | /* Define if you want all operations on RTL (the basic data structure of the |
| @@ -78,7 +82,7 @@ index cd3d9516fce..8de766a942c 100755 | |||
| 78 | --enable-plugin enable plugin support | 82 | --enable-plugin enable plugin support |
| 79 | --enable-host-shared build host code as shared libraries | 83 | --enable-host-shared build host code as shared libraries |
| 80 | --disable-libquadmath-support | 84 | --disable-libquadmath-support |
| 81 | @@ -30235,6 +30238,19 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : | 85 | @@ -30235,6 +30238,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then : |
| 82 | fi | 86 | fi |
| 83 | 87 | ||
| 84 | 88 | ||
| @@ -89,9 +93,12 @@ index cd3d9516fce..8de766a942c 100755 | |||
| 89 | + enable_poison_system_directories=no | 93 | + enable_poison_system_directories=no |
| 90 | +fi | 94 | +fi |
| 91 | + | 95 | + |
| 92 | +if test "x${enable_poison_system_directories}" = "xyes"; then | 96 | +if test "x${enable_poison_system_directories}" != "xno"; then |
| 93 | + | 97 | + |
| 94 | +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h | 98 | +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h |
| 99 | +if test "$enable_poison_system_directories" = "error"; then | ||
| 100 | +$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h | ||
| 101 | +fi | ||
| 95 | + | 102 | + |
| 96 | +fi | 103 | +fi |
| 97 | + | 104 | + |
| @@ -198,3 +205,46 @@ index 8a2bda00f80..9098ab044ab 100644 | |||
| 198 | } | 205 | } |
| 199 | 206 | ||
| 200 | /* Use given -I paths for #include "..." but not #include <...>, and | 207 | /* Use given -I paths for #include "..." but not #include <...>, and |
| 208 | diff --git a/gcc/configure.ac b/gcc/configure.ac | ||
| 209 | index f42006e5476..de7e176ea53 100644 | ||
| 210 | --- a/gcc/configure.ac | ||
| 211 | +++ b/gcc/configure.ac | ||
| 212 | @@ -6602,12 +6602,18 @@ AC_ARG_ENABLE(version-specific-runtime-libs, | ||
| 213 | |||
| 214 | AC_ARG_ENABLE([poison-system-directories], | ||
| 215 | AS_HELP_STRING([--enable-poison-system-directories], | ||
| 216 | - [warn for use of native system header directories]),, | ||
| 217 | + [warn for use of native system header directories (no/yes/error)]),, | ||
| 218 | [enable_poison_system_directories=no]) | ||
| 219 | +AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories]) | ||
| 220 | -if test "x${enable_poison_system_directories}" = "xyes"; then | ||
| 221 | +if test "x${enable_poison_system_directories}" != "xno"; then | ||
| 222 | + AC_MSG_NOTICE([poisoned directories enabled]) | ||
| 223 | AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], | ||
| 224 | [1], | ||
| 225 | [Define to warn for use of native system header directories]) | ||
| 226 | + if test $enable_poison_system_directories = "error"; then | ||
| 227 | + AC_MSG_NOTICE([poisoned directories are fatal]) | ||
| 228 | + AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors]) | ||
| 229 | + fi | ||
| 230 | fi | ||
| 231 | |||
| 232 | # Substitute configuration variables | ||
| 233 | diff --git a/gcc/gcc.c b/gcc/gcc.c | ||
| 234 | index b2200c5185a..fa7b6fc8ddb 100644 | ||
| 235 | --- a/gcc/gcc.c | ||
| 236 | +++ b/gcc/gcc.c | ||
| 237 | @@ -1136,8 +1136,11 @@ static const char *cpp_unique_options = | ||
| 238 | static const char *cpp_options = | ||
| 239 | "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ | ||
| 240 | %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ | ||
| 241 | - %{!fno-working-directory:-fworking-directory}}} %{O*}\ | ||
| 242 | - %{undef} %{save-temps*:-fpch-preprocess}"; | ||
| 243 | + %{!fno-working-directory:-fworking-directory}}} %{O*}" | ||
| 244 | +#ifdef POISON_BY_DEFAULT | ||
| 245 | + " -Werror=poison-system-directories" | ||
| 246 | +#endif | ||
| 247 | + " %{undef} %{save-temps*:-fpch-preprocess}"; | ||
| 248 | |||
| 249 | /* This contains cpp options which are not passed when the preprocessor | ||
| 250 | output will be used by another program. */ | ||
