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]
This commit is contained in:
Silvan Calarco 2024-01-05 20:48:09 +01:00
parent ff8f3f8140
commit 9855f5b976

View File

@ -6,7 +6,7 @@
Name: binutils Name: binutils
Version: 2.33.1 Version: 2.33.1
Release: 2mamba Release: 3mamba
Summary: GNU Binary Utility Development Utilities Summary: GNU Binary Utility Development Utilities
Group: Development/Tools Group: Development/Tools
Vendor: openmamba 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. Use this package if you need cross platform builds for %{_target_platform} target.
%if "%{_target_platform}" == "%{_host}"
%debug_package
%endif
%prep %prep
%setup -q -n binutils-%{pkgver} %setup -q -n binutils-%{pkgver}
%if "%{_target_platform}" != "%{_host}"
%define _build_id_links none
%endif
%patch1 -p1 %patch1 -p1
%patch11 -p1 %patch11 -p1
@ -101,6 +109,7 @@ CONFIGURE_ADD="--enable-gold \
--enable-shared \ --enable-shared \
--enable-lto \ --enable-lto \
--enable-relro \ --enable-relro \
--with-pic \
--enable-threads" --enable-threads"
case %{target_cpu} in case %{target_cpu} in
@ -219,8 +228,9 @@ done
%if "%{_target_platform}" != "%{_host}" %if "%{_target_platform}" != "%{_host}"
# CROSS target
# recreate platform specific symlinks, instead of copies # 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 if [ -f %{buildroot}%{_bindir}/%{_target_platform}-$i ]; then
rm -f %{buildroot}%{_bindir}/%{_target_platform}-$i rm -f %{buildroot}%{_bindir}/%{_target_platform}-$i
ln -sf ../%{_target_platform}/bin/$i %{buildroot}%{_bindir}/%{_target_platform}-$i ln -sf ../%{_target_platform}/bin/$i %{buildroot}%{_bindir}/%{_target_platform}-$i
@ -229,14 +239,27 @@ done
rm -rf %{buildroot}%{_datadir}/locale rm -rf %{buildroot}%{_datadir}/locale
rm -rf %{buildroot}%{_datadir}/info rm -rf %{buildroot}%{_datadir}/info
rm -rf %{buildroot}%{_libdir}/libiberty.a 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 %else
# NATIVE target
# recreate platform specific symlinks, instead of copies # 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 if [ -f %{buildroot}%{_bindir}/$i ]; then
rm -f %{buildroot}%{_bindir}/$i rm -f %{buildroot}%{_bindir}/$i
ln -sf ../%{_target_platform}/bin/$i %{buildroot}%{_bindir}/$i ln -sf ../%{_target_platform}/bin/$i %{buildroot}%{_bindir}/$i
fi fi
done 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 %endif
# use alternatives for %_bindir/ld # use alternatives for %_bindir/ld
rm -f %{buildroot}%{_prefix}/%{_target_platform}/bin/ld rm -f %{buildroot}%{_prefix}/%{_target_platform}/bin/ld
@ -398,6 +421,13 @@ exit 0
%endif %endif
%changelog %changelog
* Mon Nov 25 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 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 <silvan.calarco@mambasoft.it> 2.33.1-2mamba * Sat Nov 23 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 2.33.1-2mamba
- rebuilt with new options - rebuilt with new options