From 9855f5b976fa498c324cb97a4439e2e4f3212754 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 20:48:09 +0100 Subject: [PATCH] modify libbdf.so and libopcodes.so to prevent shared linking external of binutils added --with-pic build option install also /usr/hbin/readelf as a symlink don't add build_id symlinks in cross targets to avoid conflicts add debug package [release 2.33.1-3mamba;Mon Nov 25 2019] --- binutils.spec | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/binutils.spec b/binutils.spec index 2497685..ae8bb63 100644 --- a/binutils.spec +++ b/binutils.spec @@ -6,7 +6,7 @@ Name: binutils Version: 2.33.1 -Release: 2mamba +Release: 3mamba Summary: GNU Binary Utility Development Utilities Group: Development/Tools Vendor: openmamba @@ -88,8 +88,16 @@ Binutils is a collection of binary utilities, including: Use this package if you need cross platform builds for %{_target_platform} target. +%if "%{_target_platform}" == "%{_host}" +%debug_package +%endif + %prep %setup -q -n binutils-%{pkgver} +%if "%{_target_platform}" != "%{_host}" +%define _build_id_links none +%endif + %patch1 -p1 %patch11 -p1 @@ -101,6 +109,7 @@ CONFIGURE_ADD="--enable-gold \ --enable-shared \ --enable-lto \ --enable-relro \ + --with-pic \ --enable-threads" case %{target_cpu} in @@ -219,8 +228,9 @@ done %if "%{_target_platform}" != "%{_host}" +# CROSS target # recreate platform specific symlinks, instead of copies -for i in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip; do +for i in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip readelf; do if [ -f %{buildroot}%{_bindir}/%{_target_platform}-$i ]; then rm -f %{buildroot}%{_bindir}/%{_target_platform}-$i ln -sf ../%{_target_platform}/bin/$i %{buildroot}%{_bindir}/%{_target_platform}-$i @@ -229,18 +239,31 @@ done rm -rf %{buildroot}%{_datadir}/locale rm -rf %{buildroot}%{_datadir}/info rm -rf %{buildroot}%{_libdir}/libiberty.a + +# No shared linking to these files outside binutils +rm -f %{buildroot}%{_prefix}/%{_target_platform}/lib{bfd,opcodes}.so +echo 'INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )' > %{buildroot}%{_prefix}/%{_target_platform}/lib/libbfd.so +echo 'INPUT( /usr/lib/libopcodes.a -lbfd )' > %{buildroot}%{_prefix}/%{_target_platform}/lib/libopcodes.so + %else +# NATIVE target # recreate platform specific symlinks, instead of copies -for i in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip; do +for i in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip readelf; do if [ -f %{buildroot}%{_bindir}/$i ]; then rm -f %{buildroot}%{_bindir}/$i ln -sf ../%{_target_platform}/bin/$i %{buildroot}%{_bindir}/$i fi done + +# No shared linking to these files outside binutils +rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so +echo 'INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )' > %{buildroot}%{_libdir}/libbfd.so +echo 'INPUT( /usr/lib/libopcodes.a -lbfd )' > %{buildroot}%{_libdir}/libopcodes.so + %endif # use alternatives for %_bindir/ld rm -f %{buildroot}%{_prefix}/%{_target_platform}/bin/ld - + %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" @@ -398,6 +421,13 @@ exit 0 %endif %changelog +* Mon Nov 25 2019 Silvan Calarco 2.33.1-3mamba +- modify libbdf.so and libopcodes.so to prevent shared linking external of binutils +- added --with-pic build option +- install also /usr/hbin/readelf as a symlink +- don't add build_id symlinks in cross targets to avoid conflicts +- add debug package + * Sat Nov 23 2019 Silvan Calarco 2.33.1-2mamba - rebuilt with new options