]> code.ossystems Code Review - openembedded-core.git/commitdiff
gcc-target.inc: Prevent sysroot from leaking into configargs.h
authorNathan Rossi <nathan@nathanrossi.com>
Sat, 30 Nov 2019 10:47:24 +0000 (10:47 +0000)
committerArmin Kuster <akuster808@gmail.com>
Sun, 15 Mar 2020 20:33:19 +0000 (13:33 -0700)
Prevent the full recipe-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 -v'. 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.
This change also improves gcc binary reproducibility. The sysroot path
is replaced with the base target root "/".

Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit b8d6e2ab68ee5e341fe970b191bfd334e6d2c40b)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
meta/recipes-devtools/gcc/gcc-target.inc

index bdc6ff658f9ac33eec1db6fc0894a9e34af56c80..987e88d32cc47dd7e535a19686d62bc9314590b8 100644 (file)
@@ -137,6 +137,14 @@ FILES_${PN}-doc = "\
 "
 
 do_compile () {
+       # Prevent full target sysroot path from being used in configargs.h header,
+       # as it will be rewritten when used by other sysroots preventing support
+       # for gcc plugins. Additionally the path is embeddeded into the output
+       # binary, this prevents building a reproducible binary.
+       oe_runmake configure-gcc
+       sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/configargs.h
+       sed -i 's@${STAGING_DIR_HOST}@/@g' ${B}/gcc/configargs.h
+
        oe_runmake all-host
 }