1 |
commit: de6868dc18e5f0a9471d357ab9906eef83a3149e |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 1 21:43:42 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 1 21:43:58 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de6868dc |
7 |
|
8 |
sys-devel/binutils: fix RISC-V ld crash, bug #720280 |
9 |
|
10 |
It's a direct backport of upstream's a2714d6cca1f1c7 |
11 |
("PR25900, RISC-V: null pointer dereference") |
12 |
|
13 |
Reported-by: David Michael |
14 |
Closes: https://bugs.gentoo.org/720280 |
15 |
Bug: https://sourceware.org/PR25900 |
16 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
17 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
18 |
|
19 |
sys-devel/binutils/binutils-2.34.ebuild | 1 + |
20 |
.../binutils/files/binutils-2.34-riscv-SEGV.patch | 40 ++++++++++++++++++++++ |
21 |
2 files changed, 41 insertions(+) |
22 |
|
23 |
diff --git a/sys-devel/binutils/binutils-2.34.ebuild b/sys-devel/binutils/binutils-2.34.ebuild |
24 |
index 805c709df2a..40a250edf7b 100644 |
25 |
--- a/sys-devel/binutils/binutils-2.34.ebuild |
26 |
+++ b/sys-devel/binutils/binutils-2.34.ebuild |
27 |
@@ -86,6 +86,7 @@ RESTRICT="!test? ( test )" |
28 |
|
29 |
PATCHES=( |
30 |
"${FILESDIR}"/${PN}-2.33-gcc-10.patch |
31 |
+ "${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch |
32 |
) |
33 |
|
34 |
MY_BUILDDIR=${WORKDIR}/build |
35 |
|
36 |
diff --git a/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch |
37 |
new file mode 100644 |
38 |
index 00000000000..ac70e504918 |
39 |
--- /dev/null |
40 |
+++ b/sys-devel/binutils/files/binutils-2.34-riscv-SEGV.patch |
41 |
@@ -0,0 +1,40 @@ |
42 |
+https://sourceware.org/PR25900 |
43 |
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 |
44 |
+ |
45 |
+From a2714d6cca1f1c7695f8dc84b49a4a51d1db86c8 Mon Sep 17 00:00:00 2001 |
46 |
+From: Alan Modra <amodra@×××××.com> |
47 |
+Date: Fri, 1 May 2020 15:32:00 +0930 |
48 |
+Subject: [PATCH] PR25900, RISC-V: null pointer dereference |
49 |
+ |
50 |
+ PR 25900 |
51 |
+ * elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before |
52 |
+ accessing root.u.def of symbols. Also check root.u.def.section |
53 |
+ is non-NULL. Reverse tests so as to make the logic positive. |
54 |
+ |
55 |
+--- a/bfd/elfnn-riscv.c |
56 |
++++ b/bfd/elfnn-riscv.c |
57 |
+@@ -4161,15 +4161,16 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec, |
58 |
+ symval = 0; |
59 |
+ sym_sec = bfd_und_section_ptr; |
60 |
+ } |
61 |
+- else if (h->root.u.def.section->output_section == NULL |
62 |
+- || (h->root.type != bfd_link_hash_defined |
63 |
+- && h->root.type != bfd_link_hash_defweak)) |
64 |
+- continue; |
65 |
+- else |
66 |
++ else if ((h->root.type == bfd_link_hash_defined |
67 |
++ || h->root.type == bfd_link_hash_defweak) |
68 |
++ && h->root.u.def.section != NULL |
69 |
++ && h->root.u.def.section->output_section != NULL) |
70 |
+ { |
71 |
+ symval = h->root.u.def.value; |
72 |
+ sym_sec = h->root.u.def.section; |
73 |
+ } |
74 |
++ else |
75 |
++ continue; |
76 |
+ |
77 |
+ if (h->type != STT_FUNC) |
78 |
+ reserve_size = |
79 |
+-- |
80 |
+2.18.2 |
81 |
+ |