@@ -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)
@@ -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"
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.kroon@gmail.com> --- meta/classes/chrpath.bbclass | 3 +++ meta/conf/bitbake.conf | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-)