# cross platform binutils specfile %define target_cpu %(echo %{_target_platform} | cut -d- -f1) %define gprof 1 %define pkgver %(echo %version | sed "s|[a-z]*$||") Name: binutils Version: 2.36.1 Release: 1mamba Summary: GNU Binary Utility Development Utilities Group: Development/Tools Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.gz #Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.bz2 URL: https://www.gnu.org/software/binutils/binutils.html Patch0: %{name}-2.19-readelf-CAN-2005-1704.patch Patch1: %{name}-2.16.1-native-lib-dirs.patch Patch2: %{name}-2.18-makeinfo_check.patch Patch3: %{name}-2.20.1-unexport_LD_LIBRARY_PATH_for_CC_FOR_BUILD.patch Patch4: %{name}-2.22-x86_64-add_support_for_delayed_load_feature.patch Patch5: %{name}-2.22-gcc-4.7-gold-casts.patch Patch6: %{name}-2.22-build-id.patch Patch7: %{name}-2.22-gold-fix_pointer_reference.patch Patch8: binutils-2.23.2-texinfo-5.1.patch Patch9: binutils-2.26-upstream-syslinux.patch Patch10: binutils-2.26-gcc-6.1.0.patch Patch11: binutils-2.31.1-revert-PR-23161.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: bash BuildRequires: glibc-devel BuildRequires: texinfo ## AUTOBUILDREQ-END BuildRequires: bison >= 2.5 Requires: libbinutils = %{version}-%{release} BuildRoot: %{_tmppath}/binutils-%{version}-build Requires(post):%{__install_info} %description Binutils is a collection of binary utilities, including: * ar: creating modifying and extracting from archives * nm: for listing symbols from object files * objcopy: for copying and translating object files * objdump: for displaying information from object files * ranlib: for generating an index for the contents of an archive * size: for listing the section sizes of an object or archive file * strings: for listing printable strings from files * strip: for discarding symbols (a filter for demangling encoded C++ symbols * addr2line: for converting addresses to file and line * nlmconv: for converting object code into an NLM %package -n libbinutils Summary: Main library for binutils Group: System/Libraries %description -n libbinutils This package contains the library needed to run programs dynamically linked with binutils. %package -n libbinutils-devel Summary: Main library for binutils Group: System/Libraries Requires: libbinutils = %{version}-%{release} %description -n libbinutils-devel This package contains the library needed to run programs dynamically linked with binutils. %package -n cross-%{_target_platform}-%{name} Summary: Cross Platform Binutils for %{_target_platform} Group: Development/Tools AutoReqProv: no %description -n cross-%{_target_platform}-%{name} Binutils is a collection of binary utilities, including: * ar: creating modifying and extracting from archives * nm: for listing symbols from object files * objcopy: for copying and translating object files * objdump: for displaying information from object files * ranlib: for generating an index for the contents of an archive * size: for listing the section sizes of an object or archive file * strings: for listing printable strings from files * strip: for discarding symbols (a filter for demangling encoded C++ symbols * addr2line: for converting addresses to file and line * nlmconv: for converting object code into an NLM 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 %build install -d binutils-build CONFIGURE_ADD="--enable-gold \ --enable-plugins \ --enable-ld=default \ --enable-shared \ --enable-lto \ --enable-relro \ --with-pic \ --enable-threads" case %{target_cpu} in i*86 | athlon*) TARGETS="\ --enable-64bit-bfd \ --enable-targets=x86_64-linux,powerpc-linux,powerpc64-linux,arm-linux,armelf-linux-eabi" ;; ppc | powerpc) # disable shared build for cross platform binutils because it is a big-endian platform and complain about # glibc not being little-endian TARGETS="\ --enable-64bit-bfd \ --enable-targets=powerpc64-linux,i386-linux,x86_64-linux,arm-linux,armelf-linux-eabi" %if "%{_target_platform}" != "%{_host}" CONFIGURE_ADD="$CONFIGURE_ADD --disable-shared" %endif ;; arm) TARGETS="\ --enable-targets=powerpc-linux,powerpc64-linux,i386-linux,x86_64-linux,arm-linux,armelf-linux-eabi" #--with-lib-path=%{_prefix}/%{_target_platform}/lib:%{_prefix}/%{_target_platform}/lib/be:%{_prefix}/%{_target_platform}/lib/soft-float:%{_prefix}/%{_target_platform}/lib/be/soft-float" ;; avr) TARGETS="" CONFIGURE_ADD="--enable-ld --disable-shared" ;; x86_64) TARGETS="\ --enable-64bit-bfd \ --enable-targets=i386-linux,powerpc-linux,powerpc64-linux,arm-linux,armelf-linux-eabi,x86_64-pep" ;; *) TARGETS="\ --enable-targets=powerpc64-linux,i386-linux,x86_64-linux,arm-linux,armelf-linux-eabi" ;; esac cd binutils-build ../configure \ --with-bugurl=https://bugs.openmamba.org/ \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ --mandir=%{_mandir} \ --infodir=%{_infodir} \ --build=%{_build} \ --target=%{_target_platform} \ $TARGETS \ --host=%{_host} \ --enable-deterministic-archives \ --with-system-zlib \ --disable-werror \ $CONFIGURE_ADD %make all tooldir=%{_prefix} %make info tooldir=%{_prefix} # tooldir=%{_prefix}/%{_target_platform} # \ # LIB_PATH=%{?addlibdir} #\ # NATIVE_LIB_DIRS="/usr/local/lib %{addlibdirs} /lib /usr/lib" %install [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" # FIXME: bfd and opcodes are installed under # /usr/%host_noncanonical/%_target_platform dir instead of # /usr/%_target_platform, why ? sed -i "s|host_noncanonical =.*|host_noncanonical = \"\"|" \ binutils-build/bfd/Makefile \ binutils-build/opcodes/Makefile %makeinstall install-info -C binutils-build host_noncanonical="" %if "%{?_target_platform}" == "%{_host}" install -D include/libiberty.h %{buildroot}%{_includedir}/libiberty.h # create platform specific symlinks for i in addr2line ar as c++filt ld nm objcopy objdump ranlib readelf \ size strings strip; do ln -sf $i %{buildroot}%{_bindir}/%{_target_platform}-$i done # remove c++filt (which conflict with gcc package) #rm -f %{buildroot}%{_bindir}/c++filt #rm -f %{buildroot}%{_mandir}/man1/c++filt.* cp ./ld/NEWS NEWS.ld cp ./gas/NEWS NEWS.gas cp ./binutils/NEWS NEWS.binutils %find_lang bfd %find_lang binutils %find_lang gas %find_lang gold %if "%gprof" == "1" %find_lang gprof %endif %find_lang ld %find_lang opcodes > %{name}-all.lang %if "%gprof" == "1" extralang=gprof %endif for i in bfd binutils gas gold ld opcodes $extralang; do cat ${i}.lang >> %{name}-all.lang done %endif %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 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 fi done rm -rf %{buildroot}%{_datadir}/locale rm -rf %{buildroot}%{_datadir}/info rm -rf %{buildroot}%{_libdir}/libiberty.a rm -rf %{buildroot}%{_libdir}/libctf* rm -rf %{buildroot}%{_libdir}/bfd-plugins rm -rf %{buildroot}%{_includedir}/ctf*.h # No shared linking to these files outside binutils rm -f %{buildroot}%{_prefix}/%{_target_platform}/lib/lib{bfd,opcodes}.so echo 'INPUT( %{_prefix}/%{_target_platform}/lib/libbfd.a -liberty -lz -ldl )' > %{buildroot}%{_prefix}/%{_target_platform}/lib/libbfd.so echo 'INPUT( %{_prefix}/%{_target_platform}/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 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( %{_libdir}/libbfd.a -liberty -lz -ldl )' > %{buildroot}%{_libdir}/libbfd.so echo 'INPUT( %{_libdir}/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}" %post if [ $1 -ge 1 ]; then %if "%gprof" == "1" extralang=gprof %endif for i in as bfd binutils ld $extralang; do %install_info ${i}.info done # remove legacy alternatives /usr/sbin/update-alternatives --remove ld %{_bindir}/ld.bfd 2>/dev/null /usr/sbin/update-alternatives --remove ld %{_bindir}/ld.gold 2>/dev/null [ -L %{_prefix}/%{_target_platform}/bin/ld ] || rm -f %{_prefix}/%{_target_platform}/bin/ld /usr/sbin/update-alternatives \ --install %{_prefix}/%{_target_platform}/bin/ld ld \ %{_prefix}/%{_target_platform}/bin/ld.bfd 20 /usr/sbin/update-alternatives \ --install %{_prefix}/%{_target_platform}/bin/ld ld \ %{_prefix}/%{_target_platform}/bin/ld.gold 10 fi exit 0 %preun if [ $1 -eq 0 ]; then %if "%gprof" == "1" extralang=gprof %endif for i in as bfd binutils ld $extralang; do %uninstall_info ${i}.info done fi exit 0 %postun if [ $1 -eq 0 ]; then # remove legacy alternatives /usr/bin/ld /usr/sbin/update-alternatives --remove ld %{_bindir}/ld.bfd 2>/dev/null /usr/sbin/update-alternatives --remove ld %{_bindir}/ld.gold 2>/dev/null /usr/sbin/update-alternatives --remove ld \ %{_prefix}/%{_target_platform}/bin/ld.bfd /usr/sbin/update-alternatives --remove ld \ %{_prefix}/%{_target_platform}/bin/ld.gold fi exit 0 %posttrans [ -e %{_prefix}/%{_target_platform}/bin/ld ] || ln -s /etc/alternatives/ld %{_prefix}/%{_target_platform}/bin/ld exit 0 %post -n cross-%{_target_platform}-%{name} if [ $1 -ge 1 ]; then [ -L %{_prefix}/%{_target_platform}/bin/ld ] || rm -f %{_prefix}/%{_target_platform}/bin/ld /usr/sbin/update-alternatives \ --install %{_prefix}/%{_target_platform}/bin/ld %{_target_platform}-ld \ %{_prefix}/%{_target_platform}/bin/ld.bfd 20 /usr/sbin/update-alternatives \ --install %{_prefix}/%{_target_platform}/bin/ld %{_target_platform}-ld \ %{_prefix}/%{_target_platform}/bin/ld.gold 10 fi exit 0 %postun -n cross-%{_target_platform}-%{name} if [ $1 -eq 0 ]; then /usr/sbin/update-alternatives --remove %{_target_platform}-ld \ %{_prefix}/%{_target_platform}/bin/ld.bfd /usr/sbin/update-alternatives --remove %{_target_platform}-ld \ %{_prefix}/%{_target_platform}/bin/ld.gold fi exit 0 %posttrans -n cross-%{_target_platform}-%{name} [ -e %{_prefix}/%{_target_platform}/bin/ld ] || ln -s /etc/alternatives/ld %{_prefix}/%{_target_platform}/bin/ld exit 0 %if "%{_target_platform}" == "%{_host}" %files -f %{name}-all.lang %defattr(-,root,root) %{_bindir}/addr2line %{_bindir}/ar %{_bindir}/as %{_bindir}/c++filt %{_bindir}/dwp %{_bindir}/elfedit %{_bindir}/embedspu %if "%gprof" == "1" %{_bindir}/gprof %endif %{_bindir}/ld %{_bindir}/ld.bfd %{_bindir}/ld.gold %{_bindir}/nm %{_bindir}/objcopy %{_bindir}/objdump %{_bindir}/ranlib %{_bindir}/readelf %{_bindir}/size %{_bindir}/strings %{_bindir}/strip %{_bindir}/%{_target_platform}-* %{_prefix}/%{_host}/bin/* %{_prefix}/%{_host}/lib/* %{_mandir}/man1/addr2line.1* %{_mandir}/man1/ar.1.gz %{_mandir}/man1/as.1.gz %{_mandir}/man1/c++filt.1* %{_mandir}/man1/dlltool.1* %{_mandir}/man1/elfedit.1* %if "%gprof" == "1" %{_mandir}/man1/gprof.1* %endif %{_mandir}/man1/ld.1* #%{_mandir}/man1/nlmconv.1.gz %{_mandir}/man1/nm.1* %{_mandir}/man1/objcopy.1* %{_mandir}/man1/objdump.1* %{_mandir}/man1/ranlib.1* %{_mandir}/man1/readelf.1* %{_mandir}/man1/size.1* %{_mandir}/man1/strings.1* %{_mandir}/man1/strip.1* %{_mandir}/man1/windmc.1* %{_mandir}/man1/windres.1* %{_infodir}/* %doc COPYING* README NEWS* %files -n libbinutils %defattr(-,root,root) %{_libdir}/libbfd-%{version}*.so %{_libdir}/libopcodes-%{version}*.so %{_libdir}/libctf-nobfd.so.* %{_libdir}/libctf.so.* %dir %{_libdir}/bfd-plugins %{_libdir}/bfd-plugins/libdep.so %files -n libbinutils-devel %defattr(-,root,root) %{_includedir}/* %{_libdir}/libbfd.*a %{_libdir}/libbfd.so %{_libdir}/libopcodes.*a %{_libdir}/libopcodes.so %{_libdir}/libctf-nobfd.a %{_libdir}/libctf-nobfd.la %{_libdir}/libctf-nobfd.so %{_libdir}/libctf.a %{_libdir}/libctf.la %{_libdir}/libctf.so #%{_libdir}/libiberty.a %else %files -n cross-%{_target_platform}-%{name} %defattr(-,root,root) %{_prefix}/bin/%{_target_platform}-* %{_prefix}/%{_target_platform}/bin/* %{_prefix}/%{_target_platform}/lib/* %if "%{target_cpu}" != "avr" %if "%{target_cpu}" != "ppc" %{_prefix}/%{_target_platform}/include/* %endif %endif %{_mandir}/man1/%{_target_platform}* %endif %changelog * Sat Feb 06 2021 Automatic Build System 2.36.1-1mamba - automatic version update by autodist * Sun Jan 31 2021 Automatic Build System 2.36-1mamba - automatic version update by autodist * Sat Sep 19 2020 Automatic Build System 2.35.1-1mamba - automatic version update by autodist * Sat Jul 25 2020 Automatic Build System 2.35-1mamba - automatic version update by autodist * Sun Feb 09 2020 Automatic Build System 2.34-1mamba - automatic version update by autodist * Fri Dec 06 2019 Silvan Calarco 2.33.1-4mamba - fix library paths in customized libbfd.so and libopcodes.so * 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 * Sat Oct 12 2019 Automatic Build System 2.33.1-1mamba - automatic version update by autodist * Sat Feb 02 2019 Automatic Build System 2.32-1mamba - automatic version update by autodist * Wed Oct 10 2018 Silvan Calarco 2.31.1-2mamba - patch to fix link errors, see https://bugzilla.redhat.com/show_bug.cgi?id=1599521#c9 * Sat Sep 15 2018 Automatic Build System 2.31.1-1mamba - automatic version update by autodist * Sun Oct 22 2017 Automatic Build System 2.29.1-1mamba - automatic version update by autodist * Wed Aug 09 2017 Silvan Calarco 2.29-1mamba - update to 2.29 * Fri Mar 10 2017 Automatic Build System 2.28-1mamba - automatic version update by autodist * Thu Aug 04 2016 Automatic Build System 2.27-1mamba - automatic version update by autodist * Sun Jul 03 2016 Automatic Build System 2.26.1-1mamba - automatic version update by autodist * Sat Jun 25 2016 Silvan Calarco 2.26-3mamba - apply upstream patch to restore options used by syslinux * Tue Jan 26 2016 Automatic Build System 2.26-2mamba - automatic version update by autodist * Tue Jan 26 2016 Automatic Build System 2.26-1mamba - automatic version update by autodist * Tue Jul 21 2015 Automatic Build System 2.25.1-1mamba - automatic version update by autodist * Thu Apr 09 2015 Silvan Calarco 2.25-2mamba - rebuilt with new target platform: arm-openmamba-linux-gnueabihf * Wed Dec 24 2014 Automatic Build System 2.25-1mamba - automatic version update by autodist * Fri May 02 2014 Silvan Calarco 2.24-2mamba - build with --enable-plugins * Mon Dec 09 2013 Automatic Build System 2.24-1mamba - automatic version update by autodist * Wed Mar 27 2013 Automatic Build System 2.23.2-1mamba - automatic version update by autodist * Wed Nov 14 2012 Automatic Build System 2.23.1-1mamba - automatic version update by autodist - source edit: cross-*-ld: set %{target_platform}-ld alternatives for bfd/gold * Tue Oct 23 2012 Automatic Build System 2.23-1mamba - automatic version update by autodist * Tue Jul 31 2012 Silvan Calarco 2.22-7mamba - x86_64: add support for delayed-load feature required by valgrind 3.7.0 - added gold cast patch ti fix gold build with gcc 4.7 - alternatives: revert to bfd as default linker * Sun Apr 15 2012 Silvan Calarco 2.22-6mamba - make %_bindir files symlink to /usr/%_host/bin - move %{_prefix}/%{_host}/bin/* from libbinutils-devel to binutils - change ld alternative destination from /usr/bin/ld to %{_prefix}/%{_host}/bin/ld * Mon Apr 02 2012 Silvan Calarco 2.22-5mamba - rebuilt * Fri Mar 23 2012 Silvan Calarco 2.22-4mamba - make symlinks instead of copies in %_bindir to platform bin directory * Sat Feb 18 2012 Silvan Calarco 2.22-3mamba - install /usr/bin/ld alternative for ld.bfd and ld.gold (default: ld.gold) * Fri Jan 06 2012 Silvan Calarco 2.22-2mamba - rebuilt with "--enable-gold=default --enable-ld" (i.e. switch to new gold linker as default) * Mon Nov 21 2011 Automatic Build System 2.22-1mamba - automatic version update by autodist * Fri Aug 26 2011 Automatic Build System 2.21.1a-1mamba - automatic version update by autodist * Sat Jul 16 2011 Automatic Build System 2.21.1-1mamba - automatic update by autodist * Sun Dec 12 2010 Automatic Build System 2.21-1mamba - automatic update to 2.21 by autodist * Fri Apr 16 2010 Silvan Calarco 2.20.1-2mamba - use full target_platform in packages name - added support for additional target arm-linux-eabi - removed use on cross_platform_cpu, use more standard %_target_platform * Fri Mar 05 2010 Automatic Build System 2.20.1-1mamba - automatic update to 2.20.1 by autodist * Sat Oct 17 2009 Automatic Build System 2.20-1mamba - automatic update to 2.20 by autodist * Tue Feb 03 2009 Silvan Calarco 2.19.1-1mamba - automatic update to 2.19.1 by autodist * Tue Oct 28 2008 Silvan Calarco 2.19-1mamba - automatic update to 2.19 by autodist * Wed Nov 28 2007 Silvan Calarco 2.18-1mamba - update to 2.18 * Thu Mar 08 2007 Silvan Calarco 2.17-3qilnx - build for openmamba distribution * Fri Dec 29 2006 Silvan Calarco 2.17-2qilnx - added x86_64 target * Wed Aug 30 2006 Silvan Calarco 2.17-1qilnx - new version build - add support for multilib with ARM * Sun Jun 11 2006 Silvan Calarco 2.16.93-1qilnx - update to version 2.16.93 by autospec * Thu Jun 08 2006 Silvan Calarco 2.16.1-10qilnx - rebuilt * Mon Sep 05 2005 Silvan Calarco 2.16.1-9qilnx - add specific target symlink for host target * Sat Aug 27 2005 Silvan Calarco 2.16.1-8qilnx - rebuilt with multime targets support for tools - 64 bits support * Mon Aug 01 2005 Silvan Calarco 2.16.1-7qilnx - cross builds: use /lib/ as additional native libdir * Fri Jul 22 2005 Silvan Calarco 2.16.1-6qilnx - add correct cross target files in proper dirs (fixme: should be done automatically) * Thu Jul 21 2005 Silvan Calarco 2.16.1-5qilnx - added support for --define='cross_target_cpu xxx' build option * Tue Jul 12 2005 Silvan Calarco 2.16.1-4qilnx - added --target command line support for cross releases build * Fri Jul 08 2005 Davide Madrisan 2.16.1-3qilnx - modified to support cross compilation * Wed Jun 15 2005 Davide Madrisan 2.16.1-2qilnx - security fix QSA-2005-077 (CAN-2005-1704) * Wed Jun 15 2005 Davide Madrisan 2.16.1-1qilnx - update to version 2.16.1 by autospec * Tue May 10 2005 Davide Madrisan 2.16-1qilnx - update to version 2.16 by autospec - added missing scripts * Tue Jun 29 2004 Silvan Calarco 2.15-2qilnx - (re)added libiberty.a removed from gcc * Wed May 19 2004 Davide Madrisan 2.15-1qilnx - new version rebuild * Mon Jun 16 2003 Silvan Calarco 2.14-1qilnx - rebuild without c++filt (conflicting with gcc) - build with gcc 3.2.3 * Fri Apr 18 2003 Alessandro Ramazzina 2.13.2.1-2qilnx - rebuild after install modifications * Thu Apr 17 2003 Alessandro Ramazzina 2.13.2.1-1qilnx - creation of binutils package