summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-10-09 19:58:36 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-10-16 22:52:44 (GMT)
commit775f599f5cbb243167b6daa8f5a206ccb522f4ae (patch)
tree6b59abf293dcdc446822a1ed72838b670b456e4e /meta
parentede79dea7c4595e856ac2385a7220565a2d4a00b (diff)
downloadpoky-775f599f5cbb243167b6daa8f5a206ccb522f4ae.tar.gz
gcc: Backport fix for a segfault on riscv
seen during kernel compile (From OE-Core rev: 908cf4d624d54f0dc46f5f5cc1879b89e1640692) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.2.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-7.2/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch51
2 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.2.inc b/meta/recipes-devtools/gcc/gcc-7.2.inc
index 796e6b1..5883bc6 100644
--- a/meta/recipes-devtools/gcc/gcc-7.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-7.2.inc
@@ -74,6 +74,7 @@ SRC_URI = "\
74 file://0047-sync-gcc-stddef.h-with-musl.patch \ 74 file://0047-sync-gcc-stddef.h-with-musl.patch \
75 file://0048-gcc-Enable-static-PIE.patch \ 75 file://0048-gcc-Enable-static-PIE.patch \
76 file://fix-segmentation-fault-precompiled-hdr.patch \ 76 file://fix-segmentation-fault-precompiled-hdr.patch \
77 file://0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch \
77 ${BACKPORTS} \ 78 ${BACKPORTS} \
78" 79"
79BACKPORTS = "\ 80BACKPORTS = "\
diff --git a/meta/recipes-devtools/gcc/gcc-7.2/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch b/meta/recipes-devtools/gcc/gcc-7.2/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch
new file mode 100644
index 0000000..5a14d04
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-7.2/0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch
@@ -0,0 +1,51 @@
1From 16210e6270e200cd4892a90ecef608906be3a130 Mon Sep 17 00:00:00 2001
2From: Kito Cheng <kito.cheng@gmail.com>
3Date: Thu, 4 May 2017 02:11:13 +0800
4Subject: [PATCH] RISC-V: Handle non-legitimate address in
5 riscv_legitimize_move
6
7GCC may generate non-legitimate address due to we allow some
8load/store with non-legitimate address in pic.md.
9
10 2017-05-12 Kito Cheng <kito.cheng@gmail.com>
11
12 * config/riscv/riscv.c (riscv_legitimize_move): Handle
13 non-legitimate address.
14---
15Upstream-Status: Backport
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17
18 gcc/ChangeLog | 5 +++++
19 gcc/config/riscv/riscv.c | 16 ++++++++++++++++
20 2 files changed, 21 insertions(+)
21
22diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
23index f7fec4bfcf8..d519be1659a 100644
24--- a/gcc/config/riscv/riscv.c
25+++ b/gcc/config/riscv/riscv.c
26@@ -1385,6 +1385,22 @@ riscv_legitimize_move (enum machine_mode mode, rtx dest, rtx src)
27 return true;
28 }
29
30+ /* RISC-V GCC may generate non-legitimate address due to we provide some
31+ pattern for optimize access PIC local symbol and it's make GCC generate
32+ unrecognizable instruction during optmizing. */
33+
34+ if (MEM_P (dest) && !riscv_legitimate_address_p (mode, XEXP (dest, 0),
35+ reload_completed))
36+ {
37+ XEXP (dest, 0) = riscv_force_address (XEXP (dest, 0), mode);
38+ }
39+
40+ if (MEM_P (src) && !riscv_legitimate_address_p (mode, XEXP (src, 0),
41+ reload_completed))
42+ {
43+ XEXP (src, 0) = riscv_force_address (XEXP (src, 0), mode);
44+ }
45+
46 return false;
47 }
48
49--
502.14.2
51