Skip to contentSkip to conversation

gcc-cross.inc: Prevent native sysroot from leaking into configargs.h

PATCH In review Nathan Rossi 2 participants 2 messages Nov 25, 2019 – Nov 28, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-cross.inc: Prevent native sysroot from leaking into configargs.h

Prevent the native(sdk) sysroot path from leaking into configargs.h. The configargs.h header is intended to be static and unchanged as the content is used as a means of determining that a gcc plugin is built for the same gcc. This also effects the output of 'gcc --version'. Due to per recipe sysroots and staging, the sysroot path would be replaced with the sysroot local to the recipe thus changing the content of configargs.h.

The sysroot path is replaced with a generic "/host" prefix which represents the host sysroot (e.g. native or nativesdk).

---
 meta/recipes-devtools/gcc/gcc-cross.inc   | 7 +++++++
 meta/recipes-devtools/gcc/gcc-runtime.inc | 4 ----
 2 files changed, 7 insertions(+), 4 deletions(-)
meta/recipes-devtools/gcc/gcc-cross.inc +7 -0
index 8855bb1f34..06ba3ccd15 100644
@@ -61,6 +61,13 @@ do_compile () {
 	export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
 	export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
 
+	# Prevent native/host sysroot path from being used in configargs.h header,
+	# as it will be rewritten when used by other sysroots preventing support
+	# for gcc plugins
+	oe_runmake configure-gcc
+	sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h
+	sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h
+
 	oe_runmake all-host configure-target-libgcc
 	(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
 	# now generate script to drive testing
meta/recipes-devtools/gcc/gcc-runtime.inc +0 -4
index 2da3c02ef0..536b18d97f 100644
@@ -302,10 +302,6 @@ do_check() {
 
     # HACK: this works around the configure setting CXX with -nostd* args
     sed -i 's/-nostdinc++ -nostdlib++//g' $(find ${B} -name testsuite_flags | head -1)
-    # HACK: this works around the de-stashing changes to configargs.h, as well as recipe-sysroot changing the content
-    sed -i '/static const char configuration_arguments/d' ${B}/gcc/configargs.h
-    ${CC} -v 2>&1 | grep "^Configured with:" | \
-        sed 's/Configured with: \(.*\)/static const char configuration_arguments[] = "\1";/g' >> ${B}/gcc/configargs.h
 
     if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then
         # qemu user has issues allocating large amounts of memory

---
2.24.0

#1 lore raw
Quoted 8 lines · Nathan Rossi

Prevent the native(sdk) sysroot path from leaking into configargs.h. The configargs.h header is intended to be static and unchanged as the content is used as a means of determining that a gcc plugin is built for the same gcc. This also effects the output of 'gcc --version'. Due to per recipe sysroots and staging, the sysroot path would be replaced with the sysroot local to the recipe thus changing the content of configargs.h.

Quoted 8 lines

The sysroot path is replaced with a generic "/host" prefix which represents the host sysroot (e.g. native or nativesdk).

---
 meta/recipes-devtools/gcc/gcc-cross.inc   | 7 +++++++
 meta/recipes-devtools/gcc/gcc-runtime.inc | 4 ----
 2 files changed, 7 insertions(+), 4 deletions(-)

I think this is causing the reproducibile builds selftest to fail:

https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/515

Note the:

g++_9.2.0-r0_amd64.deb
cpp_9.2.0-r0_amd64.deb

in the list.

I think there are other patches in master-next contributing to this too.

Cheers,

Richard