summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2020-05-01 22:43:42 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2020-05-01 22:43:58 +0100
commitde6868dc18e5f0a9471d357ab9906eef83a3149e (patch)
tree63b8701467ec589beb14093db8ee8fcbc64223cb /sys-devel/binutils
parentsys-apps/bubblewrap: update metadata.xml. (diff)
downloadgentoo-de6868dc18e5f0a9471d357ab9906eef83a3149e.tar.gz
gentoo-de6868dc18e5f0a9471d357ab9906eef83a3149e.tar.bz2
gentoo-de6868dc18e5f0a9471d357ab9906eef83a3149e.zip
sys-devel/binutils: fix RISC-V ld crash, bug #720280
It's a direct backport of upstream's a2714d6cca1f1c7 ("PR25900, RISC-V: null pointer dereference") Reported-by: David Michael Closes: https://bugs.gentoo.org/720280 Bug: https://sourceware.org/PR25900 Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'sys-devel/binutils')
-rw-r--r--sys-devel/binutils/binutils-2.34.ebuild1
-rw-r--r--sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch40
2 files changed, 41 insertions, 0 deletions
diff --git a/sys-devel/binutils/binutils-2.34.ebuild b/sys-devel/binutils/binutils-2.34.ebuild
index 805c709df2ad..40a250edf7b0 100644
--- a/sys-devel/binutils/binutils-2.34.ebuild
+++ b/sys-devel/binutils/binutils-2.34.ebuild
@@ -86,6 +86,7 @@ RESTRICT="!test? ( test )"
PATCHES=(
"${FILESDIR}"/${PN}-2.33-gcc-10.patch
+ "${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch
)
MY_BUILDDIR=${WORKDIR}/build
diff --git a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch
new file mode 100644
index 000000000000..ac70e504918c
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch
@@ -0,0 +1,40 @@
+https://sourceware.org/PR25900
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8
+
+From a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Fri, 1 May 2020 15:32:00 +0930
+Subject: [PATCH] PR25900, RISC-V: null pointer dereference
+
+ PR 25900
+ * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
+ accessing root.u.def of symbols. Also check root.u.def.section
+ is non-NULL. Reverse tests so as to make the logic positive.
+
+--- a/bfd/elfnn-riscv.c
++++ b/bfd/elfnn-riscv.c
+@@ -4161,15 +4161,16 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec,
+ symval = 0;
+ sym_sec = bfd_und_section_ptr;
+ }
+- else if (h->root.u.def.section->output_section == NULL
+- || (h->root.type != bfd_link_hash_defined
+- && h->root.type != bfd_link_hash_defweak))
+- continue;
+- else
++ else if ((h->root.type == bfd_link_hash_defined
++ || h->root.type == bfd_link_hash_defweak)
++ && h->root.u.def.section != NULL
++ && h->root.u.def.section->output_section != NULL)
+ {
+ symval = h->root.u.def.value;
+ sym_sec = h->root.u.def.section;
+ }
++ else
++ continue;
+
+ if (h->type != STT_FUNC)
+ reserve_size =
+--
+2.18.2
+