binutils/binutils.spec

362 lines
11 KiB
RPMSpec
Raw Normal View History

2019-09-30 10:32:27 -04:00
Summary: Binary utilities
Name: binutils
Version: 2.31.1
2019-12-25 15:42:36 +08:00
Release: 16
2019-09-30 10:32:27 -04:00
License: GPLv3+
URL: https://sourceware.org/binutils
Source: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Source2: binutils-2.19.50.0.1-output-format.sed
#RHEL-UPSTREAM
Patch01: binutils-2.20.51.0.2-libtool-lib64.patch
Patch02: binutils-2.25-version.patch
Patch03: binutils-2.31-export-demangle.h.patch
#BUZ:845084
Patch04: binutils-2.22.52.0.4-no-config-h-check.patch
Patch05: binutils-2.29-filename-in-error-messages.patch
#BUG:1452111 && 1333481
Patch06: binutils-2.29-revert-PLT-elision.patch
Patch07: binutils-readelf-other-sym-info.patch
Patch08: binutils-2.27-aarch64-ifunc.patch
Patch09: binutils-fix-testsuite-failures.patch
Patch10: binutils-clear-version-info.patch
Patch11: binutils-gold-ignore-discarded-note-relocs.patch
Patch12: binutils-s390-partial-relro.patch
Patch13: binutils-merge-attribute-sections.patch
Patch14: binutils-note-merge-improvements.patch
Patch15: binutils-detect-corrupt-sym-version-info.patch
Patch16: binutils-delay-ld-script-constant-eval.patch
#PATCH-CVE-UPSTREAM
Patch6000: CVE-2018-19931.patch
Patch6001: CVE-2018-19932.patch
Patch6002: CVE-2019-9077.patch
2019-12-25 15:42:36 +08:00
Patch6003: CVE-2018-17358.patch
Patch6004: CVE-2018-17360.patch
Patch6005: CVE-2018-20623.patch
Patch6006: CVE-2018-20651.patch
2019-09-30 10:32:27 -04:00
Patch6007: CVE-2019-9075.patch
Patch6008: CVE-2018-12697.patch
2019-12-25 15:42:36 +08:00
Patch6009: CVE-2019-1010204.patch
Patch6010: 0001-CVE-2018-18309.patch
Patch6011: 0002-CVE-2018-18309.patch
Patch6012: 0003-CVE-2018-18309.patch
Patch6013: 0004-CVE-2018-18309.patch
Patch6014: CVE-2018-18605.patch
Patch6015: CVE-2018-18607.patch
Patch6016: CVE-2018-18606.patch
Patch6017: CVE-2018-1000876.patch
Patch6018: CVE-2018-20002.patch
Patch6019: CVE-2019-14444.patch
Patch6020: CVE-2019-1010180.patch
Patch6021: Fix-the-handling-of-inlined-frames-in-DWARF-debug-in.patch
Patch6022: CVE-2019-17450.patch
Patch6023: CVE-2019-17451.patch
Patch6024: CVE-2019-12972.patch
Patch6025: Fix-a-failure-in-the-libiberty-testsuite-by-increasi.patch
Patch6026: CVE-2018-20671.patch
Patch6027: Fix-array-overrun-when-disassembling-corrupt-TIC30-binaries.patch
Patch6028: Fix-buffer-underrun-bug-in-the-TI-C30-disassembler.patch
Patch6029: Fix-potential-array-overruns-when-disassembling-corrupt-v850.patch
Patch6030: Prevent-a-left-shift-by-a-negative-value-when-disassembling.patch
Patch6031: Stop-potential-illegal-memory-access-in-the-NS32K.patch
Patch6032: Fix-buffer-overrun-in-TIC30-disassembler.patch
Patch6033: ubsan-ia64-left-shift-of-negative-value.patch
Patch6034: Fix-incorrect-extraction-of-signe-dconstants-in-nios2.patch
Patch6035: Remove-more-shifts-for-sign-zero-extension.patch
Patch6036: left-shift-of-cannot-be-represented-in-type-int.patch
Patch6037: Prevent-objdump-from-aborting.patch
Patch6038: ubsan-cr16-left-shift-cannot-be-represented-in-type-int.patch
2019-09-30 10:32:27 -04:00
Provides: bundled(libiberty)
Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: gcc, perl, sed, coreutils, dejagnu, zlib-devel, glibc-static, sharutils, bc, libstdc++-static
BuildRequires: bison, m4, gcc-c++, gettext, flex, zlib-devel, texinfo >= 4.0, perl-podlators
2019-12-25 15:42:36 +08:00
Requires(post): info coreutils chkconfig
Requires(preun):info chkconfig
2019-09-30 10:32:27 -04:00
%define _gnu %{nil}
# The higher of these two numbers determines the default ld.
%{!?ld_bfd_priority: %global ld_bfd_priority 50}
%{!?ld_gold_priority:%global ld_gold_priority 30}
%description
The GNU Binutils are a collection of binary tools. The main ones are:
ld - the GNU linker.
as - the GNU assembler.
addr2line - Converts addresses into filenames and line numbers.
ar - A utility for creating, modifying and extracting from archives.
c++filt - Filter to demangle encoded C++ symbols.
dlltool - Creates files for building and using DLLs.
gold - A new, faster, ELF only linker, still in beta test.
gprof - Displays profiling information.
nlmconv - Converts object code into an NLM.
nm - Lists symbols from object files.
objcopy - Copies and translates object files.
objdump - Displays information from object files.
ranlib - Generates an index to the contents of an archive.
readelf - Displays information from any ELF format object file.
size - Lists the section sizes of an object or archive file.
strings - Lists printable strings from files.
trip - Discards symbols.
windmc - A Windows compatible message compiler.
windres - A compiler for Windows resource files.
%package devel
Summary: devel package including header files and libraries.
Provides: binutils-static = %{version}-%{release}
2019-12-25 15:42:36 +08:00
Requires: zlib-devel, binutils = %{version}-%{release}, coreutils
Requires(post): info
Requires(preun):info
2019-09-30 10:32:27 -04:00
%description devel
The devel package contains BFD and opcodes static and dynamic libraries.
The static libraries are used by the dynamic libraries which are linkier
scripts imported from glibc/Makerules.
%package help
Summary: binutils help
%description help
The help package contains man files.
%prep
%autosetup -n %{name}-%{version} -p1
sed -i -e 's/%''{release}/%{release}/g' bfd/Makefile{.am,.in}
sed -i -e '/^libopcodes_la_\(DEPENDENCIES\|LIBADD\)/s,$, ../bfd/libbfd.la,' opcodes/Makefile.{am,in}
perl -pi -e 's/i\[3-7\]86/i[34567]86/g' */conf*
sed -i -e '/pagesize/s/0x1000,/0x10000,/' gold/aarch64.cc
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*aarch64.c
sed -i -e 's/^ PACKAGE=/ PACKAGE=/' */configure
# revert name change when testing.
sed -i -e "2aDEJATOOL = binutils" binutils/Makefile.am
sed -i -e "2aDEJATOOL = gas" gas/Makefile.am
sed -i -e "2aDEJATOOL = ld" ld/Makefile.am
sed -i -e "s/^DEJATOOL = .*/DEJATOOL = binutils/" binutils/Makefile.in
sed -i -e "s/^DEJATOOL = .*/DEJATOOL = gas/" gas/Makefile.in
sed -i -e "s/^DEJATOOL = .*/DEJATOOL = ld/" ld/Makefile.in
touch */configure
%build
CARGS=
case %{_target_platform} in i?86*|arm*|aarch64*)
CARGS="$CARGS --enable-64-bit-bfd"
;;
esac
case %{_target_platform} in x86_64*|i?86*|aarch64*)
CARGS="$CARGS --enable-targets=x86_64-pep --enable-relro=yes"
;;
esac
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS=$RPM_LD_FLAGS
%configure \
--quiet \
--build=%{_target_platform} --host=%{_target_platform} \
--target=%{_target_platform} \
--enable-gold=default --enable-ld \
--with-sysroot=/ \
--enable-shared \
--enable-deterministic-archives=no \
--enable-lto \
--enable-compressed-debug-sections=none \
--enable-generate-build-notes=no \
$CARGS \
--enable-plugins \
%make_build %{_smp_mflags} tooldir=%{_prefix} all
%make_build %{_smp_mflags} tooldir=%{_prefix} info
make -k check < /dev/null || :
cat {gas/testsuite/gas,ld/ld,binutils/binutils}.sum
for file in {gas/testsuite/gas,ld/ld,binutils/binutils}.{sum,log}
do
ln $file binutils-%{_target_platform}-$(basename $file) || :
done
tar cjf binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
uuencode binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}.tar.bz2
rm -f binutils-%{_target_platform}.tar.bz2 binutils-%{_target_platform}-*.{sum,log}
%install
%make_install DESTDIR=%{buildroot}
make prefix=%{buildroot}%{_prefix} infodir=%{buildroot}%{_infodir} install-info
# Rebuild static libraries with -g -fPIC.
for library in libiberty opcodes
do
%make_build -C $library clean
%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C $library
done
%make_build -C bfd clean
%make_build CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
for library in bfd/libbfd.a libiberty/libiberty.a opcodes/libopcodes.a
do
install -m 644 $library %{buildroot}%{_libdir}
done
install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
chmod +x %{buildroot}%{_libdir}/lib*.so*
# Do not use .so&&.la of libbfd and libopcodes which are not stable
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.{so,la}
%ifarch %{ix86} x86_64 arm
sed -i -e '/^#include "ansidecl.h"/{p;s~^.*$~#include <bits/wordsize.h>~;}' \
-e 's/^#define BFD_DEFAULT_TARGET_SIZE \(32\|64\) *$/#define BFD_DEFAULT_TARGET_SIZE __WORDSIZE/' \
-e 's/^#define BFD_HOST_64BIT_LONG [01] *$/#define BFD_HOST_64BIT_LONG (__WORDSIZE == 64)/' \
-e 's/^#define BFD_HOST_64_BIT \(long \)\?long *$/#if __WORDSIZE == 32\
#define BFD_HOST_64_BIT long long\
#else\
#define BFD_HOST_64_BIT long\
#endif/' \
-e 's/^#define BFD_HOST_U_64_BIT unsigned \(long \)\?long *$/#define BFD_HOST_U_64_BIT unsigned BFD_HOST_64_BIT/' \
%{buildroot}%{_prefix}/include/bfd.h
%endif
touch -r bfd/bfd-in2.h %{buildroot}%{_prefix}/include/bfd.h
# Generate linker script which is referenced to glibc/Makerules:
OUTPUT_FORMAT="\
$(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE2}")"
tee %{buildroot}%{_libdir}/libbfd.so <<EOH
/* GNU ld script */
$OUTPUT_FORMAT
INPUT ( %{_libdir}/libbfd.a -liberty -lz -ldl )
EOH
tee %{buildroot}%{_libdir}/libopcodes.so <<EOH
/* GNU ld script */
$OUTPUT_FORMAT
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOH
rm -f %{buildroot}%{_infodir}/dir
rm -rf %{buildroot}%{_prefix}/%{_target_platform}
%find_lang binutils
for library in opcodes bfd gas gprof ld gold
do
%find_lang $library
cat $library.lang >> binutils.lang
done
%post
%__rm -f %{_bindir}/ld
%{_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.bfd %{ld_bfd_priority}
%{_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.gold %{ld_gold_priority}
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --auto ld
fi
/sbin/ldconfig
%post help
for info in as.info.gz binutils.info.gz gprof.info.gz ld.info.gz
do
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/$info
done
%preun
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.bfd
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.gold
fi
%preun help
if [ $1 = 0 ]; then
if [ -e %{_infodir}/binutils.info.gz ]
then
for info in as.info.gz binutils.info.gz gprof.info.gz ld.info.gz
do
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/$info
done
fi
fi
%postun
/sbin/ldconfig
%postun help
if [ -e %{_infodir}/binutils.info.gz ]
then
for info in as.info.gz binutils.info.gz gprof.info.gz ld.info.gz
do
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/$info
done
fi
%files -f binutils.lang
%doc README
%license COPYING3 COPYING COPYING3.LIB COPYING.LIB
%{_bindir}/[!l]*
%{_bindir}/ld.*
%ghost %{_bindir}/ld
%{_libdir}/lib*.so
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%files devel
%{_prefix}/include/*
%{_libdir}/lib*.a
%{_libdir}/libbfd.so
%{_libdir}/libopcodes.so
%files help
%{_mandir}/man1/*
%{_infodir}/as.info.gz
%{_infodir}/binutils.info.gz
%{_infodir}/gprof.info.gz
%{_infodir}/ld.info.gz
%{_infodir}/[^b]*info*
%{_infodir}/binutils*info*
%{_infodir}/bfd*info*
%changelog
2019-12-25 15:42:36 +08:00
* Mon Dec 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.31.1-16
- Type:cves
- ID:CVE
- SUG:NA
- DESC:fix CVE-2018-20671 CVE-2019-12972 CVE-2019-17450 CVE-2019-17451
CVE-2018-18309 CVE-2018-18309 CVE-2018-18605 CVE-2018-18607 CVE-2018-18606
CVE-2018-1000876 CVE-2018-20002 CVE-2018-20002 CVE-2019-1010180
fix failure in the libiberty testsuite
fix stack-buffer-overflow, and use-of-uninitialized-value and shift exponent -1 is negative
2019-09-30 10:32:27 -04:00
* Mon Sep 23 2019 luhuaxin <luhuaxin@huawei.com> - 2.31.1-15
- Patch synchronization and update dependency name
- Type:cves
- ID:CVE-2019-1010204
- SUG:NA
- DESC:fix CVE-2019-1010204
* Wed Sep 04 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.31.1-14
- Package init