diff options
author | Dongkyun Son <dongkyun.s@samsung.com> | 2023-03-20 14:16:11 +0900 |
---|---|---|
committer | Dongkyun Son <dongkyun.s@samsung.com> | 2023-03-20 14:25:43 +0900 |
commit | cfe5e54e3652aa9545b259f53de5d99b6606947c (patch) | |
tree | 080f65783f011691a7319c2ad4f3b004bdc4b338 | |
parent | d46c72bcce17c875c371680c76e64cba33ce479f (diff) | |
parent | de008456dd832537d8818987572ff25438e9b4c1 (diff) | |
download | qemu-accel-cfe5e54e3652aa9545b259f53de5d99b6606947c.tar.gz qemu-accel-cfe5e54e3652aa9545b259f53de5d99b6606947c.tar.bz2 qemu-accel-cfe5e54e3652aa9545b259f53de5d99b6606947c.zip |
Merge commit 'de008456dd832537d8818987572ff25438e9b4c1' into develop
* Fix path to customized rtld
* Fix ld-linux-x86-64.so.2
* Fix %emul_path duplication
* Restore the rpath patching condition
* Support for separate ld.so added
* Conditional typo fix
* Configs removed and interpreter fixed
* ld.so.conf files added
* Add ld.so.conf into qemu-accel
* Fix RUNPATH patching
* Update accordingly to new gcc and glibc
Change-Id: Ie5c755c88291e70a3dab253b93bb93b4a7c85ae6
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
-rw-r--r-- | packaging/qemu-accel-aarch64.spec | 34 | ||||
-rw-r--r-- | packaging/qemu-accel-armv7hl.spec | 34 | ||||
-rw-r--r-- | packaging/qemu-accel-armv7l.spec | 34 | ||||
-rw-r--r-- | packaging/qemu-accel.spec.in | 34 |
4 files changed, 96 insertions, 40 deletions
diff --git a/packaging/qemu-accel-aarch64.spec b/packaging/qemu-accel-aarch64.spec index 7dc2b77..82c5a7b 100644 --- a/packaging/qemu-accel-aarch64.spec +++ b/packaging/qemu-accel-aarch64.spec @@ -71,6 +71,7 @@ BuildRequires: clang BuildRequires: pbzip2 BuildRequires: python3 BuildRequires: python3-base +BuildRequires: glibc-accel-ldso # required for LLVM gold plugin BuildRequires: llvm-devel @@ -195,10 +196,10 @@ do done %ifarch %ix86 - LD="/%{_lib}/ld-linux.so.2" + LD="%{_libdir}/ld-linux.so.2" %endif %ifarch x86_64 - LD="/%{_lib}/ld-linux-x86-64.so.2" + LD="%{_libdir}/ld-linux-x86-64.so.2" %endif # Disable bash acceleration for armv7hl due to corruption @@ -206,7 +207,7 @@ done BASH_EXECUTABLE=%{_bindir}/bash } -for executable in $LD \ +for executable in %{emul_path}$LD \ $BASH_EXECUTABLE \ %{_bindir}/{rpm,rpm2cpio,rpmdb,rpmkeys,rpmqpack,rpmbuild,rpmsign,rpmspec,rpm2archive} \ %{_libdir}/rpm-plugins/ima.so \ @@ -230,7 +231,7 @@ for executable in $LD \ %{_bindir}/xsltproc \ %{_bindir}/{ccmake,cmake,cpack,ctest} \ %{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \ - %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ + %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ @@ -265,8 +266,11 @@ function prepare_package_list { echo $orig_file >> $name.list done - ## Store the resulting list for packaging, setting up the right prefix - cat $name.list | sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | sort -u > %{_sourcedir}/$name-accel.list + ## Store the resulting list for packaging, setting up the right prefix, removing duplication of %emul_path if one exists + cat $name.list | \ + sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | \ + grep -v "%{emul_path}%{emul_path}" | \ + sort -u > %{_sourcedir}/$name-accel.list binaries=$(tr ' ' '\n' <<< "$binaries $bins" | sort -u) } @@ -308,11 +312,18 @@ function patch_binary { mkdir -p ${outfile%/*} cp -aL $binary $outfile [ "$binary" == "$rtld" ] && return - patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + [ "$binary" == "%{emul_path}$rtld" ] && return + # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then patchelf --set-interpreter %{emul_path}$rtld $outfile fi + + # Only patch RUNPATH if one exists and is absolute + local rpath=$(readelf -d "$outfile" | sed -e '/RUNPATH/{s~.*\[\(.*\)\]~\1~;n};d') + if [[ x"$rpath" != x"" && ${rpath::1} == "/" ]]; then + patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + fi } # Spawn single job which reads input to extract filename by index @@ -357,7 +368,7 @@ set -x %{?multilib: # Detect name of current ld.so. E.g. ld-linux.so.2 -cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so$'`) # Patch all 32bit binaries to use the right ld.so though symlink mkdir -p ${buildroot_emul_path}%{_prefix}/lib @@ -375,7 +386,7 @@ done i686_libdir="%{emul_path}/lib" # 1. Rename the actual ld.so binary -cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so' -printf '%f') +cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so.2' -printf '%f') new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so} sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list @@ -495,7 +506,7 @@ find ${buildroot_emul_path}%{_libdir}/${host_python3} -name *.pyc -exec rm {} \; find %{buildroot} ! -type d -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries -for bin in c++ g++ gcc gcc-${gcc_version} gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov +for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov do mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin @@ -621,6 +632,9 @@ echo '%{emul_path}/bin' >> %{_sourcedir}/qemu-accel.list echo '%{emul_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list %{?multilib:echo '%{emul_path}/lib' >> %{_sourcedir}/qemu-accel.list} +mv ${buildroot_emul_path}%{emul_path}$LD ${buildroot_emul_path}$LD +rm -rf ${buildroot_emul_path}%{emul_path} + %fdupes %{buildroot} %filter_provides_in %{emul_path} diff --git a/packaging/qemu-accel-armv7hl.spec b/packaging/qemu-accel-armv7hl.spec index 878df60..240b196 100644 --- a/packaging/qemu-accel-armv7hl.spec +++ b/packaging/qemu-accel-armv7hl.spec @@ -71,6 +71,7 @@ BuildRequires: clang BuildRequires: pbzip2 BuildRequires: python3 BuildRequires: python3-base +BuildRequires: glibc-accel-ldso # required for LLVM gold plugin BuildRequires: llvm-devel @@ -195,10 +196,10 @@ do done %ifarch %ix86 - LD="/%{_lib}/ld-linux.so.2" + LD="%{_libdir}/ld-linux.so.2" %endif %ifarch x86_64 - LD="/%{_lib}/ld-linux-x86-64.so.2" + LD="%{_libdir}/ld-linux-x86-64.so.2" %endif # Disable bash acceleration for armv7hl due to corruption @@ -206,7 +207,7 @@ done BASH_EXECUTABLE=%{_bindir}/bash } -for executable in $LD \ +for executable in %{emul_path}$LD \ $BASH_EXECUTABLE \ %{_bindir}/{rpm,rpm2cpio,rpmdb,rpmkeys,rpmqpack,rpmbuild,rpmsign,rpmspec,rpm2archive} \ %{_libdir}/rpm-plugins/ima.so \ @@ -230,7 +231,7 @@ for executable in $LD \ %{_bindir}/xsltproc \ %{_bindir}/{ccmake,cmake,cpack,ctest} \ %{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \ - %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ + %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ @@ -265,8 +266,11 @@ function prepare_package_list { echo $orig_file >> $name.list done - ## Store the resulting list for packaging, setting up the right prefix - cat $name.list | sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | sort -u > %{_sourcedir}/$name-accel.list + ## Store the resulting list for packaging, setting up the right prefix, removing duplication of %emul_path if one exists + cat $name.list | \ + sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | \ + grep -v "%{emul_path}%{emul_path}" | \ + sort -u > %{_sourcedir}/$name-accel.list binaries=$(tr ' ' '\n' <<< "$binaries $bins" | sort -u) } @@ -308,11 +312,18 @@ function patch_binary { mkdir -p ${outfile%/*} cp -aL $binary $outfile [ "$binary" == "$rtld" ] && return - patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + [ "$binary" == "%{emul_path}$rtld" ] && return + # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then patchelf --set-interpreter %{emul_path}$rtld $outfile fi + + # Only patch RUNPATH if one exists and is absolute + local rpath=$(readelf -d "$outfile" | sed -e '/RUNPATH/{s~.*\[\(.*\)\]~\1~;n};d') + if [[ x"$rpath" != x"" && ${rpath::1} == "/" ]]; then + patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + fi } # Spawn single job which reads input to extract filename by index @@ -357,7 +368,7 @@ set -x %{?multilib: # Detect name of current ld.so. E.g. ld-linux.so.2 -cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so$'`) # Patch all 32bit binaries to use the right ld.so though symlink mkdir -p ${buildroot_emul_path}%{_prefix}/lib @@ -375,7 +386,7 @@ done i686_libdir="%{emul_path}/lib" # 1. Rename the actual ld.so binary -cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so' -printf '%f') +cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so.2' -printf '%f') new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so} sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list @@ -495,7 +506,7 @@ find ${buildroot_emul_path}%{_libdir}/${host_python3} -name *.pyc -exec rm {} \; find %{buildroot} ! -type d -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries -for bin in c++ g++ gcc gcc-${gcc_version} gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov +for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov do mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin @@ -621,6 +632,9 @@ echo '%{emul_path}/bin' >> %{_sourcedir}/qemu-accel.list echo '%{emul_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list %{?multilib:echo '%{emul_path}/lib' >> %{_sourcedir}/qemu-accel.list} +mv ${buildroot_emul_path}%{emul_path}$LD ${buildroot_emul_path}$LD +rm -rf ${buildroot_emul_path}%{emul_path} + %fdupes %{buildroot} %filter_provides_in %{emul_path} diff --git a/packaging/qemu-accel-armv7l.spec b/packaging/qemu-accel-armv7l.spec index 3262d21..7296e04 100644 --- a/packaging/qemu-accel-armv7l.spec +++ b/packaging/qemu-accel-armv7l.spec @@ -71,6 +71,7 @@ BuildRequires: clang BuildRequires: pbzip2 BuildRequires: python3 BuildRequires: python3-base +BuildRequires: glibc-accel-ldso # required for LLVM gold plugin BuildRequires: llvm-devel @@ -195,10 +196,10 @@ do done %ifarch %ix86 - LD="/%{_lib}/ld-linux.so.2" + LD="%{_libdir}/ld-linux.so.2" %endif %ifarch x86_64 - LD="/%{_lib}/ld-linux-x86-64.so.2" + LD="%{_libdir}/ld-linux-x86-64.so.2" %endif # Disable bash acceleration for armv7hl due to corruption @@ -206,7 +207,7 @@ done BASH_EXECUTABLE=%{_bindir}/bash } -for executable in $LD \ +for executable in %{emul_path}$LD \ $BASH_EXECUTABLE \ %{_bindir}/{rpm,rpm2cpio,rpmdb,rpmkeys,rpmqpack,rpmbuild,rpmsign,rpmspec,rpm2archive} \ %{_libdir}/rpm-plugins/ima.so \ @@ -230,7 +231,7 @@ for executable in $LD \ %{_bindir}/xsltproc \ %{_bindir}/{ccmake,cmake,cpack,ctest} \ %{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \ - %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ + %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ @@ -265,8 +266,11 @@ function prepare_package_list { echo $orig_file >> $name.list done - ## Store the resulting list for packaging, setting up the right prefix - cat $name.list | sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | sort -u > %{_sourcedir}/$name-accel.list + ## Store the resulting list for packaging, setting up the right prefix, removing duplication of %emul_path if one exists + cat $name.list | \ + sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | \ + grep -v "%{emul_path}%{emul_path}" | \ + sort -u > %{_sourcedir}/$name-accel.list binaries=$(tr ' ' '\n' <<< "$binaries $bins" | sort -u) } @@ -308,11 +312,18 @@ function patch_binary { mkdir -p ${outfile%/*} cp -aL $binary $outfile [ "$binary" == "$rtld" ] && return - patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + [ "$binary" == "%{emul_path}$rtld" ] && return + # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then patchelf --set-interpreter %{emul_path}$rtld $outfile fi + + # Only patch RUNPATH if one exists and is absolute + local rpath=$(readelf -d "$outfile" | sed -e '/RUNPATH/{s~.*\[\(.*\)\]~\1~;n};d') + if [[ x"$rpath" != x"" && ${rpath::1} == "/" ]]; then + patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + fi } # Spawn single job which reads input to extract filename by index @@ -357,7 +368,7 @@ set -x %{?multilib: # Detect name of current ld.so. E.g. ld-linux.so.2 -cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so$'`) # Patch all 32bit binaries to use the right ld.so though symlink mkdir -p ${buildroot_emul_path}%{_prefix}/lib @@ -375,7 +386,7 @@ done i686_libdir="%{emul_path}/lib" # 1. Rename the actual ld.so binary -cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so' -printf '%f') +cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so.2' -printf '%f') new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so} sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list @@ -495,7 +506,7 @@ find ${buildroot_emul_path}%{_libdir}/${host_python3} -name *.pyc -exec rm {} \; find %{buildroot} ! -type d -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries -for bin in c++ g++ gcc gcc-${gcc_version} gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov +for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov do mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin @@ -621,6 +632,9 @@ echo '%{emul_path}/bin' >> %{_sourcedir}/qemu-accel.list echo '%{emul_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list %{?multilib:echo '%{emul_path}/lib' >> %{_sourcedir}/qemu-accel.list} +mv ${buildroot_emul_path}%{emul_path}$LD ${buildroot_emul_path}$LD +rm -rf ${buildroot_emul_path}%{emul_path} + %fdupes %{buildroot} %filter_provides_in %{emul_path} diff --git a/packaging/qemu-accel.spec.in b/packaging/qemu-accel.spec.in index 7aadd20..c9a5666 100644 --- a/packaging/qemu-accel.spec.in +++ b/packaging/qemu-accel.spec.in @@ -68,6 +68,7 @@ BuildRequires: clang BuildRequires: pbzip2 BuildRequires: python3 BuildRequires: python3-base +BuildRequires: glibc-accel-ldso # required for LLVM gold plugin BuildRequires: llvm-devel @@ -192,10 +193,10 @@ do done %ifarch %ix86 - LD="/%{_lib}/ld-linux.so.2" + LD="%{_libdir}/ld-linux.so.2" %endif %ifarch x86_64 - LD="/%{_lib}/ld-linux-x86-64.so.2" + LD="%{_libdir}/ld-linux-x86-64.so.2" %endif # Disable bash acceleration for armv7hl due to corruption @@ -203,7 +204,7 @@ done BASH_EXECUTABLE=%{_bindir}/bash } -for executable in $LD \ +for executable in %{emul_path}$LD \ $BASH_EXECUTABLE \ %{_bindir}/{rpm,rpm2cpio,rpmdb,rpmkeys,rpmqpack,rpmbuild,rpmsign,rpmspec,rpm2archive} \ %{_libdir}/rpm-plugins/ima.so \ @@ -227,7 +228,7 @@ for executable in $LD \ %{_bindir}/xsltproc \ %{_bindir}/{ccmake,cmake,cpack,ctest} \ %{_bindir}/%{target_arch}-{addr2line,ar,as,c++filt,dwp,elfedit,gprof,ld,ld.bfd,ld.gold,nm,objcopy,objdump,ranlib,readelf,size,strings,strip} \ - %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-${gcc_version},gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ + %{_bindir}/%{target_arch}-{c++,g++,cpp,gcc,gcc-ar,gcc-nm,gcc-ranlib,gcov,gfortran} \ ${gcc_install_dir}{cc1,cc1plus,collect2,lto1,lto-wrapper,liblto_plugin.so*,f951} \ %{_bindir}/file \ %{_bindir}/icecc \ @@ -262,8 +263,11 @@ function prepare_package_list { echo $orig_file >> $name.list done - ## Store the resulting list for packaging, setting up the right prefix - cat $name.list | sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | sort -u > %{_sourcedir}/$name-accel.list + ## Store the resulting list for packaging, setting up the right prefix, removing duplication of %emul_path if one exists + cat $name.list | \ + sed -e 's|^|%{emul_path}|;s| |\n%{emul_path}|g' | \ + grep -v "%{emul_path}%{emul_path}" | \ + sort -u > %{_sourcedir}/$name-accel.list binaries=$(tr ' ' '\n' <<< "$binaries $bins" | sort -u) } @@ -305,11 +309,18 @@ function patch_binary { mkdir -p ${outfile%/*} cp -aL $binary $outfile [ "$binary" == "$rtld" ] && return - patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + [ "$binary" == "%{emul_path}$rtld" ] && return + # not all binaries have an .interp section if patchelf --print-interpreter $outfile 1>/dev/null 2>/dev/null; then patchelf --set-interpreter %{emul_path}$rtld $outfile fi + + # Only patch RUNPATH if one exists and is absolute + local rpath=$(readelf -d "$outfile" | sed -e '/RUNPATH/{s~.*\[\(.*\)\]~\1~;n};d') + if [[ x"$rpath" != x"" && ${rpath::1} == "/" ]]; then + patchelf --set-rpath "%{emul_path}%{_libdir}" $outfile + fi } # Spawn single job which reads input to extract filename by index @@ -354,7 +365,7 @@ set -x %{?multilib: # Detect name of current ld.so. E.g. ld-linux.so.2 -cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so\.[[:digit:]]+'`) +cross_ld_symlink=$(basename `rpm -ql glibc-32bit | grep -E 'ld-linux\.so$'`) # Patch all 32bit binaries to use the right ld.so though symlink mkdir -p ${buildroot_emul_path}%{_prefix}/lib @@ -372,7 +383,7 @@ done i686_libdir="%{emul_path}/lib" # 1. Rename the actual ld.so binary -cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so' -printf '%f') +cross_ld_so=$(find %{buildroot}${i686_libdir} -name 'ld-*.so.2' -printf '%f') new_cross_ld_so=$(echo ${cross_ld_so} | sed -e 's,\.so,-i686.so,') mv %{buildroot}${i686_libdir}/${cross_ld_so} %{buildroot}${i686_libdir}/${new_cross_ld_so} sed -e "s|${cross_ld_so}|${new_cross_ld_so}|" -i %{_sourcedir}/multilib-accel.list @@ -492,7 +503,7 @@ find ${buildroot_emul_path}%{_libdir}/${host_python3} -name *.pyc -exec rm {} \; find %{buildroot} ! -type d -name 'python*' | sed -e "s|${buildroot_emul_path}||" | tee -a python.list # rename gcc binaries -for bin in c++ g++ gcc gcc-${gcc_version} gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov +for bin in c++ g++ gcc gfortran cpp gcc-ar gcc-nm gcc-ranlib gcov do mv ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin ${buildroot_emul_path}%{_bindir}/$bin ln -s $bin ${buildroot_emul_path}%{_bindir}/%{target_arch}-$bin @@ -618,6 +629,9 @@ echo '%{emul_path}/bin' >> %{_sourcedir}/qemu-accel.list echo '%{emul_path}/%{_lib}' >> %{_sourcedir}/qemu-accel.list %{?multilib:echo '%{emul_path}/lib' >> %{_sourcedir}/qemu-accel.list} +mv ${buildroot_emul_path}%{emul_path}$LD ${buildroot_emul_path}$LD +rm -rf ${buildroot_emul_path}%{emul_path} + %fdupes %{buildroot} %filter_provides_in %{emul_path} |