summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-01-21 18:23:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-22 13:20:29 +0000
commit310f9cd967f81869b27c4542a0015cf76c3e2c84 (patch)
tree65f1bf2af5342a34619e69ea5ea02c59cf2c19d7 /meta
parent1c5a2c8bcc96b8bdfc5186d75953dfabd4b3842a (diff)
downloadpoky-310f9cd967f81869b27c4542a0015cf76c3e2c84.tar.gz
gcc: make include poisoning fatal again in gcc/g++
We have a patch to allow us to 'poison' system include directories, which are warnings by default but we make them fatal in cross builds. However, in the 13.1 upgrade[1] the patch to make the warnings fatal was dropped in the compiler invocation, so it only took effect for pure preprocessor calls. This was not noticed at the time as the test case was flawed, but this has now been fixed. Add back the fatal poisoning, and restructure the patch slightly so it is less invasive. [1] oe-core bea46612fd9106cc5b46eb1d81623b6492563c13 [RP: Tweak to fix gcc/gcc-cross-canadian failure] (From OE-Core rev: 56f21a02c009cb74072ee79467a5bcab3c4643a5) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch37
1 files changed, 27 insertions, 10 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 367c9e3821..8523af1281 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
@@ -160,10 +160,23 @@ index f82f7d2817b..1da91813b0e 100644
160 @opindex Wno-float-equal 160 @opindex Wno-float-equal
161 @item -Wfloat-equal 161 @item -Wfloat-equal
162diff --git a/gcc/gcc.cc b/gcc/gcc.cc 162diff --git a/gcc/gcc.cc b/gcc/gcc.cc
163index 728332b8153..343e4915097 100644 163index 728332b8153..a63f128cb95 100644
164--- a/gcc/gcc.cc 164--- a/gcc/gcc.cc
165+++ b/gcc/gcc.cc 165+++ b/gcc/gcc.cc
166@@ -1159,6 +1159,8 @@ proper position among the other output files. */ 166@@ -902,6 +902,12 @@ proper position among the other output files. */
167 #define ASM_MAP ""
168 #endif
169
170+#ifdef POISON_BY_DEFAULT
171+#define POISON_IS_ERROR " -Werror=poison-system-directories"
172+#else
173+#define POISON_IS_ERROR
174+#endif
175+
176 /* Assembler options for compressed debug sections. */
177 #if HAVE_LD_COMPRESS_DEBUG == 0
178 /* Reject if the linker cannot write compressed debug sections. */
179@@ -1159,6 +1163,8 @@ proper position among the other output files. */
167 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ 180 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
168 "%X %{o*} %{e*} %{N} %{n} %{r}\ 181 "%X %{o*} %{e*} %{N} %{n} %{r}\
169 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \ 182 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@@ -172,20 +185,24 @@ index 728332b8153..343e4915097 100644
172 %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \ 185 %{static|no-pie|static-pie:} %@{L*} %(link_libgcc) " \
173 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ 186 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
174 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ 187 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
175@@ -1260,8 +1262,11 @@ static const char *cpp_unique_options = 188@@ -1261,7 +1267,7 @@ static const char *cpp_options =
176 static const char *cpp_options =
177 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ 189 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
178 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\ 190 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
179- %{!fno-working-directory:-fworking-directory}}} %{O*}\ 191 %{!fno-working-directory:-fworking-directory}}} %{O*}\
180- %{undef} %{save-temps*:-fpch-preprocess}"; 192- %{undef} %{save-temps*:-fpch-preprocess}";
181+ %{!fno-working-directory:-fworking-directory}}} %{O*}" 193+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR;
182+#ifdef POISON_BY_DEFAULT
183+ " -Werror=poison-system-directories"
184+#endif
185+ " %{undef} %{save-temps*:-fpch-preprocess}";
186 194
187 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al. 195 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
188 196
197@@ -1290,7 +1296,7 @@ static const char *cc1_options =
198 %{coverage:-fprofile-arcs -ftest-coverage}\
199 %{fprofile-arcs|fcondition-coverage|fprofile-generate*|coverage:\
200 %{!fprofile-update=single:\
201- %{pthread:-fprofile-update=prefer-atomic}}}";
202+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR;
203
204 static const char *asm_options =
205 "%{-target-help:%:print-asm-header()} "
189diff --git a/gcc/incpath.cc b/gcc/incpath.cc 206diff --git a/gcc/incpath.cc b/gcc/incpath.cc
190index 64cdd2f4a..89f42900d 100644 207index 64cdd2f4a..89f42900d 100644
191--- a/gcc/incpath.cc 208--- a/gcc/incpath.cc