From c92cdeadf2b9f1c51cf95289f76416c98b13e393 Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 4 May 2023 15:08:07 +0200 Subject: [PATCH] faking build-id in libjsvml.so --- java-latest-openjdk.spec | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/java-latest-openjdk.spec b/java-latest-openjdk.spec index ec2e622..13ac09b 100644 --- a/java-latest-openjdk.spec +++ b/java-latest-openjdk.spec @@ -322,7 +322,7 @@ %global top_level_dir_name %{origin} %global top_level_dir_name_backup %{top_level_dir_name}-backup %global buildver 9 -%global rpmrelease 5 +%global rpmrelease 6 # Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit %if %is_system_jdk # Using 10 digits may overflow the int used for priority, so we combine the patch and build versions @@ -1334,6 +1334,10 @@ BuildRequires: desktop-file-utils # elfutils only are OK for build without AOT BuildRequires: elfutils-devel BuildRequires: gdb +# for modyfying build-id in clashing binaries +BuildRequires: /usr/bin/gcc +BuildRequires: /usr/bin/objcopy +BuildRequires: /usr/bin/readelf # Requirement for setting up nss.cfg and nss.fips.cfg BuildRequires: nss-devel # Requirement for system security property test @@ -1904,6 +1908,25 @@ for suffix in %{build_loop} ; do buildoutputdir=`ls -d %{compatiblename}*portable${debugbuild}.${jdkjre}*` top_dir_abs_main_build_path=$(pwd)/${buildoutputdir} installjdk ${top_dir_abs_main_build_path} + # it may happen, that some library - in original case libjsvml build identically for two jdks + # it is becasue of our ld/gcc flags - otherwise rpm build enhances each binarry by full path to it + # if it is hit then this library needs to have build-id repalced - note, that it do not affect dbugability + for lib in lib/libjsvml.so ; do + libjsvmlgcchackdir=`mktemp -d` + pushd $libjsvmlgcchackdir + libjsvml=${top_dir_abs_main_build_path}/$lib + ls -l $libjsvml + echo "#include " > a.c + echo "int main(void) { printf(\"$libjsvml\"); }" >> a.c + gcc a.c -o exe + readelf -n exe | grep "Build ID" + readelf -n $libjsvml | grep "Build ID" + objcopy --dump-section .note.gnu.build-id=id exe + objcopy --update-section .note.gnu.build-id=id $libjsvml + readelf -n $libjsvml | grep -i "Build ID" + popd + rm -rf $libjsvmlgcchackdir + done # Check debug symbols were built into the dynamic libraries if [ $jdkjre == jdk ] ; then #jdk only? @@ -2364,6 +2387,9 @@ cjc.mainProgram(args) %endif %changelog +* Fri Apr 28 2023 Jiri Vanek - 1:20.0.1.0.9-6.rolling +- faking build-id in libjsvml.so + * Fri Apr 28 2023 Jiri Vanek - 1:20.0.1.0.9-5.rolling - returned news