summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2019-11-30 10:47:24 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-05 20:35:27 +0000
commit0ead8cbdfb96c4fcbefd24c6647d0f50599f45b3 (patch)
treed966701a8c8e9697faa5a3a12221d9a7e19e984a
parentb8d6e2ab68ee5e341fe970b191bfd334e6d2c40b (diff)
downloadopenembedded-core-contrib-0ead8cbdfb96c4fcbefd24c6647d0f50599f45b3.tar.gz
gcc: Improve build reproduciblity
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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross.inc7
-rw-r--r--meta/recipes-devtools/gcc/gcc-target.inc7
2 files changed, 14 insertions, 0 deletions
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
}