public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/
Date: Tue, 25 Oct 2022 06:50:31 +0000 (UTC)	[thread overview]
Message-ID: <1666680611.158166f0cb0a9bcbbbe08606e37b9320e89f5942.grobian@gentoo> (raw)

commit:     158166f0cb0a9bcbbbe08606e37b9320e89f5942
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 25 06:50:11 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 06:50:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=158166f0

sys-devel/binutils-2.39-r4: add patch for Solaris from upstream

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 sys-devel/binutils/binutils-2.39-r4.ebuild         |  1 +
 ...inutils-2.39-protected-visibility-solaris.patch | 64 ++++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/sys-devel/binutils/binutils-2.39-r4.ebuild b/sys-devel/binutils/binutils-2.39-r4.ebuild
index 0254ffdfb7..8f34b15b0e 100644
--- a/sys-devel/binutils/binutils-2.39-r4.ebuild
+++ b/sys-devel/binutils/binutils-2.39-r4.ebuild
@@ -70,6 +70,7 @@ RESTRICT="!test? ( test )"
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
+	"${FILESDIR}"/${PN}-2.39-protected-visibility-solaris.patch
 )
 
 MY_BUILDDIR=${WORKDIR}/build

diff --git a/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch b/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch
new file mode 100644
index 0000000000..2e83e74b8d
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.39-protected-visibility-solaris.patch
@@ -0,0 +1,64 @@
+From 2c43d202aefb2b6f202a44bbb8a0baf251aae845 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 22 Aug 2022 10:26:17 -0700
+Subject: [PATCH] x86: Ignore protected visibility in shared libraries on
+ Solaris
+
+On x86, the PLT entry in executable may be used as function address for
+functions in shared libraries.  If functions are protected, the function
+address used in executable can be different from the function address
+used in shared library.  This will lead to incorrect run-time behavior
+if function pointer equality is needed.  By default, x86 linker issues
+an error in this case.
+
+On Solaris, linker issued an error for
+
+struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt);
+
+where gmtime is a protected function in libc.so.  Use gmtime's PLT entry
+in executable as function address is safe since function pointer equality
+isn't needed.  Ignore protected visibility in shared libraries on Solaris
+to disable linker error.  If function pointer equality is needed, linker
+will silently generate executable with incorrect run-time behavior on
+Solaris.
+
+	PR ld/29512
+	* elf32-i386.c (elf_i386_scan_relocs): Ignore protected
+	visibility in shared libraries on Solaris.
+	* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.
+---
+ bfd/elf32-i386.c   | 3 ++-
+ bfd/elf64-x86-64.c | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
+index 52b1db44546..9717e2c5ed6 100644
+--- a/bfd/elf32-i386.c
++++ b/bfd/elf32-i386.c
+@@ -1808,7 +1808,8 @@ elf_i386_scan_relocs (bfd *abfd,
+ 		      || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
+ 		    h->plt.refcount = 1;
+ 
+-		  if (h->pointer_equality_needed
++		  if (htab->elf.target_os != is_solaris
++		      && h->pointer_equality_needed
+ 		      && h->type == STT_FUNC
+ 		      && eh->def_protected
+ 		      && !SYMBOL_DEFINED_NON_SHARED_P (h)
+diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
+index 62a9a22317a..f3b54400013 100644
+--- a/bfd/elf64-x86-64.c
++++ b/bfd/elf64-x86-64.c
+@@ -2251,7 +2251,8 @@ elf_x86_64_scan_relocs (bfd *abfd, struct bfd_link_info *info,
+ 		      || (sec->flags & (SEC_CODE | SEC_READONLY)) != 0)
+ 		    h->plt.refcount = 1;
+ 
+-		  if (h->pointer_equality_needed
++		  if (htab->elf.target_os != is_solaris
++		      && h->pointer_equality_needed
+ 		      && h->type == STT_FUNC
+ 		      && eh->def_protected
+ 		      && !SYMBOL_DEFINED_NON_SHARED_P (h)
+-- 
+2.31.1
+


             reply	other threads:[~2022-10-25  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25  6:50 Fabian Groffen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-07 14:40 [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/, sys-devel/binutils/files/ Fabian Groffen
2023-08-30  8:56 Fabian Groffen
2023-03-01  0:52 Sam James
2017-11-25 15:16 Fabian Groffen
2017-11-25 15:04 Fabian Groffen

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=1666680611.158166f0cb0a9bcbbbe08606e37b9320e89f5942.grobian@gentoo \
    --to=grobian@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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