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: Try using real versions of libbfd.so and libopcodes.so
Date: Wed, 11 Nov 2026 16:07:57 GMT	[thread overview]
Message-ID: <179441327720.1.6480974887993907202.rpms-binutils-ebf24e343871@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/binutils
Branch : rawhide
Commit : ebf24e34387113557b947f8f195ee22b67e5db31
Author : Nick Clifton <nickc@redhat.com>
Date   : 2026-11-11T16:07:31+00:00
Stats  : +24/-60 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/binutils/c/ebf24e34387113557b947f8f195ee22b67e5db31?branch=rawhide

Log:
Try using real versions of libbfd.so and libopcodes.so

---
diff --git a/binutils-hide-global-symbols.patch b/binutils-hide-global-symbols.patch
deleted file mode 100644
index a0dd4d2..0000000
--- a/binutils-hide-global-symbols.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-diff -rup orig/bfd/bfd.c binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c
---- orig/bfd/bfd.c	2026-11-09 10:11:35.396075783 +0000
-+++ binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c	2026-11-09 10:25:51.698227198 +0000
-@@ -852,8 +852,8 @@ const char *const bfd_errmsgs[] =
-   N_("#<invalid error code>")
- };
- 
--static THREAD_LOCAL bfd_error_type bfd_error;
--static THREAD_LOCAL char *_bfd_error_buf;
-+static bfd_error_type  bfd_error ATTRIBUTE_HIDDEN;
-+static char *          _bfd_error_buf ATTRIBUTE_HIDDEN;
- 
- /* Free any data associated with the BFD error.  */
- 
-diff -rup orig/bfd/bfd.c binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c
---- orig/bfd/bfd.c	2026-11-10 09:07:31.056699912 +0000
-+++ binutils-with-gold-2.47.50-86187fd72fd/bfd/bfd.c	2026-11-10 09:08:14.146312472 +0000
-@@ -1732,7 +1732,7 @@ _bfd_per_xvec_warn (struct per_xvec_mess
-    error_handler_sprintf; when NULL, _bfd_error_internal will be used
-    instead.  */
- 
--static THREAD_LOCAL struct per_xvec_messages *error_handler_messages;
-+static struct per_xvec_messages *error_handler_messages ATTRIBUTE_HIDDEN;
- 
- /* A special value for error_handler_messages that indicates that the
-    error should simply be ignored.  */
-diff -rup orig/bfd/syms.c binutils-with-gold-2.47.50-86187fd72fd/bfd/syms.c
---- orig/bfd/syms.c	2026-11-10 09:08:42.394913499 +0000
-+++ binutils-with-gold-2.47.50-86187fd72fd/bfd/syms.c	2026-11-10 15:35:14.279642378 +0000
-@@ -349,7 +349,7 @@ EXTERNAL
- .   symbol name, even unnamed local symbols which will also have empty
- .   string names.  This can be used to flag a symbol as corrupt if its
- .   name uses an out of range string table index.  *}
--.extern const char bfd_symbol_error_name[];
-+.extern const char bfd_symbol_error_name[] ATTRIBUTE_HIDDEN;
- */
- 
- #include "sysdep.h"
-@@ -359,6 +359,7 @@ EXTERNAL
- #include "bfdlink.h"
- #include "aout/stab_gnu.h"
- 
-+extern const char bfd_symbol_error_name[] ATTRIBUTE_HIDDEN;
- const char bfd_symbol_error_name[] = { 0 };
- 
- /*

diff --git a/binutils.spec b/binutils.spec
index 6e107c9..5033bce 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: 29%{?dist}
+Release: 30%{?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,15 +401,6 @@ 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
-# thread local global variables inside a static library.  This is a problem
-# for the libbfd.so library, since it is really a static library in disguise.
-# Solution: hide the global symbols.
-# Lifetime: Permanent.
-Patch22: binutils-hide-global-symbols.patch
-# %%endif
-
 #----------------------------------------------------------------------------
 
 # Purpose:  Remove the Build protected-func-2 without PIE linker tests
@@ -1315,21 +1306,21 @@ install_binutils()
         # Future: Remove libiberty together with its header file, projects should bundle it.
         %make_build -s -C libiberty clean
         %set_build_flags
-        %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libiberty
+        %make_build -s CFLAGS="-g -fPIC -DPIC $RPM_OPT_FLAGS" -C libiberty
 
         # Without the hidden visibility the 3rd party shared libraries would
 	# export the bfd non-stable ABI.
         %make_build -s -C bfd clean
         %set_build_flags
-        %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
+        %make_build -s CFLAGS="-g -fPIC -DPIC $RPM_OPT_FLAGS -fvisibility=hidden" -C bfd
 
         %make_build -s -C opcodes clean
         %set_build_flags
-        %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C opcodes
+        %make_build -s CFLAGS="-g -fPIC -DPIC $RPM_OPT_FLAGS" -C opcodes
 
         %make_build -s -C libsframe clean
         %set_build_flags
-        %make_build -s CFLAGS="-g -fPIC $RPM_OPT_FLAGS" -C libsframe
+        %make_build -s CFLAGS="-g -fPIC -DPIC $RPM_OPT_FLAGS" -C libsframe
 
         install -m 644 bfd/.libs/libbfd.a           $local_libdir
         install -m 644 libiberty/libiberty.a        $local_libdir
@@ -1351,9 +1342,20 @@ install_binutils()
         chmod +x $local_libdir/lib*.so*
 %endif
 
+%if 1
+        # We used to replace the libbfd.so and libopcodes.so shared libraries with
+        # linker scripts that instead link with the libbfd.a and libopcodes.s static
+        # archives.  This no longer works (for x86_64 at least) because the linker
+        # will refuse to link non-hidden global symbols from a static archive against
+        # a shared object.  Before gcc's -fvisibility=hidden used to resolve this
+        # issue for us, but that no longer makes all globals hidden, only some.
+        # So for now we are back to exporting real shared libraries.  We can only
+        # hope that the possibly changing ABIs will not cause problems.
+%else
         # Prevent programs from linking against libbfd and libopcodes
         # dynamically, as they are changed far too often.
         rm -f $local_libdir/lib{bfd,opcodes}.so
+%endif
 
         # Remove libtool files, which reference the .so libs
         rm -f %local_libdir/lib{bfd,opcodes}.la
@@ -1377,6 +1379,10 @@ install_binutils()
 
         touch -r ../bfd/bfd-in2.h $local_incdir/bfd.h
 
+%if 1
+        # See above.  We are no longer creating linker scripts to replace
+        # the libbfd.so and libopcodes.so shared libraries.
+%else
         # Generate .so linker scripts for dependencies; imported from
 	# glibc/Makerules:
 
@@ -1416,6 +1422,7 @@ $OUTPUT_FORMAT
 
 INPUT ( %{_libdir}/libopcodes.a -lbfd )
 EOH
+%endif
 
         rm -fr $local_root/$target
 
@@ -1842,6 +1849,9 @@ exit 0
 
 #----------------------------------------------------------------------------
 %changelog
+* Wed Nov 11 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-30
+- Try building exporting the real libbfd.so and libopcodes.so instead.  (#2564442)
+
 * Tue Nov 10 2026 Nick Clifton <nickc@redhat.com> - 2.47.50-29
 - Yet another attempt to remove global static variables from libbfd.so.  (#2564442)
 

                 reply	other threads:[~2026-11-11 16:07 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=179441327720.1.6480974887993907202.rpms-binutils-ebf24e343871@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