* [PATCH 1/3] meta-selftest/poison: improve sysroot poisoning test case
@ 2022-09-07 13:02 Ross Burton
2022-09-07 13:02 ` [PATCH 2/3] gcc-cross: pass -Werror=poison-system-directories to compiler stages Ross Burton
2022-09-07 13:02 ` [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch Ross Burton
0 siblings, 2 replies; 5+ messages in thread
From: Ross Burton @ 2022-09-07 13:02 UTC (permalink / raw)
To: openembedded-core; +Cc: nd
It was discovered by Martin Jansa that the sysroot poisoning errors are
not functioning as they should. Due to either a bug from day 1 or a
bad rebase, -Werror=poison-system-directories is only passed when GCC
is invoking _just_ the preprocessor, not the compiler.
Demonstrate this by expanding the test case to exercise not just $CPP,
but also $CC for both C and C++ languages. This improved test case now
fails.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta-selftest/recipes-test/poison/poison.bb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/meta-selftest/recipes-test/poison/poison.bb b/meta-selftest/recipes-test/poison/poison.bb
index 7ace901cc3a..e9eee0cdbab 100644
--- a/meta-selftest/recipes-test/poison/poison.bb
+++ b/meta-selftest/recipes-test/poison/poison.bb
@@ -9,8 +9,12 @@ inherit nopackages
# will result in compiler errors. This recipe should will fail to build and
# oe-selftest has a test that verifies that.
do_compile() {
- touch empty.c
- ${CPP} ${CFLAGS} -I/usr/include empty.c
+ bbnote Testing preprocessor
+ echo "int main(int argc, char** argv) {}" | ${CPP} -I/usr/include -
+ bbnote Testing C compiler
+ echo "int main(int argc, char** argv) {}" | ${CC} -x c -I/usr/include -
+ bbnote Testing C++ compiler
+ echo "int main(int argc, char** argv) {}" | ${CC} -x c++ -I/usr/include -
}
EXCLUDE_FROM_WORLD = "1"
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] gcc-cross: pass -Werror=poison-system-directories to compiler stages
2022-09-07 13:02 [PATCH 1/3] meta-selftest/poison: improve sysroot poisoning test case Ross Burton
@ 2022-09-07 13:02 ` Ross Burton
2022-09-07 13:02 ` [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch Ross Burton
1 sibling, 0 replies; 5+ messages in thread
From: Ross Burton @ 2022-09-07 13:02 UTC (permalink / raw)
To: openembedded-core; +Cc: nd
The -Werror=poison-system-directories argument was being passed to runs
where _just_ CPP was being invoked, so it wasn't passed to runs which
also compile. Add the options to cc1_options so that compile runs also
have fatal poisoning errors.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
.../gcc/0002-gcc-poison-system-directories.patch | 13 +++++++++++++
1 file changed, 13 insertions(+)
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 5a51ae7d960..bfec4477c1e 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
@@ -185,6 +185,19 @@ index bb07cc244e3..ce161d3c853 100644
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
+@@ -1265,7 +1270,11 @@ static const char *cc1_options =
+ %{coverage:-fprofile-arcs -ftest-coverage}\
+ %{fprofile-arcs|fprofile-generate*|coverage:\
+ %{!fprofile-update=single:\
+- %{pthread:-fprofile-update=prefer-atomic}}}";
++ %{pthread:-fprofile-update=prefer-atomic}}}"
++#ifdef POISON_BY_DEFAULT
++ " -Werror=poison-system-directories"
++#endif
++ ;
+
+ static const char *asm_options =
+ "%{-target-help:%:print-asm-header()} "
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index bd2a97938eb..c80f100f476 100644
--- a/gcc/incpath.cc
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch
2022-09-07 13:02 [PATCH 1/3] meta-selftest/poison: improve sysroot poisoning test case Ross Burton
2022-09-07 13:02 ` [PATCH 2/3] gcc-cross: pass -Werror=poison-system-directories to compiler stages Ross Burton
@ 2022-09-07 13:02 ` Ross Burton
2022-09-07 14:02 ` [OE-core] " Richard Purdie
2022-09-07 16:56 ` Khem Raj
1 sibling, 2 replies; 5+ messages in thread
From: Ross Burton @ 2022-09-07 13:02 UTC (permalink / raw)
To: openembedded-core; +Cc: nd
This patch is no longer needed, the upstream Makefile exports CPP from
CPP_FOR_BUILD since 12.1.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/recipes-devtools/gcc/gcc-12.2.inc | 1 -
.../gcc/gcc/0012-export-CPP.patch | 50 -------------------
2 files changed, 51 deletions(-)
delete mode 100644 meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
diff --git a/meta/recipes-devtools/gcc/gcc-12.2.inc b/meta/recipes-devtools/gcc/gcc-12.2.inc
index 572fd8b6692..7cc34b26215 100644
--- a/meta/recipes-devtools/gcc/gcc-12.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-12.2.inc
@@ -49,7 +49,6 @@ SRC_URI = "${BASEURI} \
file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
- file://0012-export-CPP.patch \
file://0013-Ensure-target-gcc-headers-can-be-included.patch \
file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
diff --git a/meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch b/meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
deleted file mode 100644
index 7e1ebef463a..00000000000
--- a/meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 20afebc61199cd74481b0b831c1b56465cd37fa0 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 20 Feb 2015 09:40:59 +0000
-Subject: [PATCH] export CPP
-
-The OE environment sets and exports CPP as being the target gcc. When
-building gcc-cross-canadian for a mingw targetted sdk, the following can be found
-in build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
-
-configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
-configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
-configure:3666: $? = 0
-configure:3698: result: no
-configure:3786: checking how to run the C preprocessor
-configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
-configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
-configure:3876: $? = 0
-
-Note this is a *build* target (in build-x86_64-linux) so it should be
-using the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32
-headers are very different, using the wrong cpp is a real problem. It is leaking
-into configure through the CPP variable. Ultimately this leads to build
-failures related to not being able to include a process.h file for pem-unix.c.
-
-The fix is to ensure we export a sane CPP value into the build
-environment when using build targets. We could define a CPP_FOR_BUILD value which may be
-the version which needs to be upstreamed but for now, this fix is good enough to
-avoid the problem.
-
-RP 22/08/2013
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- Makefile.in | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Makefile.in b/Makefile.in
-index 1d9c83cc566..11819667751 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
- AR="$(AR_FOR_BUILD)"; export AR; \
- AS="$(AS_FOR_BUILD)"; export AS; \
- CC="$(CC_FOR_BUILD)"; export CC; \
-+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
- CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
- CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
- CPP="$(CPP_FOR_BUILD)"; export CPP; \
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch
2022-09-07 13:02 ` [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch Ross Burton
@ 2022-09-07 14:02 ` Richard Purdie
2022-09-07 16:56 ` Khem Raj
1 sibling, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2022-09-07 14:02 UTC (permalink / raw)
To: Ross Burton, openembedded-core; +Cc: nd
On Wed, 2022-09-07 at 14:02 +0100, Ross Burton wrote:
> This patch is no longer needed, the upstream Makefile exports CPP from
> CPP_FOR_BUILD since 12.1.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> meta/recipes-devtools/gcc/gcc-12.2.inc | 1 -
> .../gcc/gcc/0012-export-CPP.patch | 50 -------------------
> 2 files changed, 51 deletions(-)
> delete mode 100644 meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
Someone convinced upstream to fix that:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=84401ce5fb4ecab55decb472b168100e7593e01f
:)
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch
2022-09-07 13:02 ` [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch Ross Burton
2022-09-07 14:02 ` [OE-core] " Richard Purdie
@ 2022-09-07 16:56 ` Khem Raj
1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2022-09-07 16:56 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core, nd
lgtm. it should have been dropped for I forgot.
On Wed, Sep 7, 2022 at 6:02 AM Ross Burton <ross.burton@arm.com> wrote:
>
> This patch is no longer needed, the upstream Makefile exports CPP from
> CPP_FOR_BUILD since 12.1.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> meta/recipes-devtools/gcc/gcc-12.2.inc | 1 -
> .../gcc/gcc/0012-export-CPP.patch | 50 -------------------
> 2 files changed, 51 deletions(-)
> delete mode 100644 meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
>
> diff --git a/meta/recipes-devtools/gcc/gcc-12.2.inc b/meta/recipes-devtools/gcc/gcc-12.2.inc
> index 572fd8b6692..7cc34b26215 100644
> --- a/meta/recipes-devtools/gcc/gcc-12.2.inc
> +++ b/meta/recipes-devtools/gcc/gcc-12.2.inc
> @@ -49,7 +49,6 @@ SRC_URI = "${BASEURI} \
> file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
> file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
> file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
> - file://0012-export-CPP.patch \
> file://0013-Ensure-target-gcc-headers-can-be-included.patch \
> file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
> file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
> diff --git a/meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch b/meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
> deleted file mode 100644
> index 7e1ebef463a..00000000000
> --- a/meta/recipes-devtools/gcc/gcc/0012-export-CPP.patch
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -From 20afebc61199cd74481b0b831c1b56465cd37fa0 Mon Sep 17 00:00:00 2001
> -From: Khem Raj <raj.khem@gmail.com>
> -Date: Fri, 20 Feb 2015 09:40:59 +0000
> -Subject: [PATCH] export CPP
> -
> -The OE environment sets and exports CPP as being the target gcc. When
> -building gcc-cross-canadian for a mingw targetted sdk, the following can be found
> -in build.x86_64-pokysdk-mingw32.i586-poky-linux/build-x86_64-linux/libiberty/config.log:
> -
> -configure:3641: checking for _FILE_OFFSET_BITS value needed for large files
> -configure:3666: gcc -c -isystem/media/build1/poky/build/tmp/sysroots/x86_64-linux/usr/include -O2 -pipe conftest.c >&5
> -configure:3666: $? = 0
> -configure:3698: result: no
> -configure:3786: checking how to run the C preprocessor
> -configure:3856: result: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32
> -configure:3876: x86_64-pokysdk-mingw32-gcc -E --sysroot=/media/build1/poky/build/tmp/sysroots/x86_64-nativesdk-mingw32-pokysdk-mingw32 conftest.c
> -configure:3876: $? = 0
> -
> -Note this is a *build* target (in build-x86_64-linux) so it should be
> -using the host "gcc", not x86_64-pokysdk-mingw32-gcc. Since the mingw32
> -headers are very different, using the wrong cpp is a real problem. It is leaking
> -into configure through the CPP variable. Ultimately this leads to build
> -failures related to not being able to include a process.h file for pem-unix.c.
> -
> -The fix is to ensure we export a sane CPP value into the build
> -environment when using build targets. We could define a CPP_FOR_BUILD value which may be
> -the version which needs to be upstreamed but for now, this fix is good enough to
> -avoid the problem.
> -
> -RP 22/08/2013
> -
> -Upstream-Status: Pending
> -
> -Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ----
> - Makefile.in | 1 +
> - 1 file changed, 1 insertion(+)
> -
> -diff --git a/Makefile.in b/Makefile.in
> -index 1d9c83cc566..11819667751 100644
> ---- a/Makefile.in
> -+++ b/Makefile.in
> -@@ -152,6 +152,7 @@ BUILD_EXPORTS = \
> - AR="$(AR_FOR_BUILD)"; export AR; \
> - AS="$(AS_FOR_BUILD)"; export AS; \
> - CC="$(CC_FOR_BUILD)"; export CC; \
> -+ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
> - CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
> - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
> - CPP="$(CPP_FOR_BUILD)"; export CPP; \
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#170391): https://lists.openembedded.org/g/openembedded-core/message/170391
> Mute This Topic: https://lists.openembedded.org/mt/93524139/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-07 16:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-07 13:02 [PATCH 1/3] meta-selftest/poison: improve sysroot poisoning test case Ross Burton
2022-09-07 13:02 ` [PATCH 2/3] gcc-cross: pass -Werror=poison-system-directories to compiler stages Ross Burton
2022-09-07 13:02 ` [PATCH 3/3] gcc: remove obsolete 0012-export-CPP.patch Ross Burton
2022-09-07 14:02 ` [OE-core] " Richard Purdie
2022-09-07 16:56 ` Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox