From 3717c76eb24217c14a22f72fdd8732923729dee8 Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Fri, 27 Oct 2017 17:43:51 +0800 Subject: gcc: fix miscompilation on mips64 We've observed strange behaviour of `systemctl status on qemumips64. The output of the command is like `systemctl show ', which is incorrect. This patch is from gcc bugzilla's attachment. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81803 The patch hasn't been merged into gcc. But it does solve the above problem. Signed-off-by: Chen Qi Signed-off-by: Ross Burton --- meta/recipes-devtools/gcc/gcc-7.2.inc | 1 + .../fix-miscompilation-for-O1-on-mips64el.patch | 35 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc-7.2/fix-miscompilation-for-O1-on-mips64el.patch diff --git a/meta/recipes-devtools/gcc/gcc-7.2.inc b/meta/recipes-devtools/gcc/gcc-7.2.inc index 5883bc61a6..04edad77cb 100644 --- a/meta/recipes-devtools/gcc/gcc-7.2.inc +++ b/meta/recipes-devtools/gcc/gcc-7.2.inc @@ -75,6 +75,7 @@ SRC_URI = "\ file://0048-gcc-Enable-static-PIE.patch \ file://fix-segmentation-fault-precompiled-hdr.patch \ file://0050-RISC-V-Handle-non-legitimate-address-in-riscv_legiti.patch \ + file://fix-miscompilation-for-O1-on-mips64el.patch \ ${BACKPORTS} \ " BACKPORTS = "\ diff --git a/meta/recipes-devtools/gcc/gcc-7.2/fix-miscompilation-for-O1-on-mips64el.patch b/meta/recipes-devtools/gcc/gcc-7.2/fix-miscompilation-for-O1-on-mips64el.patch new file mode 100644 index 0000000000..28020b0e3b --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-7.2/fix-miscompilation-for-O1-on-mips64el.patch @@ -0,0 +1,35 @@ +This patch comes from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81803 + +Author: mpf + +This patch hasn't been merged into gcc. But it does solve the problem of +strange behaviour of `systemd status ' on qemumips64. + +Upstream-Status: Pending [Taken from gcc bugzilla's attachment] + +Signed-off-by: Chen Qi +--- + gcc/lra-constraints.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c +index c8bc9b9a66f..6d319662b09 100644 +--- a/gcc/lra-constraints.c ++++ b/gcc/lra-constraints.c +@@ -4235,7 +4235,12 @@ curr_insn_transform (bool check_only_p) + && (goal_alt[i] == NO_REGS + || (simplify_subreg_regno + (ira_class_hard_regs[goal_alt[i]][0], +- GET_MODE (reg), byte, mode) >= 0))))) ++ GET_MODE (reg), byte, mode) >= 0)))) ++ || (type != OP_IN ++ && GET_MODE_PRECISION (mode) ++ < GET_MODE_PRECISION (GET_MODE (reg)) ++ && GET_MODE_SIZE (GET_MODE (reg)) <= UNITS_PER_WORD ++ && WORD_REGISTER_OPERATIONS)) + { + /* An OP_INOUT is required when reloading a subreg of a + mode wider than a word to ensure that data beyond the +-- +2.13.0 + -- cgit 1.2.3-korg