public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/binutils] rawhide: Use -lzstd in the libbfd.so script.  (#2493579)
Date: Tue, 03 Nov 2026 08:06:53 GMT	[thread overview]
Message-ID: <179369321301.1.9890374173744009318.rpms-binutils-679c4def8f6e@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/binutils
            Branch : rawhide
            Commit : 679c4def8f6efe7d6fd4abfdb51170ca16f1b059
            Author : Nick Clifton <nickc@redhat.com>
            Date   : 2026-11-03T08:06:08+00:00
            Stats  : +127/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/binutils/c/679c4def8f6efe7d6fd4abfdb51170ca16f1b059?branch=rawhide

            Log:
            Use -lzstd in the libbfd.so script.  (#2493579)
Remove global static variable from libbfd.so.  (#2564442)

---
diff --git a/binutils-no-static-globals-in-libbfd.so.patch b/binutils-no-static-globals-in-libbfd.so.patch
new file mode 100644
index 0000000..ffbebaf
--- /dev/null
+++ b/binutils-no-static-globals-in-libbfd.so.patch
@@ -0,0 +1,81 @@
+diff -rup orig/bfd/bfd.c binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c
+--- orig/bfd/bfd.c	2026-11-02 13:48:46.966876451 +0000
++++ binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c	2026-11-02 13:54:44.043119048 +0000
+@@ -852,7 +852,16 @@ const char *const bfd_errmsgs[] =
+   N_("#<invalid error code>")
+ };
+ 
+-static THREAD_LOCAL bfd_error_type bfd_error;
++static inline bfd_error_type
++get_set_bfd_error (bfd_error_type e)
++{
++  static THREAD_LOCAL bfd_error_type bfd_error;
++
++  if (e != bfd_error_invalid_error_code)
++    bfd_error = e;
++  return bfd_error;
++}
++
+ static THREAD_LOCAL char *_bfd_error_buf;
+ 
+ /* Free any data associated with the BFD error.  */
+@@ -860,7 +869,7 @@ static THREAD_LOCAL char *_bfd_error_buf
+ static void
+ _bfd_clear_error_data (void)
+ {
+-  bfd_error = bfd_error_no_error;
++  (void) get_set_bfd_error (bfd_error_no_error);
+   free (_bfd_error_buf);
+   _bfd_error_buf = NULL;
+ }
+@@ -899,8 +908,7 @@ DESCRIPTION
+ void
+ bfd_set_error (bfd_error_type error_tag)
+ {
+-  bfd_error = error_tag;
+-  if (bfd_error >= bfd_error_on_input)
++  if (get_set_bfd_error (error_tag) >= bfd_error_on_input)
+     abort ();
+ }
+ 
+@@ -928,7 +936,7 @@ bfd_set_input_error (bfd *input, bfd_err
+     abort ();
+   if (bfd_asprintf (_(bfd_errmsgs[bfd_error_on_input]),
+ 		    bfd_get_filename (input), bfd_errmsg (error_tag)))
+-    bfd_error = bfd_error_on_input;
++    (void) get_set_bfd_error (bfd_error_on_input);
+ }
+ 
+ /*
+--- orig/bfd/bfd.c	2026-11-02 14:47:59.337099974 +0000
++++ binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c	2026-11-02 14:48:46.814280770 +0000
+@@ -888,7 +888,7 @@ DESCRIPTION
+ bfd_error_type
+ bfd_get_error (void)
+ {
+-  return bfd_error;
++  return get_set_bfd_error (bfd_error_invalid_error_code);
+ }
+ 
+ /*
+--- orig/bfd/bfd.c	2026-11-02 15:06:50.572575618 +0000
++++ binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c	2026-11-02 15:07:51.815784835 +0000
+@@ -852,14 +852,14 @@ const char *const bfd_errmsgs[] =
+   N_("#<invalid error code>")
+ };
+ 
++static THREAD_LOCAL bfd_error_type local_bfd_error;
++
+ static inline bfd_error_type
+ get_set_bfd_error (bfd_error_type e)
+ {
+-  static THREAD_LOCAL bfd_error_type bfd_error;
+-
+   if (e != bfd_error_invalid_error_code)
+-    bfd_error = e;
+-  return bfd_error;
++    local_bfd_error = e;
++  return local_bfd_error;
+ }
+ 
+ static THREAD_LOCAL char *_bfd_error_buf;

diff --git a/binutils.spec b/binutils.spec
index e67915a..f44d736 100644
--- a/binutils.spec
+++ b/binutils.spec
@@ -7,7 +7,7 @@ Name: binutils%{?_with_debug:-debug}
 # The variable %%{source} (see below) should be set to indicate which of these
 # origins is being used.
 Version: 2.47.50
-Release: 21%{?dist}
+Release: 23%{?dist}
 License: GPL-3.0-or-later AND (GPL-3.0-or-later WITH Bison-exception-2.2) AND (LGPL-2.0-or-later WITH GCC-exception-2.0) AND BSD-3-Clause AND GFDL-1.3-or-later AND GPL-2.0-or-later AND LGPL-2.1-or-later AND LGPL-2.0-or-later
 URL: https://sourceware.org/binutils
 
@@ -401,6 +401,14 @@ Patch20: binutils-gold-s390-configure.patch
 # Lifetime: Permanent.
 Patch21: binutils-ld-default-z-text.patch
 
+# %%ifarch x86_64 
+# Purpose:  The x86_64 architecture does not allow a shared library to access
+# static variables inside a static library.  This is a problem for the
+# libbfd.so library, since it is really a static library in disguise.
+# Lifetime: Permanent.
+Patch22: binutils-no-static-globals-in-libbfd.so.patch
+# %%endif
+
 #----------------------------------------------------------------------------
 
 # Purpose:  Remove the Build protected-func-2 without PIE linker tests
@@ -521,6 +529,9 @@ Provides: binutils-static = %{version}-%{release}
 %if %{with systemzlib}
 Requires: zlib-devel
 %endif
+%if %{with zstd}
+Requires: libzstd-devel
+%endif
 Requires: binutils = %{version}-%{release}
 # BZ 1215242: We need touch...
 Requires: coreutils
@@ -611,6 +622,10 @@ Requires: coreutils
 # zlib-devel provides libz.so
 Requires: zlib-devel
 %endif
+%if %{with zstd}
+# libzstd-devel provides libzstd.so
+Requires: libzstd-devel
+%endif
 BuildRequires: autoconf automake perl sed coreutils make gcc findutils gcc-c++
 
 # We build host == target versions of the cross binutils as this simplifies
@@ -634,6 +649,9 @@ Requires: coreutils
 %if %{with systemzlib}
 Requires: zlib-devel
 %endif
+%if %{with zstd}
+Requires: libzstd-devel
+%endif
 BuildRequires: autoconf automake perl sed coreutils make gcc findutils gcc-c++
 
 # We build host == target versions of the cross binutils as this simplifies
@@ -657,6 +675,9 @@ Requires: coreutils
 %if %{with systemzlib}
 Requires: zlib-devel
 %endif
+%if %{with zstd}
+Requires: libzstd-devel
+%endif
 BuildRequires: autoconf automake perl sed coreutils make gcc findutils gcc-c++
 
 # We build host == target versions of the cross binutils as this simplifies
@@ -681,6 +702,9 @@ Requires: coreutils
 %if %{with systemzlib}
 Requires: zlib-devel
 %endif
+%if %{with zstd}
+Requires: libzstd-devel
+%endif
 BuildRequires: autoconf automake perl sed coreutils make gcc findutils gcc-c++
 
 # We build host == target versions of the cross binutils as this simplifies
@@ -706,6 +730,9 @@ Requires: coreutils
 %if %{with systemzlib}
 Requires: zlib-devel
 %endif
+%if %{with zstd}
+Requires: libzstd-devel
+%endif
 BuildRequires: autoconf automake perl sed coreutils make gcc findutils gcc-c++
 
 # We build host == target versions of the cross binutils as this simplifies
@@ -1359,6 +1386,17 @@ install_binutils()
    on a multi-architecture system.  */
 $(gcc $CFLAGS $LDFLAGS -shared -x c /dev/null -o /dev/null -Wl,--verbose -v 2>&1 | sed -n -f "%{SOURCE1}")"
 
+%if %{with zstd}
+        tee $local_libdir/libbfd.so <<EOH
+/* GNU ld script */
+
+$OUTPUT_FORMAT
+
+/* The libz, libzstd & libsframe dependencies are unexpected by legacy build scripts.  */
+/* The libdl dependency is for plugin support.  (BZ 889134)  */
+INPUT ( %{_libdir}/libbfd.a %{_libdir}/libsframe.a -liberty -lz -lzstd -ldl )
+EOH
+%else
         tee $local_libdir/libbfd.so <<EOH
 /* GNU ld script */
 
@@ -1368,6 +1406,7 @@ $OUTPUT_FORMAT
 /* The libdl dependency is for plugin support.  (BZ 889134)  */
 INPUT ( %{_libdir}/libbfd.a %{_libdir}/libsframe.a -liberty -lz -ldl )
 EOH
+%endif
 
         tee $local_libdir/libopcodes.so <<EOH
 /* GNU ld script */
@@ -1802,6 +1841,12 @@ exit 0
 
 #----------------------------------------------------------------------------
 %changelog
+* Mon Nov 02 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-23
+- Use -lzstd in the libbfd.so script.  (#2493579)
+
+* Mon Nov 02 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-22
+- Remove global static variable from libbfd.so.  (#2564442)
+
 * Thu Oct 29 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-21
 - Rebase to commit 86187fd72fd
 

                 reply	other threads:[~2026-11-03  8:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179369321301.1.9890374173744009318.rpms-binutils-679c4def8f6e@fedoraproject.org \
    --to=nickc@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox