Skip to content

Commit

Permalink
Merge pull request #4 from sailfishos/jb55592
Browse files Browse the repository at this point in the history
[binutils] Update to 2.40. Fixes JB#55592
  • Loading branch information
mlehtima committed Jan 27, 2023
2 parents b7dc236 + ad34aff commit 4aa91fd
Show file tree
Hide file tree
Showing 18 changed files with 308 additions and 2,868 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 5fb0e308577143ceb313fde5538dc9ecb038f29f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= <chigot@adacore.com>
Date: Tue, 3 Jan 2023 14:24:43 +0100
Subject: [PATCH] configure: remove dependencies on gmp and mpfr when gdb is
disabled

Since 991180627851801f1999d1ebbc0e569a17e47c74, the configure checks
about GMP and MPFR for gdb builds have been moved to the toplevel
configure.
However, it doesn't take into account the --disable-gdb option. Meaning
that a build without gdb will require these libraries even if not
needed.

ChangeLog:

* configure.ac: Skip GMP and MPFR when --disable-gdb is
provided.
* configure: Regenerate.
---
configure | 4 +++-
configure.ac | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 417fc5a970c..9cb953a197e 100755
--- a/configure
+++ b/configure
@@ -8032,7 +8032,9 @@ if test -d ${srcdir}/gcc ; then
require_mpc=yes
fi
if test -d ${srcdir}/gdb ; then
- require_gmp=yes
+ if test "x$enable_gdb" != xno; then
+ require_gmp=yes
+ fi
fi

gmplibs="-lmpfr -lgmp"
diff --git a/configure.ac b/configure.ac
index 3a1eb0357e5..e95a9ed116e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1585,7 +1585,9 @@ if test -d ${srcdir}/gcc ; then
require_mpc=yes
fi
if test -d ${srcdir}/gdb ; then
- require_gmp=yes
+ if test "x$enable_gdb" != xno; then
+ require_gmp=yes
+ fi
fi

gmplibs="-lmpfr -lgmp"
--
2.25.1

19 changes: 10 additions & 9 deletions rpm/binutils-2.32-asneeded.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
diff -ru binutils-2.25/ld/ldmain.c binutils-2.25-asneeded/ld/ldmain.c
--- binutils-2.25/ld/ldmain.c 2014-10-14 07:32:04.000000000 +0000
+++ binutils-2.25-asneeded/ld/ldmain.c 2016-05-02 07:03:16.952477306 +0000
@@ -302,6 +302,8 @@ main (int argc, char **argv)
#ifdef DEFAULT_NEW_DTAGS
link_info.new_dtags = DEFAULT_NEW_DTAGS;
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 9290a189b0d..86fb10dc011 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -307,6 +307,8 @@ main (int argc, char **argv)
yydebug = 1;
}
#endif
+ if (getenv ("LD_AS_NEEDED") && atoi(getenv ("LD_AS_NEEDED")) > 0)
+ input_flags.add_DT_NEEDED_for_regular = TRUE;
+ input_flags.add_DT_NEEDED_for_regular = true;

ldfile_add_arch ("");
emulation = get_emulation (argc, argv);
config.build_constructors = true;
config.rpath_separator = ':';
51 changes: 48 additions & 3 deletions rpm/binutils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
%define isnative 1
%define enable_shared 1
%define run_testsuite 0
# Default: build binutils-gprofng package.
%bcond_without gprofng

Summary: A GNU collection of binary utilities
Name: binutils
Version: 2.32
Version: 2.40
Release: 1
License: GPLv3+
URL: https://github.com/sailfishos/binutils
Source: %{name}-%{version}.tar.bz2
Source1: binutils_2.32-7ubuntu1.debian.tar.gz
Source1: binutils_2.40-2ubuntu1.debian.tar.gz
Source2: binutils-2.19.50.0.1-output-format.sed
Source200: precheckin.sh
Source201: README.PACKAGER
Patch1: 0001-configure-remove-dependencies-on-gmp-and-mpfr-when-g.patch
Patch2: binutils-2.32-asneeded.patch

# MIPS gold support is not working as far as we know. The configure
Expand All @@ -27,6 +30,10 @@ Patch2: binutils-2.32-asneeded.patch
%define has_gold 0
%endif

%ifnarch %{ix86} x86_64 aarch64
%undefine with_gprofng
%endif

%if "%{name}" != "binutils"
%if "%{name}" != "cross-mipsel-binutils" && "%{name}" != "cross-i486-binutils" && "%{name}" != "cross-x86_64-binutils" && "%{name}" != "cross-aarch64-binutils"
%define binutils_target %(echo %{name} | sed -e "s/cross-\\(.*\\)-binutils/\\1/")-meego-linux-gnueabi
Expand All @@ -37,6 +44,8 @@ Patch2: binutils-2.32-asneeded.patch
%define enable_shared 0
%define isnative 0
%define run_testsuite 0
# Disable gprofng for cross builds
%undefine with_gprofng
%define cross %{binutils_target}-
# single target atm.
ExclusiveArch: %ix86 x86_64
Expand Down Expand Up @@ -90,6 +99,17 @@ Requires(preun): /sbin/install-info
%description doc
Man and info pages for %{name}.

%if %{with gprofng}
%package gprofng
Summary: Next Generating code profiling tool
Provides: gprofng = %{version}-%{release}
Requires: binutils >= %{version}

%description gprofng
Gprofng is the GNU Next Generation profiler for analyzing the performance
of Linux applications. Gprofng allows you to:
%endif

%prep
%setup -q -n %{name}-%{version}/upstream
tar xfz %{SOURCE1}
Expand All @@ -100,6 +120,7 @@ do
patch -p1 -i debian/patches/$line
done

%patch1 -p1 -b .gdbdependencies
%patch2 -p1 -b .asneeded
# From here on this is based on Fedora's build

Expand Down Expand Up @@ -178,6 +199,12 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
--enable-deterministic-archives \
--disable-werror \
--disable-gdb \
--disable-gdbserver \
%if %{with gprofng}
--enable-gprofng=yes \
%else
--enable-gprofng=no \
%endif
--disable-readline \
--disable-sim \
--disable-libdecnumber \
Expand Down Expand Up @@ -242,7 +269,7 @@ chmod +x %{buildroot}%{_libdir}/lib*.so*
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so

# Remove libtool files, which reference the .so libs
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.la
rm -f %{buildroot}%{_libdir}/*.la

%if "%{__isa_bits}" == "64"
# Sanity check --enable-64-bit-bfd really works.
Expand Down Expand Up @@ -378,20 +405,26 @@ exit 0
%{_bindir}/%{?cross}strip
%if %{enable_shared}
%{_libdir}/lib*.so
%{_libdir}/libctf*so.*
%{_libdir}/libsframe*so.*
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%{_libdir}/bfd-plugins/libdep.so
%endif

%if !%{isnative}
%exclude %{_includedir}/*
%exclude %{_libdir}/*.a
%exclude %{_libdir}/*.la
%exclude %{_libdir}/bfd-plugins/*.a
%endif

%files doc
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-%{version}
%{_mandir}/man1/*
%exclude %{_mandir}/man1/gp-*
%exclude %{_mandir}/man1/gprofng*
%if %{isnative}
%{_infodir}/*info*
%endif
Expand All @@ -404,3 +437,15 @@ exit 0
%{_libdir}/libopcodes.so
%{_libdir}/lib*.a
%endif # %{isnative}

%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
Binary file removed rpm/binutils_2.32-7ubuntu1.debian.tar.gz
Binary file not shown.
Binary file added rpm/binutils_2.40-2ubuntu1.debian.tar.gz
Binary file not shown.
51 changes: 48 additions & 3 deletions rpm/cross-aarch64-binutils.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
%define isnative 1
%define enable_shared 1
%define run_testsuite 0
# Default: build binutils-gprofng package.
%bcond_without gprofng

Summary: A GNU collection of binary utilities
Name: cross-aarch64-binutils
Version: 2.32
Version: 2.40
Release: 1
License: GPLv3+
URL: https://github.com/sailfishos/binutils
Source: %{name}-%{version}.tar.bz2
Source1: binutils_2.32-7ubuntu1.debian.tar.gz
Source1: binutils_2.40-2ubuntu1.debian.tar.gz
Source2: binutils-2.19.50.0.1-output-format.sed
Source200: precheckin.sh
Source201: README.PACKAGER
Patch1: 0001-configure-remove-dependencies-on-gmp-and-mpfr-when-g.patch
Patch2: binutils-2.32-asneeded.patch

# MIPS gold support is not working as far as we know. The configure
Expand All @@ -27,6 +30,10 @@ Patch2: binutils-2.32-asneeded.patch
%define has_gold 0
%endif

%ifnarch %{ix86} x86_64 aarch64
%undefine with_gprofng
%endif

%if "%{name}" != "binutils"
%if "%{name}" != "cross-mipsel-binutils" && "%{name}" != "cross-i486-binutils" && "%{name}" != "cross-x86_64-binutils" && "%{name}" != "cross-aarch64-binutils"
%define binutils_target %(echo %{name} | sed -e "s/cross-\\(.*\\)-binutils/\\1/")-meego-linux-gnueabi
Expand All @@ -37,6 +44,8 @@ Patch2: binutils-2.32-asneeded.patch
%define enable_shared 0
%define isnative 0
%define run_testsuite 0
# Disable gprofng for cross builds
%undefine with_gprofng
%define cross %{binutils_target}-
# single target atm.
ExclusiveArch: %ix86 x86_64
Expand Down Expand Up @@ -90,6 +99,17 @@ Requires(preun): /sbin/install-info
%description doc
Man and info pages for %{name}.

%if %{with gprofng}
%package gprofng
Summary: Next Generating code profiling tool
Provides: gprofng = %{version}-%{release}
Requires: binutils >= %{version}

%description gprofng
Gprofng is the GNU Next Generation profiler for analyzing the performance
of Linux applications. Gprofng allows you to:
%endif

%prep
%setup -q -n %{name}-%{version}/upstream
tar xfz %{SOURCE1}
Expand All @@ -100,6 +120,7 @@ do
patch -p1 -i debian/patches/$line
done

%patch1 -p1 -b .gdbdependencies
%patch2 -p1 -b .asneeded
# From here on this is based on Fedora's build

Expand Down Expand Up @@ -178,6 +199,12 @@ CFLAGS="$CFLAGS -O0 -ggdb2"
--enable-deterministic-archives \
--disable-werror \
--disable-gdb \
--disable-gdbserver \
%if %{with gprofng}
--enable-gprofng=yes \
%else
--enable-gprofng=no \
%endif
--disable-readline \
--disable-sim \
--disable-libdecnumber \
Expand Down Expand Up @@ -242,7 +269,7 @@ chmod +x %{buildroot}%{_libdir}/lib*.so*
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.so

# Remove libtool files, which reference the .so libs
rm -f %{buildroot}%{_libdir}/lib{bfd,opcodes}.la
rm -f %{buildroot}%{_libdir}/*.la

%if "%{__isa_bits}" == "64"
# Sanity check --enable-64-bit-bfd really works.
Expand Down Expand Up @@ -378,20 +405,26 @@ exit 0
%{_bindir}/%{?cross}strip
%if %{enable_shared}
%{_libdir}/lib*.so
%{_libdir}/libctf*so.*
%{_libdir}/libsframe*so.*
%exclude %{_libdir}/libbfd.so
%exclude %{_libdir}/libopcodes.so
%{_libdir}/bfd-plugins/libdep.so
%endif

%if !%{isnative}
%exclude %{_includedir}/*
%exclude %{_libdir}/*.a
%exclude %{_libdir}/*.la
%exclude %{_libdir}/bfd-plugins/*.a
%endif

%files doc
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-%{version}
%{_mandir}/man1/*
%exclude %{_mandir}/man1/gp-*
%exclude %{_mandir}/man1/gprofng*
%if %{isnative}
%{_infodir}/*info*
%endif
Expand All @@ -404,3 +437,15 @@ exit 0
%{_libdir}/libopcodes.so
%{_libdir}/lib*.a
%endif # %{isnative}

%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

0 comments on commit 4aa91fd

Please sign in to comment.