Blame SPECS/binutils.spec

0b07f1
# rpmbuild parameters:
0b07f1
# --define "binutils_target arm-linux-gnu" to create arm-linux-gnu-binutils.
0b07f1
# --with=bootstrap: Build with minimal dependencies.
0b07f1
# --with=debug: Build without optimizations and without splitting the debuginfo.
0b07f1
# --without=docs: Skip building documentation.
0b07f1
# --without=testsuite: Do not run the testsuite.
0b07f1
0b07f1
# For DTS-7 on RHEL-6 we only support x86 and x86_64.
0b07f1
# For DTS-7 on RHEL-7 we also support ppc64, ppc64le, s390x and aarch64
0b07f1
0b07f1
%{?scl:%{?scl_package:%scl_package binutils}}
0b07f1
0b07f1
%if 0%{!?binutils_target:1}
0b07f1
%define binutils_target %{_target_platform}
0b07f1
%define isnative 1
0b07f1
%define enable_shared 1
0b07f1
%else
0b07f1
%define cross %{binutils_target}-
0b07f1
%define isnative 0
0b07f1
%define enable_shared 0
0b07f1
%endif
0b07f1
# Disable deterministic archives by default.
0b07f1
# This is for package builders who do not want to have to change
0b07f1
# their build scripts to work with deterministic archives.
0b07f1
%define enable_deterministic_archives 0
0b07f1
# BZ 1342618: Enable support for GCC LTO compilation.
0b07f1
%define enable_lto 1
0b07f1
# Disable the default generation of compressed debug sections.
0b07f1
%define default_compress_debug 0
0b07f1
0b07f1
# Default: Not bootstrapping.
0b07f1
%bcond_with bootstrap
0b07f1
# Default: Not debug
0b07f1
%bcond_with debug
0b07f1
# Default: Always build documentation.
0b07f1
%bcond_without docs
0b07f1
# Default: Always run the testsuite.
0b07f1
%bcond_without testsuite
0b07f1
0b07f1
%if %{with bootstrap}
0b07f1
%undefine with_docs
0b07f1
%undefine with_testsuite
0b07f1
%endif
0b07f1
0b07f1
%if %{with debug}
0b07f1
%undefine with_testsuite
0b07f1
%endif
0b07f1
0b07f1
Summary: A GNU collection of binary utilities
0b07f1
Name: %{?scl_prefix}%{?cross}binutils%{?_with_debug:-debug}
0b07f1
Version: 2.28
faa3f7
Release: 8%{?dist}.1
0b07f1
License: GPLv3+
0b07f1
Group: Development/Tools
0b07f1
URL: http://sources.redhat.com/binutils
0b07f1
0b07f1
# Note - the Linux Kernel binutils releases are too unstable and contain too
0b07f1
# many controversial patches so we stick with the official FSF version
0b07f1
# instead.
0b07f1
0b07f1
Source: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.bz2
0b07f1
0b07f1
Source2: binutils-2.19.50.0.1-output-format.sed
0b07f1
0b07f1
Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
0b07f1
Patch02: binutils-2.20.51.0.10-ppc64-pie.patch
0b07f1
Patch03: binutils-2.20.51.0.2-ia64-lib64.patch
0b07f1
Patch04: binutils-2.25-version.patch
0b07f1
Patch05: binutils-2.25-set-long-long.patch
0b07f1
Patch06: binutils-2.20.51.0.10-sec-merge-emit.patch
0b07f1
# Enable -zrelro by default: BZ #621983
0b07f1
Patch07: binutils-2.22.52.0.1-relro-on-by-default.patch
0b07f1
# Local patch - export demangle.h with the binutils-devel rpm.
0b07f1
Patch08: binutils-2.22.52.0.1-export-demangle.h.patch
0b07f1
# Disable checks that config.h has been included before system headers.  BZ #845084
0b07f1
Patch09: binutils-2.22.52.0.4-no-config-h-check.patch
0b07f1
# Fix detections little endian PPC shared libraries
0b07f1
Patch10: binutils-2.24-ldforcele.patch
0b07f1
# Import H.J.Lu's Kernel LTO patch.
0b07f1
Patch11: binutils-2.26-lto.patch
0b07f1
Patch12: binutils-2.23.51.0.3-Provide-std-tr1-hash.patch
0b07f1
Patch13: binutils-rh1038339.patch
0b07f1
Patch14: binutils-2.24-rh919508.patch
0b07f1
# Revert H.J.'s patch to elide PLT entries.
0b07f1
Patch15: binutils-2.27-revert-PLT-elision.patch
0b07f1
# Sync libiberty sources with FSF GCC mainline.
0b07f1
Patch16: binutils-2.28-libiberty-bugfixes.patch
0b07f1
# Add support for GNU BUILD NOTEs.
0b07f1
Patch17: binutils-gnu-build-notes.patch
0b07f1
# GAS: Emit name, comp_dir and producer strings in .debug_str.
0b07f1
Patch18: binutils-2.28-gas-comp_dir.patch
0b07f1
# Import fix for PR 21124 and 20519
0b07f1
Patch19: binutils-2.28-ppc-dynamic-relocs.patch
0b07f1
# Have readelf skip checks of the dynamic section when its type is SHT_NOBITS.
0b07f1
Patch20: binutils-2.28-dynamic-section-warning.patch
0b07f1
# Fix some unexpected failures in the linker testsuite
0b07f1
Patch21: binutils-2.28-testsuite-failure-fixes.patch
0b07f1
# Fix the incorrect generation of copy relocs on AArch64.
0b07f1
Patch22: binutils-2.28-aarch64-copy-relocs.patch
0b07f1
# Ignore duplicate indirect symbols produced by GOLD.
0b07f1
Patch23: binutils-2.28-ignore-gold-duplicates.patch
0b07f1
# Add extra PowerPC instructions that were omitted from the 2.28 release.
0b07f1
Patch24: binutils-2.28-ppc-extra-insns.patch
0b07f1
# Add support for displaying new DWARF5 tags including DW_AT_export_symbols.
0b07f1
Patch25: binutils-2.28-DW_AT_export_symbols.patch
faa3f7
# Purpose:  Fix a seg-fault in the PowerPC linker when discarding .plt
faa3f7
#           sections when -pie is used and undefined weak symbols are
faa3f7
#           present.  See PR 22431 and BZs 1515340, 1515347, 1513014
faa3f7
# Lifetime: Fixed in 2.30.
faa3f7
Patch26: binutils-2.27-ppc64-discarded-plt-sections.patch
faa3f7
0b07f1
0b07f1
Provides: bundled(libiberty)
0b07f1
0b07f1
%define gold_arches %ix86 x86_64 %arm aarch64
0b07f1
0b07f1
%if %{with bootstrap}
0b07f1
%define build_gold	no
0b07f1
%else
0b07f1
%ifarch %gold_arches
0b07f1
%define build_gold	both
0b07f1
%else
0b07f1
%define build_gold	no
0b07f1
%endif
0b07f1
%endif
0b07f1
0b07f1
%define alternatives_cmd %{!?scl:%{_sbindir}}%{?scl:%{_root_sbindir}}/alternatives
0b07f1
%define alternatives_cmdline %{alternatives_cmd}%{?scl: --altdir %{_sysconfdir}/alternatives --admindir %{_scl_root}/var/lib/alternatives}
0b07f1
0b07f1
%if %{with debug}
0b07f1
# Define this if you want to skip the strip step and preserve debug info.
0b07f1
# Useful for testing.
0b07f1
%define __debug_install_post : > %{_builddir}/%{?buildsubdir}/debugfiles.list
0b07f1
%define debug_package %{nil}
0b07f1
%endif
0b07f1
0b07f1
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
0b07f1
0b07f1
BuildRequires: gcc
0b07f1
0b07f1
# Gold needs bison in order to build gold/yyscript.c.
0b07f1
# Bison needs m4.
0b07f1
%if "%{build_gold}" == "both"
0b07f1
BuildRequires: bison, m4, gcc-c++
0b07f1
%endif
0b07f1
0b07f1
%if %{without bootstrap}
0b07f1
BuildRequires: gettext, flex, zlib-devel
0b07f1
%endif
0b07f1
0b07f1
%if %{with docs}
0b07f1
BuildRequires: texinfo >= 4.0
0b07f1
# BZ 920545: We need pod2man in order to build the manual pages.
0b07f1
BuildRequires: /usr/bin/pod2man
0b07f1
Requires(post): /sbin/install-info
0b07f1
Requires(preun): /sbin/install-info
0b07f1
%endif
0b07f1
0b07f1
# Required for: ld-bootstrap/bootstrap.exp bootstrap with --static
0b07f1
# It should not be required for: ld-elf/elf.exp static {preinit,init,fini} array
0b07f1
%if %{with testsuite}
0b07f1
# relro_test.sh uses dc which is part of the bc rpm, hence its inclusion here.
0b07f1
BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc
0b07f1
%if "%{build_gold}" == "both"
0b07f1
# The GOLD testsuite needs a static libc++
0b07f1
%if 0%{?rhel} >= 7
0b07f1
BuildRequires: libstdc++-static
0b07f1
%endif
0b07f1
%endif
0b07f1
%endif
0b07f1
0b07f1
Conflicts: gcc-c++ < 4.0.0
0b07f1
0b07f1
Requires(post): /sbin/install-info
0b07f1
Requires(preun): /sbin/install-info
0b07f1
0b07f1
%{?scl:Requires:%scl_runtime}
0b07f1
0b07f1
# The higher of these two numbers determines the default ld.
0b07f1
%{!?ld_bfd_priority: %global ld_bfd_priority	50}
0b07f1
%{!?ld_gold_priority:%global ld_gold_priority	30}
0b07f1
0b07f1
%if "%{build_gold}" == "both"
0b07f1
Requires(post): coreutils
0b07f1
Requires(post): %{alternatives_cmd}
0b07f1
Requires(preun): %{alternatives_cmd}
0b07f1
%endif
0b07f1
0b07f1
# On ARM EABI systems, we do want -gnueabi to be part of the
0b07f1
# target triple.
0b07f1
%ifnarch %{arm}
0b07f1
%define _gnu %{nil}
0b07f1
%endif
0b07f1
0b07f1
%description
0b07f1
Binutils is a collection of binary utilities, including ar (for
0b07f1
creating, modifying and extracting from archives), as (a family of GNU
0b07f1
assemblers), gprof (for displaying call graph profile data), ld (the
0b07f1
GNU linker), nm (for listing symbols from object files), objcopy (for
0b07f1
copying and translating object files), objdump (for displaying
0b07f1
information from object files), ranlib (for generating an index for
0b07f1
the contents of an archive), readelf (for displaying detailed
0b07f1
information about binary files), size (for listing the section sizes
0b07f1
of an object or archive file), strings (for listing printable strings
0b07f1
from files), strip (for discarding symbols), and addr2line (for
0b07f1
converting addresses to file and line).
0b07f1
0b07f1
%package devel
0b07f1
Summary: BFD and opcodes static and dynamic libraries and header files
0b07f1
Group: System Environment/Libraries
0b07f1
# Note, this provide:
0b07f1
#   Provides: binutils-static = %{version}-%{release}
0b07f1
# has been suppressed so that the DTS version does not provide
0b07f1
# a version of the binutils that another package cannot use.
0b07f1
# See:  https://bugzilla.redhat.com/show_bug.cgi?id=1485002
0b07f1
# for more details.
0b07f1
%if %{with docs}
0b07f1
Requires(post): /sbin/install-info
0b07f1
Requires(preun): /sbin/install-info
0b07f1
%endif
0b07f1
Requires: zlib-devel
0b07f1
Requires: %{?scl_prefix}binutils = %{version}-%{release}
0b07f1
# BZ 1215242: We need touch...
0b07f1
Requires: coreutils
0b07f1
0b07f1
%description devel
0b07f1
This package contains BFD and opcodes static and dynamic libraries.
0b07f1
0b07f1
The dynamic libraries are in this package, rather than a seperate
0b07f1
base package because they are actually linker scripts that force
0b07f1
the use of the static libraries.  This is because the API of the
0b07f1
BFD library is too unstable to be used dynamically.
0b07f1
0b07f1
The static libraries are here because they are now needed by the
0b07f1
dynamic libraries.
0b07f1
0b07f1
Developers starting new projects are strongly encouraged to consider
0b07f1
using libelf instead of BFD.
0b07f1
0b07f1
%prep
0b07f1
%setup -q -n binutils-%{version}
0b07f1
%patch01 -p1 -b .libtool-lib64~
0b07f1
%patch02 -p1 -b .ppc64-pie~
0b07f1
%ifarch ia64
0b07f1
%if "%{_lib}" == "lib64"
0b07f1
%patch03 -p1 -b .ia64-lib64~
0b07f1
%endif
0b07f1
%endif
0b07f1
%patch04 -p1 -b .version~
0b07f1
%patch05 -p1 -b .set-long-long~
0b07f1
%patch06 -p1 -b .sec-merge-emit~
0b07f1
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
0b07f1
%patch07 -p1 -b .relro~
0b07f1
%endif
0b07f1
%patch08 -p1 -b .export-demangle-h~
0b07f1
%patch09 -p1 -b .no-config-h-check~
0b07f1
%ifarch ppc64le
0b07f1
%patch10 -p1 -b .ldforcele~
0b07f1
%endif
0b07f1
%patch11 -p1 -b .kernel-lto~
0b07f1
%patch12 -p1 -b .provide-hash~
0b07f1
%patch13 -p1 -b .manpage~
0b07f1
%patch14 -p1
0b07f1
%patch15 -p1
0b07f1
%patch16 -p1
0b07f1
%patch17 -p1
0b07f1
%patch18 -p1
0b07f1
%patch19 -p1
0b07f1
%patch20 -p1
0b07f1
%patch21 -p1
0b07f1
%patch22 -p1
0b07f1
%patch23 -p1
0b07f1
%patch24 -p1
0b07f1
%patch25 -p1
faa3f7
%patch26 -p1
0b07f1
0b07f1
# We cannot run autotools as there is an exact requirement of autoconf-2.59.
0b07f1
0b07f1
# On ppc64 and aarch64, we might use 64KiB pages
0b07f1
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
0b07f1
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*aarch64.c
0b07f1
sed -i -e '/common_pagesize/s/4 /64 /' gold/powerpc.cc
0b07f1
sed -i -e '/pagesize/s/0x1000,/0x10000,/' gold/aarch64.cc
0b07f1
# LTP sucks
0b07f1
perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf*
0b07f1
sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in}
0b07f1
sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in}
0b07f1
# Build libbfd.so and libopcodes.so with -Bsymbolic-functions if possible.
0b07f1
if gcc %{optflags} -v --help 2>&1 | grep -q -- -Bsymbolic-functions; then
0b07f1
sed -i -e 's/^libbfd_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' bfd/Makefile.{am,in}
0b07f1
sed -i -e 's/^libopcodes_la_LDFLAGS = /&-Wl,-Bsymbolic-functions /' opcodes/Makefile.{am,in}
0b07f1
fi
0b07f1
# $PACKAGE is used for the gettext catalog name.
0b07f1
sed -i -e 's/^ PACKAGE=/ PACKAGE=%{?cross}/' */configure
0b07f1
# Undo the name change to run the testsuite.
0b07f1
for tool in binutils gas ld
0b07f1
do
0b07f1
  sed -i -e "2aDEJATOOL = $tool" $tool/Makefile.am
0b07f1
  sed -i -e "s/^DEJATOOL = .*/DEJATOOL = $tool/" $tool/Makefile.in
0b07f1
done
0b07f1
touch */configure
0b07f1
# Touch the .info files so that they are newer then the .texi files and
0b07f1
# hence do not need to be rebuilt.  This eliminates the need for makeinfo.
0b07f1
# The -print is there just to confirm that the command is working.
0b07f1
%if %{without docs}
0b07f1
  find . -name *.info -print -exec touch {} \;
0b07f1
%endif
0b07f1
0b07f1
%ifarch %{power64}
0b07f1
%define _target_platform %{_arch}-%{_vendor}-%{_host_os}
0b07f1
%endif
0b07f1
0b07f1
%build
0b07f1
echo target is %{binutils_target}
0b07f1
%ifarch %{power64}
0b07f1
#CFLAGS=`echo $RPM_OPT_FLAGS | sed -e -s "s/-Werror//g"`
0b07f1
#export CFLAGS
0b07f1
export CFLAGS="$RPM_OPT_FLAGS -Wno-error"
0b07f1
%else
0b07f1
export CFLAGS="$RPM_OPT_FLAGS"
0b07f1
%endif
0b07f1
CARGS=
0b07f1
0b07f1
case %{binutils_target} in i?86*|sparc*|ppc*|s390*|sh*|arm*|aarch64*)
0b07f1
  CARGS="$CARGS --enable-64-bit-bfd"
0b07f1
  ;;
0b07f1
esac
0b07f1
0b07f1
case %{binutils_target} in ia64*)
0b07f1
  CARGS="$CARGS --enable-targets=i386-linux"
0b07f1
  ;;
0b07f1
esac
0b07f1
0b07f1
case %{binutils_target} in ppc*|ppc64*)
0b07f1
  CARGS="$CARGS --enable-targets=spu"
0b07f1
  ;;
0b07f1
esac
0b07f1
0b07f1
case %{binutils_target} in ppc64-*)
0b07f1
  CARGS="$CARGS --enable-targets=powerpc64le-linux"
0b07f1
  ;;
0b07f1
esac
0b07f1
0b07f1
case %{binutils_target} in ppc64le*)
0b07f1
    CARGS="$CARGS --enable-targets=powerpc-linux"
0b07f1
    ;;
0b07f1
esac
0b07f1
0b07f1
case %{binutils_target} in x86_64*|i?86*|arm*|aarch64*)
0b07f1
  CARGS="$CARGS --enable-targets=x86_64-pep"
0b07f1
  ;;
0b07f1
esac
0b07f1
0b07f1
%if 0%{?_with_debug:1}
0b07f1
CFLAGS="$CFLAGS -O0 -ggdb2 -Wno-error -D_FORTIFY_SOURCE=0"
0b07f1
%define enable_shared 0
0b07f1
%endif
0b07f1
0b07f1
# We could optimize the cross builds size by --enable-shared but the produced
0b07f1
# binaries may be less convenient in the embedded environment.
0b07f1
# The seemingly unncessary --with-sysroot argument is merely meant to enable
0b07f1
# sysroot capabilities in the resulting executables.  That allows customers
0b07f1
# to then use the sysroot capability to set up host-x-host build environments
0b07f1
# easier.
0b07f1
%configure \
0b07f1
  --build=%{_target_platform} --host=%{_target_platform} \
0b07f1
  --target=%{binutils_target} \
0b07f1
  --with-sysroot=/ \
0b07f1
%ifarch %gold_arches
0b07f1
%if "%{build_gold}" == "both"
0b07f1
  --enable-gold=default --enable-ld \
0b07f1
%else
0b07f1
  --enable-gold \
0b07f1
%endif
0b07f1
%endif
0b07f1
%if %{isnative}
0b07f1
  --with-sysroot=/ \
0b07f1
%else
0b07f1
  --enable-targets=%{_host} \
0b07f1
  --with-sysroot=%{_prefix}/%{binutils_target}/sys-root \
0b07f1
  --program-prefix=%{cross} \
0b07f1
%endif
0b07f1
%if %{enable_shared}
0b07f1
  --enable-shared \
0b07f1
%else
0b07f1
  --disable-shared \
0b07f1
%endif
0b07f1
%if %{enable_deterministic_archives}
0b07f1
  --enable-deterministic-archives \
0b07f1
%else    
0b07f1
  --enable-deterministic-archives=no \
0b07f1
%endif
0b07f1
%if %{enable_lto}
0b07f1
  --enable-lto \
0b07f1
%endif
0b07f1
%if %{default_compress_debug}
0b07f1
  --enable-compressed-debug-sections=all \
0b07f1
%else
0b07f1
  --enable-compressed-debug-sections=none \
0b07f1
%endif
0b07f1
  $CARGS \
0b07f1
  --enable-plugins \
0b07f1
  --with-bugurl=http://bugzilla.redhat.com/bugzilla/
0b07f1
0b07f1
%if %{with docs}  
0b07f1
make %{_smp_mflags} tooldir=%{_prefix} all
0b07f1
make %{_smp_mflags} tooldir=%{_prefix} info
0b07f1
%else
0b07f1
make %{_smp_mflags} tooldir=%{_prefix} MAKEINFO=true all
0b07f1
%endif
0b07f1
0b07f1
# Do not use %%check as it is run after %%install where libbfd.so is rebuild
0b07f1
# with -fvisibility=hidden no longer being usable in its shared form.
0b07f1
%if %{without testsuite}
0b07f1
echo ====================TESTSUITE DISABLED=========================
0b07f1
%else
0b07f1
make -k check < /dev/null || :
0b07f1
echo ====================TESTING=========================
0b07f1
cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
0b07f1
echo ====================TESTING END=====================
0b07f1
for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
0b07f1
do
0b07f1
  ln $file binutils-%{_target_platform}-$(basename $file) || :
0b07f1
done
0b07f1
tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
0b07f1
uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
0b07f1
rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
0b07f1
%endif
0b07f1
0b07f1
%install
0b07f1
rm -rf %{buildroot}
0b07f1
%if %{with docs}  
0b07f1
make install DESTDIR=%{buildroot}
0b07f1
%else
0b07f1
make install DESTDIR=%{buildroot} MAKEINFO=true
0b07f1
%endif
0b07f1
0b07f1
%if %{isnative}
0b07f1
%if %{with info}
0b07f1
make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
0b07f1
%endif
0b07f1
0b07f1
# Rebuild libiberty.a with -fPIC.
0b07f1
# Future: Remove it together with its header file, projects should bundle it.
0b07f1
make -C libiberty clean
0b07f1
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty
0b07f1
0b07f1
# Rebuild libbfd.a with -fPIC.
0b07f1
# Without the hidden visibility the 3rd party shared libraries would export
0b07f1
# the bfd non-stable ABI.
0b07f1
make -C bfd clean
0b07f1
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
0b07f1
0b07f1
# Rebuild libopcodes.a with -fPIC.
0b07f1
make -C opcodes clean
0b07f1
make CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes
0b07f1
0b07f1
install -m 644 bfd/libbfd.a %{buildroot}%{_libdir}
0b07f1
install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir}
0b07f1
install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
0b07f1
install -m 644 opcodes/libopcodes.a %{buildroot}%{_libdir}
0b07f1
# Remove Windows/Novell only man pages
0b07f1
rm -f %{buildroot}%{_mandir}/man1/{dlltool,nlmconv,windres,windmc}*
0b07f1
0b07f1
%if %{enable_shared}
0b07f1
chmod +x %{buildroot}%{_libdir}/lib*.so*
0b07f1
%endif
0b07f1
0b07f1
# Prevent programs from linking against libbfd and libopcodes
0b07f1
# dynamically, as they are change far too often.
0b07f1
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so
0b07f1
0b07f1
# Remove libtool files, which reference the .so libs
0b07f1
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.la
0b07f1
0b07f1
# Sanity check --enable-64-bit-bfd really works.
0b07f1
grep '^#define BFD_ARCH_SIZE 64$' %{buildroot}%{_prefix}/include/bfd.h
0b07f1
# Fix multilib conflicts of generated values by __WORDSIZE-based expressions.
0b07f1
%ifarch %{ix86} x86_64 ppc %{power64} s390 s390x sh3 sh4 sparc sparc64 arm
0b07f1
sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
0b07f1
    -e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
0b07f1
    -e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
0b07f1
    -e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
0b07f1
#define BFD_HOST_64_BIT long long\
0b07f1
#else\
0b07f1
#define BFD_HOST_64_BIT long\
0b07f1
#endif/' \
0b07f1
    -e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \
0b07f1
    %{buildroot}%{_prefix}/include/bfd.h
0b07f1
%endif
0b07f1
touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h
0b07f1
0b07f1
# Generate .so linker scripts for dependencies; imported from glibc/Makerules:
0b07f1
0b07f1
# This fragment of linker script gives the OUTPUT_FORMAT statement
0b07f1
# for the configuration we are building.
0b07f1
OUTPUT_FORMAT="\
0b07f1
/* Ensure this .so library will not be used by a link for a different format
0b07f1
   on a multi-architecture system.  */
0b07f1
$(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE2}")"
0b07f1
0b07f1
tee %{buildroot}%{_libdir}/libbfd.so <
0b07f1
/* GNU ld script */
0b07f1
0b07f1
$OUTPUT_FORMAT
0b07f1
0b07f1
/* The libz dependency is unexpected by legacy build scripts.  */
0b07f1
/* The libdl dependency is for plugin support.  (BZ 889134)  */
0b07f1
INPUT ( %{_libdir}/libbfd.a -liberty -lz -ldl )
0b07f1
EOH
0b07f1
0b07f1
tee %{buildroot}%{_libdir}/libopcodes.so <
0b07f1
/* GNU ld script */
0b07f1
0b07f1
$OUTPUT_FORMAT
0b07f1
0b07f1
INPUT ( %{_libdir}/libopcodes.a -lbfd )
0b07f1
EOH
0b07f1
0b07f1
%else # !%{isnative}
0b07f1
# For cross-binutils we drop the documentation.
0b07f1
rm -rf %{buildroot}%{_infodir}
0b07f1
# We keep these as one can have native + cross binutils of different versions.
0b07f1
#rm -rf %{buildroot}%{_prefix}/share/locale
0b07f1
#rm -rf %{buildroot}%{_mandir}
0b07f1
rm -rf %{buildroot}%{_libdir}/libiberty.a
0b07f1
%endif # !%{isnative}
0b07f1
0b07f1
# This one comes from gcc
0b07f1
rm -f %{buildroot}%{_infodir}/dir
0b07f1
rm -rf %{buildroot}%{_prefix}/%{binutils_target}
0b07f1
0b07f1
%find_lang %{?cross}binutils
0b07f1
%find_lang %{?cross}opcodes
0b07f1
%find_lang %{?cross}bfd
0b07f1
%find_lang %{?cross}gas
0b07f1
%find_lang %{?cross}gprof
0b07f1
cat %{?cross}opcodes.lang >> %{?cross}binutils.lang
0b07f1
cat %{?cross}bfd.lang >> %{?cross}binutils.lang
0b07f1
cat %{?cross}gas.lang >> %{?cross}binutils.lang
0b07f1
cat %{?cross}gprof.lang >> %{?cross}binutils.lang
0b07f1
0b07f1
if [ -x ld/ld-new ]; then
0b07f1
  %find_lang %{?cross}ld
0b07f1
  cat %{?cross}ld.lang >> %{?cross}binutils.lang
0b07f1
fi
0b07f1
if [ -x gold/ld-new ]; then
0b07f1
  %find_lang %{?cross}gold
0b07f1
  cat %{?cross}gold.lang >> %{?cross}binutils.lang
0b07f1
fi
0b07f1
0b07f1
%clean
0b07f1
rm -rf %{buildroot}
0b07f1
0b07f1
%post
0b07f1
%if "%{build_gold}" == "both"
0b07f1
%__rm -f %{_bindir}/%{?cross}ld
0b07f1
%{alternatives_cmdline} --install %{_bindir}/%{?cross}ld %{?cross}ld \
0b07f1
  %{_bindir}/%{?cross}ld.bfd %{ld_bfd_priority}
0b07f1
%{alternatives_cmdline} --install %{_bindir}/%{?cross}ld %{?cross}ld \
0b07f1
  %{_bindir}/%{?cross}ld.gold %{ld_gold_priority}
0b07f1
%{alternatives_cmdline} --auto %{?cross}ld
0b07f1
%endif
0b07f1
%if %{isnative}
0b07f1
/sbin/ldconfig
0b07f1
%if %{with docs}
0b07f1
  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/as.info.gz
0b07f1
  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
0b07f1
  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
0b07f1
  /sbin/install-info --info-dir=%{_infodir} %{_infodir}/ld.info.gz
0b07f1
%endif # with docs
0b07f1
%endif # %{isnative}
0b07f1
exit 0
0b07f1
0b07f1
%preun
0b07f1
%if "%{build_gold}" == "both"
0b07f1
if [ $1 = 0 ]; then
0b07f1
  %{alternatives_cmdline} --remove %{?cross}ld %{_bindir}/%{?cross}ld.bfd
0b07f1
  %{alternatives_cmdline} --remove %{?cross}ld %{_bindir}/%{?cross}ld.gold
0b07f1
fi
0b07f1
%endif
0b07f1
%if %{isnative}
0b07f1
if [ $1 = 0 ]; then
0b07f1
  if [ -e %{_infodir}/binutils.info.gz ]
0b07f1
  then
0b07f1
    /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/as.info.gz
0b07f1
    /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/binutils.info.gz
0b07f1
    /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/gprof.info.gz
0b07f1
    /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/ld.info.gz
0b07f1
  fi
0b07f1
fi
0b07f1
%endif
0b07f1
exit 0
0b07f1
0b07f1
%if %{isnative}
0b07f1
%postun -p /sbin/ldconfig
0b07f1
%endif # %{isnative}
0b07f1
0b07f1
%files -f %{?cross}binutils.lang
0b07f1
%defattr(-,root,root,-)
0b07f1
%license COPYING COPYING3 COPYING3.LIB COPYING.LIB
0b07f1
%doc README
0b07f1
%{_bindir}/%{?cross}[!l]*
0b07f1
%if "%{build_gold}" == "both"
0b07f1
%{_bindir}/%{?cross}ld.*
0b07f1
%ghost %{_bindir}/%{?cross}ld
0b07f1
%else
0b07f1
%{_bindir}/%{?cross}ld*
0b07f1
%endif
0b07f1
%{_mandir}/man1/*
0b07f1
%if %{enable_shared}
0b07f1
%{_libdir}/lib*.so
0b07f1
%exclude %{_libdir}/libbfd.so
0b07f1
%exclude %{_libdir}/libopcodes.so
0b07f1
%endif
0b07f1
0b07f1
%if %{isnative}
0b07f1
%if %{with docs}
0b07f1
%{_infodir}/[^b]*info*
0b07f1
%{_infodir}/binutils*info*
0b07f1
%endif
0b07f1
0b07f1
%files devel
0b07f1
%defattr(-,root,root,-)
0b07f1
%{_prefix}/include/*
0b07f1
%{_libdir}/lib*.a
0b07f1
%{_libdir}/libbfd.so
0b07f1
%{_libdir}/libopcodes.so
0b07f1
%if %{with docs}
0b07f1
%{_infodir}/bfd*info*
0b07f1
%endif # with docs
0b07f1
%endif # %{isnative}
0b07f1
0b07f1
%changelog
faa3f7
* Fri Dec 01 2017 Nick Clifton  <nickc@redhat.com> 2.28-8.1
faa3f7
- Prevent the PowerPC64 linker from triggering a seg-fault when discarding dynamic sections.
faa3f7
  (#1519864)
faa3f7
0b07f1
* Thu Aug 31 2017 Nick Clifton  <nickc@redhat.com> 2.28-8
0b07f1
- Remove the Provides line from the spec file.
0b07f1
  (#1485002)
0b07f1
0b07f1
* Thu Jul 20 2017 Nick Clifton  <nickc@redhat.com> 2.28-7
0b07f1
- Add support for displaying new DWARF5 tags.
0b07f1
  (#1472955)
0b07f1
0b07f1
* Wed Jul 19 2017 Nick Clifton  <nickc@redhat.com> 2.28-6
0b07f1
- Fix s390 assembler so that it remove fake local symbols from its output.
0b07f1
  (#1460254)
0b07f1
  (#1472486)
0b07f1
0b07f1
* Mon Jun 26 2017 Nick Clifton  <nickc@redhat.com> 2.28-5
0b07f1
- Add support for LNIA instruction to PowerPC assembler.
0b07f1
  (#1357021)
0b07f1
0b07f1
* Thu Jun 15 2017 Nick Clifton  <nickc@redhat.com> 2.28-4
0b07f1
- Update patch to fix AArch64 copy reloc generation.
0b07f1
  (#1452170)
0b07f1
0b07f1
* Fri Jun 09 2017 Nick Clifton  <nickc@redhat.com> 2.28-3
0b07f1
- Ignore duplicate indirect symbols generated by the GOLD linker.
0b07f1
  (#1458003)
0b07f1
0b07f1
* Thu Jun 08 2017 Nick Clifton  <nickc@redhat.com> 2.28-2
0b07f1
- Eliminate the generation of incorrect dynamic copy relocations on AArch64.
0b07f1
  (#1452170)
0b07f1
0b07f1
* Mon May 22 2017 Nick Clifton <polacek@redhat.com> 2.28-1
0b07f1
- Rebase to FSF binutils 2.28
0b07f1
- Retire: binutils-2.23.52.0.1-addr2line-dynsymtab.patch
0b07f1
- Retire: binutils-2.27-local-dynsym-count.patch
0b07f1
- Retire: binutils-2.27-monotonic-section-offsets.patch
0b07f1
- Retire: binutils-2.27-aarch64-relro-default.patch
0b07f1
- Retire: binutils-2.27-power9.patch
0b07f1
- Import FSF binutils patch to fix running readelf on debug info binaries.
0b07f1
- Import FSF binutils patch to fix an abort with PowerPC dynamic relocs.
0b07f1
- Backport patch to add support for putting name, comp_dir and
0b07f1
  producer strings into the .debug_str section. 
0b07f1
- Add support for GNU BUILD NOTEs.
0b07f1
0b07f1
* Thu May 18 2017 Nick Clifton <polacek@redhat.com> 2.27-12
0b07f1
- Revert H.J.Lu's PLT elision patch.
0b07f1
  (#1452111)
0b07f1
0b07f1
* Thu Jan 12 2017 Nick Clifton  <nickc@redhat.com> 2.27-11
0b07f1
- Version bump to allow rebuild for DTS 6.1
0b07f1
0b07f1
* Wed Sep 28 2016 Nick Clifton  <nickc@redhat.com> 2.27-10
0b07f1
- Use correct default sysroot for native targets.
0b07f1
- Add Power9 ISA 3.0 support.
0b07f1
0b07f1
* Mon Sep 05 2016 Carlos O'Donell <carlos@redhat.com>  2.27-9
0b07f1
- Enable '--sysroot' option support for all configurations.
0b07f1
0b07f1
* Thu Sep 01 2016 Nick Clifton  <nickc@redhat.com> 2.27-8
0b07f1
- Properly disable the default generation of compressed debug sections.
0b07f1
  (#1366182)
0b07f1
0b07f1
* Thu Aug 18 2016 Nick Clifton  <nickc@redhat.com> 2.27-7
0b07f1
- Allow -z relro to be enabled by default for the AArch64 target.
0b07f1
  (#1367862)
0b07f1
0b07f1
* Wed Aug 17 2016 Nick Clifton  <nickc@redhat.com> 2.27-6
0b07f1
- Move .shstrtab section to end of section list so that the monotonic ordering of section offsets is restored.
0b07f1
  (#1366145)
0b07f1
0b07f1
* Fri Aug 12 2016 Nick Clifton  <nickc@redhat.com> 2.27-5
0b07f1
- Fix the computation of the sh_info field in the header of the .dynsym section.
0b07f1
  (#1366185)
0b07f1
0b07f1
* Thu Aug 04 2016 Nick Clifton  <nickc@redhat.com> 2.27-4
0b07f1
- Rebase on official FSF binutils 2.27 release.
0b07f1
  (#1358353)
0b07f1
0b07f1
* Thu Jul 21 2016 Nick Clifton  <nickc@redhat.com> 2.27-3
0b07f1
- Version bump so that the Brew build can be rerun, this time including ppc64 (big-endian)
0b07f1
  (#1358353)
0b07f1
0b07f1
* Wed Jul 20 2016 Nick Clifton  <nickc@redhat.com> 2.27-2
0b07f1
- Remove sim sources from tarball.
0b07f1
  (#1358353)
0b07f1
0b07f1
* Mon Jul 18 2016 Nick Clifton  <nickc@redhat.com> 2.27-1
0b07f1
- Rebase on FSF binutils 2.27 release. (#1356661)
0b07f1
- Retire: binutils-2.20.51.0.10-copy-osabi.patch
0b07f1
- Retire: binutils-2.23.2-aarch64-em.patch
0b07f1
- Retire: binutils-2.23.51.0.3-arm-ldralt.patch
0b07f1
- Retire: binutils-2.23.52.0.1-revert-pr15149.patch
0b07f1
- Retire: binutils-2.25.1-gold-testsuite-fixes.patch
0b07f1
- Retire: binutils-2.25-kernel-ld-r.bugfix.patch
0b07f1
- Retire: binutils-2.25-kernel-ld-r.patch
0b07f1
- Retire: binutils-2.25-only-keep-debug.patch
0b07f1
- Retire: binutils-2.25-x86_64-pie-relocs.patch
0b07f1
- Retire: binutils-pr18879.patch
0b07f1
- Retire: binutils-rh1224751.patch
0b07f1
- Retire: binutils-rh1309347.patch
0b07f1
- Retire: binutils-rh895241.patch
0b07f1
0b07f1
* Mon Apr 04 2016 Patsy Franklin <pfrankli@redhat.com> 2.25.1-10
0b07f1
- Fix a case where a string was being used after the memory
0b07f1
  containing the string had been freed.
0b07f1
0b07f1
* Wed Mar 02 2016 Nick Clifton <nickc@redhat.com> 2.25.1-9
0b07f1
- Bump release number by 2 in order to enable build.
0b07f1
0b07f1
* Wed Mar 02 2016 Nick Clifton <nickc@redhat.com> 2.25.1-7
0b07f1
- Fix GOLD testsuite failures.
0b07f1
  (#1312376)
0b07f1
0b07f1
* Thu Feb 25 2016 Nick Clifton <nickc@redhat.com> 2.25.1-6
0b07f1
- Change ar's default to be the creation of non-deterministic archives.
0b07f1
0b07f1
* Thu Feb 18 2016 Nick Clifton <nickc@redhat.com> 2.25.1-4
0b07f1
- Add support for Intel Memory Protection Key instructions.
0b07f1
  (#1309347)
0b07f1
0b07f1
* Thu Feb 04 2016 Nick Clifton <nickc@redhat.com> 2.25.1-2
0b07f1
- Import patch for FSF PR 18879
0b07f1
  (#1260034)
0b07f1
0b07f1
* Thu Jan 14 2016 Nick Clifton <nickc@redhat.com> 2.25.1-1
0b07f1
- Rebase on FSF binutils 2.25.1 release.
0b07f1
- Retire patch binutils-2.25-x86_64-pie-relocs.patch
0b07f1
0b07f1
* Tue Sep 22 2015 Nick Clifton <nickc@redhat.com> 2.25-10
0b07f1
- Improved patch to preserve the sh_link and sh_info fields in stripped ELF sections.
0b07f1
  (#1246390)
0b07f1
0b07f1
* Wed Aug 5 2015 Nick Clifton <nickc@redhat.com> 2.25-9
0b07f1
- Import patch from FSF to preserve the sh_link and sh_info fields in stripped ELF sections.
0b07f1
  (#1246390)
0b07f1
0b07f1
* Tue Aug 4 2015 Jeff Law <law@redhat.com> 2.25-8
0b07f1
- Backport Cary's patch to silence pedantic warning in gold
0b07f1
  (#895241)
0b07f1
0b07f1
* Thu Jun 4 2015 Jeff Law <law@redhat.com> 2.25-7
0b07f1
- Resync with Fedora (binutils-2.25)
0b07f1
  Reapply DTS specific patches
0b07f1
  Backport testsuite patch to fix gold testsuite failure
0b07f1