]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
gcc: Improve build reproduciblity
authorNathan Rossi <nathan@nathanrossi.com>
Sat, 30 Nov 2019 10:47:24 +0000 (10:47 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 5 Dec 2019 20:35:27 +0000 (20:35 +0000)
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>
meta/recipes-devtools/gcc/gcc-cross.inc
meta/recipes-devtools/gcc/gcc-target.inc

index 06ba3ccd154f4cf26bd3c32cbe0b75b71427ab94..6784d9673ff8bfa5970534e499c6cfbfafa11804 100644 (file)
@@ -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
index 987e88d32cc47dd7e535a19686d62bc9314590b8..18d078db0af278248fc0a550db803289edf244d8 100644 (file)
@@ -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
 }