1 From bb04c220d82598066eeadf49defaec1157d4d206 Mon Sep 17 00:00:00 2001
2 From: Romain Naour <romain.naour@gmail.com>
3 Date: Sat, 25 Jul 2020 11:46:01 +0200
4 Subject: [PATCH] mips: Do not include hi and lo in clobber list for R6
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
10 "GCC 10 (PR 91233) won't silently allow registers that are not architecturally
11 available to be present in the clobber list anymore, resulting in build failure
12 for mips*r6 targets in form of:
14 .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target
15 146 | __asm__ volatile ( \
18 This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension.
19 This patch provides the alternative clobber list for r6 targets that won't include
22 Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to build
23 for mips r6 cpus with gcc 10 for the same reason as glibc.
25 [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8
26 [2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=24640f233b466051ad3a5d2786d2951e43026c9d
28 Signed-off-by: Romain Naour <romain.naour@gmail.com>
30 arch/mips/include/asm/vdso/gettimeofday.h | 45 +++++++++++++++++++++++
31 1 file changed, 45 insertions(+)
33 diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h
34 index 0ae9b4cbc153..ea600e0ebfe7 100644
35 --- a/arch/mips/include/asm/vdso/gettimeofday.h
36 +++ b/arch/mips/include/asm/vdso/gettimeofday.h
37 @@ -36,12 +36,21 @@ static __always_inline long gettimeofday_fallback(
38 register long nr asm("v0") = __NR_gettimeofday;
39 register long error asm("a3");
41 +#if MIPS_ISA_REV >= 6
44 + : "=r" (ret), "=r" (error)
45 + : "r" (tv), "r" (tz), "r" (nr)
46 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
47 + "$14", "$15", "$24", "$25", "memory");
51 : "=r" (ret), "=r" (error)
52 : "r" (tv), "r" (tz), "r" (nr)
53 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
54 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
57 return error ? -ret : ret;
59 @@ -60,12 +69,21 @@ static __always_inline long clock_gettime_fallback(
61 register long error asm("a3");
63 +#if MIPS_ISA_REV >= 6
66 + : "=r" (ret), "=r" (error)
67 + : "r" (clkid), "r" (ts), "r" (nr)
68 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
69 + "$14", "$15", "$24", "$25", "memory");
73 : "=r" (ret), "=r" (error)
74 : "r" (clkid), "r" (ts), "r" (nr)
75 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
76 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
79 return error ? -ret : ret;
81 @@ -84,12 +102,21 @@ static __always_inline int clock_getres_fallback(
83 register long error asm("a3");
85 +#if MIPS_ISA_REV >= 6
88 + : "=r" (ret), "=r" (error)
89 + : "r" (clkid), "r" (ts), "r" (nr)
90 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
91 + "$14", "$15", "$24", "$25", "memory");
95 : "=r" (ret), "=r" (error)
96 : "r" (clkid), "r" (ts), "r" (nr)
97 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
98 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
101 return error ? -ret : ret;
103 @@ -108,12 +135,21 @@ static __always_inline long clock_gettime32_fallback(
104 register long nr asm("v0") = __NR_clock_gettime;
105 register long error asm("a3");
107 +#if MIPS_ISA_REV >= 6
110 + : "=r" (ret), "=r" (error)
111 + : "r" (clkid), "r" (ts), "r" (nr)
112 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
113 + "$14", "$15", "$24", "$25", "memory");
117 : "=r" (ret), "=r" (error)
118 : "r" (clkid), "r" (ts), "r" (nr)
119 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
120 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
123 return error ? -ret : ret;
125 @@ -128,12 +164,21 @@ static __always_inline int clock_getres32_fallback(
126 register long nr asm("v0") = __NR_clock_getres;
127 register long error asm("a3");
129 +#if MIPS_ISA_REV >= 6
132 + : "=r" (ret), "=r" (error)
133 + : "r" (clkid), "r" (ts), "r" (nr)
134 + : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
135 + "$14", "$15", "$24", "$25", "memory");
139 : "=r" (ret), "=r" (error)
140 : "r" (clkid), "r" (ts), "r" (nr)
141 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
142 "$14", "$15", "$24", "$25", "hi", "lo", "memory");
145 return error ? -ret : ret;