1 Star 0 Fork 11

cunshunxia/binutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
binutils.spec 8.38 KB
一键复制 编辑 原始数据 按行查看 历史
cunshunxia 提交于 2023-08-02 03:06 . upgrade t0 2.40
%undefine __brp_strip_static_archive
%undefine _strict_symbol_defs_build
Summary: A GNU collection of binary utilities
Name: binutils
Version: 2.40
Release: 1%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
Source0: https://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
Patch3000: binutils-no-config-h-check.patch
Patch3001: binutils-revert-PLT-elision.patch
Patch3002: binutils-gold-warn-unsupported.patch
Patch3003: binutils-export-demangle.h.patch
Patch3004: binutils-objcopy-note-merge-speedup.patch
Patch3005: binutils-reloc-symtab.patch
Patch3006: binutils-CVE-2023-1972.patch
Patch3007: binutils-gold-empty-dwp.patch
BuildRequires: automake, autoconf, make
BuildRequires: perl, sed, coreutils, chrpath
BuildRequires: gettext, flex, zlib-devel, texinfo >= 4.0, /usr/bin/pod2man
BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc, libstdc++
Requires(post): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives
Requires(post): coreutils
Provides: bundled(libiberty)
%ifnarch riscv64
%bcond_without gold
%else
%bcond_with gold
%endif
%bcond_without gprofng
%ifnarch x86_64 aarch64
%undefine gprofng
%endif
%if "%toolchain" == "clang"
%bcond_without clang
%else
%bcond_with clang
%endif
%if %{with gold}
Requires: binutils-gold >= %{version}
%endif
%if %{with clang}
BuildRequires: clang compiler-rt
%else
BuildRequires: gcc
%endif
%description
The GNU Binutils are a collection of binary tools. The main ones are
ld, as and gold.
But they also include:
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.
elfedit - Allows alteration of ELF format files.
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.
strip - Discards symbols.
windmc - A Windows compatible message compiler.
windres - A compiler for Windows resource files.
%if %{with gprofng}
%package gprofng
Summary: Next Generating code profiling tool
Requires: binutils = %{version}-%{release}
Provides: gprofng = %{version}-%{release}
%description gprofng
GprofNG is the GNU Next Generation Profiler for analyzing the performance
of Linux applications.
%endif
%package devel
Summary: BFD and opcodes static and dynamic libraries and header files
Requires: zlib-devel, coreutils, binutils = %{version}-%{release}
Provides: binutils-static = %{version}-%{release}
%description devel
This package provides static and dynamic libraries of BFD and opcodes.
%if %{with gold}
%package gold
Summary: The GOLD linker, a faster alternative to the BFD linker
BuildRequires: bison, m4, gcc-c++, libstdc++-static
Requires: binutils >= %{version}
Provides: gold = %{version}-%{release}
%description gold
This package provides the GOLD linker, which is intended to have
complete support for ELF. The GOLD is generally faster than the
older GNU linker.
%endif
%prep
%autosetup -p1
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*ppc.c
sed -i -e '/#define.*ELF_COMMONPAGESIZE/s/0x1000$/0x10000/' bfd/elf*aarch64.c
sed -i -e '/common_pagesize/s/4 /64 /' gold/powerpc.cc
sed -i -e '/pagesize/s/0x1000,/0x10000,/' gold/aarch64.cc
find . -name *.texi -print -exec touch {} \;
%build
%if %{with clang}
%global enable_lto 0
%global _lto_cflags %{nil}
%else
%global enable_lto 1
%endif
export LDFLAGS="$RPM_LD_FLAGS"
case %{_target_platform} in
ppc64le*)
CARGS=" --enable-targets=powerpc-linux,spu,x86_64-pep,bpf-unknown-none"
;;
*)
CARGS=" --enable-64-bit-bfd --enable-targets=x86_64-pep,bpf-unknown-none"
;;
esac
%configure \
--quiet \
--build=%{_target_platform} \
--host=%{_target_platform} \
--target=%{_target_platform} \
%if %{with gold}
--enable-gold=default \
%endif
%if %{with gprofng}
--enable-gprofng=yes \
%else
--enable-gprofng=no \
%endif
--enable-ld \
--with-sysroot=/ \
--with-system-zlib \
--enable-deterministic-archives=no \
--enable-compressed-debug-sections=none \
--enable-generate-build-notes=no \
--enable-separate-code=yes \
--enable-shared \
%if %{enable_lto}
--enable-lto \
%endif
--enable-new-dtags \
--disable-rpath \
--enable-threads=yes \
--enable-relro=yes \
$CARGS \
--enable-plugins
%make_build tooldir=%{_prefix} all
%make_build tooldir=%{_prefix} info
%install
%make_install
# Rebuild libiberty.a with -fPIC.
# Future: Remove it together with its header file, projects should bundle it.
%make_build -C libiberty clean
%set_build_flags
%make_build CFLAGS="-g -fPIC $CFLAGS" -C libiberty
install -m 644 libiberty/libiberty.a %{buildroot}%{_libdir}
install -m 644 include/libiberty.h %{buildroot}%{_prefix}/include
chmod +x %{buildroot}%{_libdir}/lib*.so*
rm -f %{buildroot}%{_mandir}/man1/{dlltool,nlmconv,windres,windmc}*
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so
rm -f %{buildroot}%{_libdir}/*.la
%ifarch x86_64
OP_FMT='elf64-x86-64'
%endif
%ifarch aarch64
OP_FMT='elf64-littleaarch64'
%endif
%ifarch riscv64
OP_FMT='elf64-littleriscv'
%endif
tee %{buildroot}%{_libdir}/libbfd.so <<EOH
/* GNU ld script */
OUTPUT_FORMAT($OP_FMT)
INPUT ( %{_libdir}/libbfd.a %{_libdir}/libsframe.a -liberty -lz -ldl )
EOH
tee %{buildroot}%{_libdir}/libopcodes.so <<EOH
/* GNU ld script */
OUTPUT_FORMAT($OP_FMT)
INPUT ( %{_libdir}/libopcodes.a -lbfd )
EOH
rm -f %{buildroot}%{_infodir}/dir
rm -rf %{buildroot}%{_prefix}/%{_target_platform}
%find_lang binutils
%find_lang opcodes
%find_lang bfd
%find_lang gas
%find_lang gprof
cat opcodes.lang >> binutils.lang
cat bfd.lang >> binutils.lang
cat gas.lang >> binutils.lang
cat gprof.lang >> binutils.lang
if [ -x ld/ld-new ]; then
%find_lang ld
cat ld.lang >> binutils.lang
fi
if [ -x gold/ld-new ]; then
%find_lang gold
cat gold.lang >> binutils.lang
fi
cd %{buildroot}%{_bindir}
chrpath --delete $(find ./ -type f -exec file {} \; | grep "\<ELF\>" | awk -F ':' '{print $1 }' | tr '\n' ' ')
cd -
chrpath --delete %{buildroot}%{_libdir}/libopcodes-%{version}.so
chrpath --delete %{buildroot}%{_libdir}/libbfd-%{version}.so
chrpath --delete %{buildroot}%{_libdir}/libctf.so.0.0.0
%if %{with gprofng}
chrpath --delete %{buildroot}%{_libdir}/gprofng/libgprofng.so.0.0.0
%endif
%check
make -k check || :
%post
rm -f %{_bindir}/ld
%{_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.bfd 50
%if %{with gold}
%{_sbindir}/alternatives --install %{_bindir}/ld ld \
%{_bindir}/ld.gold 30
%endif
exit 0
%preun
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.bfd
fi
%if %{with gold}
if [ $1 = 0 ]; then
%{_sbindir}/alternatives --remove ld %{_bindir}/ld.gold
fi
%endif
exit 0
%files -f binutils.lang
%license COPYING COPYING3 COPYING3.LIB COPYING.LIB
%doc README
%{_bindir}/*
%{_libdir}/lib*.so.*
%{_libdir}/bfd-plugins/libdep.so
%{_libdir}/libbfd-%{version}.so
%{_libdir}/libctf-nobfd.so
%{_libdir}/libctf.so
%{_libdir}/libsframe.so
%{_libdir}/libopcodes-%{version}.so
%exclude %{_bindir}/ld.gold
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%{_infodir}/*
%{_mandir}/man1/
%exclude %{_bindir}/gp-*
%exclude %{_bindir}/gprofng
%exclude %{_infodir}/gprofng*
%exclude %{_mandir}/man1/gp-*
%exclude %{_mandir}/man1/gprofng*
%if %{with gprofng}
%files gprofng
%{_bindir}/gp-*
%{_bindir}/gprofng
%{_mandir}/man1/gp-*
%{_mandir}/man1/gprofng*
%{_infodir}/gprofng.info.*
%dir %{_libdir}/gprofng
%{_libdir}/gprofng/*
%{_sysconfdir}/gprofng.rc
%endif
%files devel
%{_prefix}/include/*
%{_libdir}/lib*.a
%{_libdir}/libbfd.so
%{_libdir}/libopcodes.so
%if %{with gold}
%files gold
%{_bindir}/ld.gold
%endif
%changelog
* Wed Aug 02 2023 cunshunxia <cunshunxia@tencent.com> - 2.40-1
- Update to 2.40.
* Fri Apr 28 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 2.38-4
- Rebuilt for OpenCloudOS Stream 23.05
* Fri Mar 31 2023 OpenCloudOS Release Engineering <releng@opencloudos.tech> - 2.38-3
- Rebuilt for OpenCloudOS Stream 23
* Mon Jan 16 2023 cunshunxia <cunshunxia@tencent.com> - 2.38-2
- fix duplicate file in different pkgs.
* Thu Jul 28 2022 cunshunxia <cunshunxia@tencent.com> - 2.38-1
- initial build
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cunshunxia/binutils.git
git@gitee.com:cunshunxia/binutils.git
cunshunxia
binutils
binutils
master

搜索帮助