Try to make sure that the RUNTIME dynamic entry size is the same for all binaries produced with the native compiler. This is necessary in order to produce identical binaries when using differently sized buildpaths. I've tried using only patchelf, and keeping the linker flags as they are, but I am unable to produce identical binaries. Has anyone else managed to do this with patchelf ? If not, maybe we can write a new tool that can handle it ?
The build-id also needs to be removed since it is calculated based on the data present at link time. This includes STAGING_LIBDIR_NATIVE and STAGING_BASE_LIBDIR_NATIVE. Both will differ and they need to be temporarily preserved since some recipes will execute the binaries during do_install() (for example python3-native). Later on these are removed in chrpath.bbclass. This hack is the first step for producing identical native binaries when using different build paths. 'zstd-native' is a working example. Signed-off-by: Jacob Kroon <jacob.kr...@gmail.com> --- meta/classes/chrpath.bbclass | 3 +++ meta/conf/bitbake.conf | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/meta/classes/chrpath.bbclass b/meta/classes/chrpath.bbclass index 26b984c4db..3c6956304a 100644 --- a/meta/classes/chrpath.bbclass +++ b/meta/classes/chrpath.bbclass @@ -24,6 +24,9 @@ def process_file_linux(cmd, fpath, rootdir, baseprefix, tmpdir, d, break_hardlin new_rpaths = [] modified = False for rpath in rpaths: + if rpath.startswith('rpath-padding-'): + modified = True + continue # If rpath is already dynamic copy it to new_rpath and continue if rpath.find("$ORIGIN") != -1: new_rpaths.append(rpath) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index fba99e8f0c..9621023354 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -580,6 +580,8 @@ BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}" export CXXFLAGS = "${TARGET_CXXFLAGS}" TARGET_CXXFLAGS = "${TARGET_CFLAGS}" +RPATH_PADDING ?= "rpath-padding-${@'x' * (512 - len(d.expand('${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}:rpath-padding-')))}" +RPATH_PADDING_FLAG ?= "-Wl,-rpath,${RPATH_PADDING}" export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \ -L${STAGING_BASE_LIBDIR_NATIVE} \ -Wl,--enable-new-dtags \ @@ -587,7 +589,9 @@ export BUILD_LDFLAGS = "-L${STAGING_LIBDIR_NATIVE} \ -Wl,-rpath-link,${STAGING_BASE_LIBDIR_NATIVE} \ -Wl,-rpath,${STAGING_LIBDIR_NATIVE} \ -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE} \ - -Wl,-O1" + ${RPATH_PADDING_FLAG} \ + -Wl,-O1 \ + -Wl,--build-id=none" BUILDSDK_LDFLAGS = "-Wl,-O1"
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#158868): https://lists.openembedded.org/g/openembedded-core/message/158868 Mute This Topic: https://lists.openembedded.org/mt/87352793/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-