[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [PATCH 2/2] gcc: Improve build reproduciblity
From:       Nathan Rossi <nathan () nathanrossi ! com>
Date:       2019-11-30 10:47:24
Message-ID: 20191130104724.584271-2-nathan () nathanrossi ! com
[Download RAW message or body]

Prevent the gcc embedded checksum from containing a checksum that was
computed with build specific paths. The checksum-options file included
the value of LINKER/LDFLAGS which contains DEBUG_PREFIX_MAP and
STAGING_DIR_TARGET.

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
---
This change along with the previous gcc-target/gcc-cross changes to
handle configargs.h are sufficient to have ReproducibleTests of
oe-selftest pass when 'tools-sdk' is in IMAGE_FEATURES.
---
 meta/recipes-devtools/gcc/gcc-cross.inc  | 7 +++++++
 meta/recipes-devtools/gcc/gcc-target.inc | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc \
b/meta/recipes-devtools/gcc/gcc-cross.inc index 06ba3ccd15..6784d9673f 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -68,6 +68,13 @@ do_compile () {
 	sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h
 	sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h
 
+	# Prevent sysroot/workdir paths from being used in checksum-options.
+	# checksum-options is used to generate a checksum which is embedded into
+	# the output binary.
+	oe_runmake TARGET-gcc=checksum-options all-gcc
+	sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
+	sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options
+
 	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
diff --git a/meta/recipes-devtools/gcc/gcc-target.inc \
b/meta/recipes-devtools/gcc/gcc-target.inc index 987e88d32c..18d078db0a 100644
--- a/meta/recipes-devtools/gcc/gcc-target.inc
+++ b/meta/recipes-devtools/gcc/gcc-target.inc
@@ -145,6 +145,13 @@ do_compile () {
 	sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/configargs.h
 	sed -i 's@${STAGING_DIR_HOST}@/@g' ${B}/gcc/configargs.h
 
+	# Prevent sysroot/workdir paths from being used in checksum-options.
+	# checksum-options is used to generate a checksum which is embedded into
+	# the output binary.
+	oe_runmake TARGET-gcc=checksum-options all-gcc
+	sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
+	sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/checksum-options
+
 	oe_runmake all-host
 }
 
---
2.24.0
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic