binutils/binutils.spec
eastb233 b4c520f7a7 Delete post, preun, postun for help package
I think it is useless to do it because these info files
are placed under standard info dir and they can be read
by info command directly.

(cherry picked from commit 82b4b465edb398ed7beba03a2db0aa7962446b98)
2023-09-06 09:47:26 +08:00

524 lines
15 KiB
RPMSpec

Summary: Binary utilities
Name: binutils
Version: 2.34
Release: 28
License: GPLv3+
URL: https://sourceware.org/binutils
Source: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Patch0: binutils-2.20.51.0.2-libtool-lib64.patch
Patch1: export-demangle.h-in-devel-package.patch
#BUZ:845084
Patch2: binutils-2.22.52.0.4-no-config-h-check.patch
#BUG:1452111
Patch3: binutils-2.29-revert-PLT-elision.patch
Patch4: binutils-2.27-aarch64-ifunc.patch
#Stop gold from complaining about relocs
Patch5: binutils-gold-ignore-discarded-note-relocs.patch
#PATCH-CVE-UPSTREAM
Patch6: CVE-2019-1010204.patch
Patch7: Import-a-fix-from-the-mainline-sources-that-prevents.patch
Patch8: PR25585-PHDR-segment-not-covered-by-LOAD-segment.patch
Patch9: Re-PR24511-nm-should-not-mark-symbols-in-.init_array.patch
Patch10: powerpc64-ld-infinite-loop.patch
Patch11: PR25745-powerpc64-ld-overflows-string-buffer-in-stat.patch
Patch12: BFD-Exclude-sections-with-no-content-from-compress-c.patch
Patch13: gas-PR-25863-Fix-scalar-vmul-inside-it-block-when-as.patch
Patch14: NDS32-disassembly-of-odd-sized-sections.patch
Patch15: asan-readelf-leaks.patch
Patch16: asan-more-readelf-leaks.patch
Patch17: Re-asan-more-readelf-leaks.patch
Patch18: readelf-leak-in-process_archive.patch
Patch19: metag-uninitialized-memory-read.patch
Patch20: Fix-a-potential-use-of-an-uninitialised-value-in-the.patch
Patch21: backport-CVE-2020-16592-PR25823-Use-after-free-in-bfd_hash_lookup.patch
Patch22: backport-CVE-2020-0551-i386-Generate-lfence.patch
Patch23: backport-0001-CVE-2021-20197.patch
Patch24: backport-0002-CVE-2021-20197.patch
Patch25: backport-0003-CVE-2021-20197.patch
Patch26: backport-Fix-a-build-problem-when-using-FreeBSD-12.patch
Patch27: backport-0004-CVE-2021-20197.patch
Patch28: backport-CVE-2021-3487.patch
Patch29: backport-CVE-2021-3549.patch
Patch30: backport-Fix-a-bogus-error-message-from-the-DWARF-LEB129.patch
Patch31: backport-Work-around-problem-in-DWARF-decoding-library.patch
Patch32: backport-Fix-the-decoding-of-DW_FORM_ref_addr-DWARF-attribute.patch
Patch33: backport-dwarf-Also-match-abbrev-base-when-searching.patch
Patch34: backport-PR28048-heap-buffer-overflow-on-readelf-Ww.patch
Patch35: backport-PR27345-binutils-arsup.c-lstat-not-available-on-all.patch
Patch36: backport-PR27349-ar-breaks-symlinks.patch
Patch37: backport-binutils-Avoid-renaming-over-existing-files.patch
Patch38: backport-PR27456-lstat-in-rename.c-on-MinGW.patch
Patch39: backport-Use-make_tempname-file-descriptor-in-smart_rename.patch
Patch40: backport-Fix-demangle-style-usage-info.patch
Patch41: backport-CVE-2021-45078.patch
Patch42: backport-0001-CVE-2021-42574.patch
Patch43: backport-0002-CVE-2021-42574.patch
Patch44: Fix-gold-relocation-offset.patch
Patch45: Fix-gold-adrp-signed-shift.patch
Patch46: CVE-2022-47008.patch
Patch47: backport-CVE-2022-47011.patch
Patch48: backport-CVE-2022-47696.patch
Patch49: backport-CVE-2021-46174.patch
Patch50: backport-CVE-2022-48064.patch
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
Requires(post): info coreutils chkconfig
Requires(preun):info chkconfig
%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}
Requires: zlib-devel, binutils = %{version}-%{release}, coreutils
Requires(post): info
Requires(preun):info
%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-deterministic-archives=no \
--enable-lto \
--enable-compressed-debug-sections=none \
--enable-generate-build-notes=no \
$CARGS \
--enable-plugins \
--enable-shared
%make_build %{_smp_mflags} tooldir=%{_prefix} all
%make_build %{_smp_mflags} tooldir=%{_prefix} info
%check
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
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*
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 libbfd.so and libbfd.so
%ifarch x86_64
tee %{buildroot}%{_libdir}/libbfd.so <<EOF
/* GNU ld script */
OUTPUT_FORMAT(elf64-x86-64)
INPUT ( %{_libdir}/libbfd.a -liberty -lz -ldl )
EOF
tee %{buildroot}%{_libdir}/libopcodes.so <<EOF
/* GNU ld script */
OUTPUT_FORMAT(elf64-x86-64)
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOF
%endif
%ifarch aarch64
tee %{buildroot}%{_libdir}/libbfd.so <<EOF
/* GNU ld script */
OUTPUT_FORMAT(elf64-littleaarch64)
INPUT ( %{_libdir}/libbfd.a -liberty -lz -ldl )
EOF
tee %{buildroot}%{_libdir}/libopcodes.so <<EOF
/* GNU ld script */
OUTPUT_FORMAT(elf64-littleaarch64)
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOF
%endif
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
%preun
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.bfd
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.gold
fi
%postun
/sbin/ldconfig
%files -f binutils.lang
%doc README
%license COPYING3 COPYING COPYING3.LIB COPYING.LIB
%{_bindir}/[!l]*
%{_bindir}/ld.*
%ghost %{_bindir}/ld
%{_libdir}/lib*.so
%{_libdir}/libctf*
%exclude %{_libdir}/libctf.a
%exclude %{_libdir}/libctf-nobfd.a
%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
* Tue Sep 05 2023 eastb233 <xiezhiheng@huawei.com> - 2.34-28
- Delete post, preun, postun for help package
* Thu Aug 31 2023 liningjie <liningjie@xfusion.com> - 2.34-27
- fix CVE-2022-48064
* Tue Aug 29 2023 liningjie <liningjie@xfusion.com> - 2.34-26
- fix CVE-2021-46174
* Sun Aug 27 2023 liningjie <liningjie@xfusion.com> - 2.34-25
- fix CVE-2022-47696
* Thu Aug 24 2023 liningjie <liningjie@xfusion.com> - 2.34-24
- fix CVE-2022-47011
* Wed Aug 23 2023 liningjie <liningjie@xfusion.com> - 2.34-23
- fix CVE-2022-47008
* Tue Oct 18 2022 konglidong <konglidong@uniontech.com> - 2.34-22
- DESC:fix the changelog exception macro
* Tue Jun 21 2022 wangding <wangding16@huawei.com> - 2.34-21
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix gold linker adrp signed shift
* Wed Jun 8 2022 wangding <wangding16@huawei.com> - 2.34-20
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix gold linker relocation offset
* Wed Jan 19 2022 panxiaohe <panxiaohe@huawei.com> - 2.34-19
- Type:CVE
- ID:CVE-2021-42574
- SUG:NA
- DESC:Fix CVE-2021-42574
* Fri Dec 24 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 2.34-18
- Type:CVE
- ID:CVE-2021-45078
- SUG:NA
- DESC:Fix CVE-2021-45078
* Thu Dec 16 2021 wangchen <wangchen137@huawei.com> - 2.34-17
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix demangle style usage info
* Tue Sep 14 2021 panxiaohe <panxiaohe@huawei.com> - 2.34-16
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix issue about delete symlink when using the strip command
* Wed Aug 18 2021 panxiaohe <panxiaohe@huawei.com> - 2.34-15
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix erroneous decoding of LEB128 values
heap-buffer-overflow on readelf -Ww
* Wed Aug 18 2021 panxiaohe <panxiaohe@huawei.com> - 2.34-14
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:rebuild for upgrade
* Thu Jul 29 2021 panxiaohe <panxiaohe@huawei.com> - 2.34-13
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:rebuild for upgrade
* Fri Jul 23 2021 panxiaohe <panxiaohe@huawei.com> - 2.34-12
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix a bogus error message from the DWARF LEB129 decoder
* Sat Jun 19 2021 wangchen <wangchen137@huawei.com> - 2.34-11
- Type:CVE
- ID:NA
- SUG:NA
- DESC:fix CVE-2021-3549
* Fri Apr 23 2021 lirui <lirui130@huawei.com> - 2.34-10
- Type:CVE
- ID:NA
- SUG:NA
- DESC:fix CVE-2021-3487
* Fri Apr 16 2021 lirui <lirui130@huawei.com> - 2.34-9
- Type:CVE
- ID:NA
- SUG:NA
- DESC:fix CVE-2021-20197
* Tue Mar 23 2021 panxiaohe <panxiaohe@huawei.com> - 2.34-8
- Type:CVE
- ID:NA
- SUG:NA
- DESC:fix CVE-2020-0551
* Mon Mar 22 2021 lirui <lirui130@huawei.com> - 2.34-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:move the test to %%check phase
* Thu Jan 28 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 2.34-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix static library file conflicts when install both binutils and binutils-devel
* Sat Jan 9 2021 zoulin <zoulin13@huawei.com> - 2.34-5
- Type:CVE
- ID:NA
- SUG:NA
- DESC:fix CVE-2020-16592
* Wed Sep 23 2020 zoulin <zoulin13@huawei.com> - 2.34-4
- Type:bugfix
- ID:NA
- SUG:Fix a memory leak in the testcase fuzz_readelf
Fix use-of-uninitialized-value in print_insn_mwtag
Fix use-of-ninitialized-value in _bfd_xcoff_slurp_armap
Fix a potential use-of-an-uninitialised-value in the print_insn_ns32k of fuzz_disassemble
* Wed Jul 15 2020 linwei<linwei54@huawei.com> - 2.34-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix use-of-uninitialized-value in print_insn_nds32
* Mon Jun 29 2020 linwei<linwei54@huawei.com> - 2.34-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:sync some patches from community
* Mon May 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.34-1
- Type:requirement
- ID:NA
- SUG:NA
- DESC:update to 2.34
* Thu Apr 02 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Use disassemble_info.private_date in place of insn_sets
* Wed Jan 22 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-5
- Type:bugfix
- ID:CVE
- SUG:NA
- DESC: fix permission
* Mon Jan 20 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-4
- Type:bugfix
- ID:CVE
- SUG:NA
- DESC:fix the issue that the permission changes due to the upgrade and
backport patch to fix memory leak and overflow
* Wed Jan 15 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-3
- Type:bugfix
- ID:CVE
- SUG:NA
- DESC:add patch to solve complaining about relocs in the .gnu.build.attribute
* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-2
- Type:bugfix
- ID:CVE
- SUG:NA
- DESC:add libbfd.so and libopcodes.so for kernel building
* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.33.1-1
- Type:enhancement
- ID:CVE
- SUG:NA
- DESC:update version to 2.33.1
* Fri 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
* 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