-f*-prefix-map flags are required when linking with LTO enabled to make
the output binary reproducible.
See discussion here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473
[YOCTO #14481]
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
/usr/sbin/lspci from pciutils is a good program to test that shows how
adding -f*-prefix-map to LDFLAGS makes a program binary reproducible
with LTO enabled.
meta/conf/bitbake.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 160abf40ee..c0d2e3f82f 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -595,7 +595,7 @@ TARGET_LINK_HASH_STYLE ?= "${@['-Wl,--hash-style=gnu',''][d.getVar('LINKER_HASH_
ASNEEDED ?= "-Wl,--as-needed"
export LDFLAGS = "${TARGET_LDFLAGS}"
-TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}"
+TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${DEBUG_PREFIX_MAP}"
# mips does not support GNU hash style therefore we override
LINKER_HASH_STYLE_mipsarch_libc-musl = "sysv"
/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0/sysroot-destdir/usr/lib/pkgconfig/ruby-3.0.pc
DLDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=/home/pokybuild/yocto-worker/reproducible-centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0=/usr/src/debug/ruby/3.0.2-r0 -fdebug-prefix-map=/home/pokybuild/yocto-worker/reproducible-centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0=/usr/src/debug/ruby/3.0.2-r0 -fdebug-prefix-map=/home/pokybuild/yocto-worker/reproducible-centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0/recipe-sysroot= -fdebug-prefix-map=/home/pokybuild/yocto-worker/reproducible-centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0/recipe-sysroot-native= -Wl,-z,relro,-z,now -Wl,--compress-debug-sections=zlib