Skip to content

Commit 1d7ba01

Browse files
RomainNaourtsbogend
authored andcommitted
mips: Do not include hi and lo in clobber list for R6
From [1] "GCC 10 (PR 91233) won't silently allow registers that are not architecturally available to be present in the clobber list anymore, resulting in build failure for mips*r6 targets in form of: ... .../sysdep.h:146:2: error: the register ‘lo’ cannot be clobbered in ‘asm’ for the current target 146 | __asm__ volatile ( \ | ^~~~~~~ This is because base R6 ISA doesn't define hi and lo registers w/o DSP extension. This patch provides the alternative clobber list for r6 targets that won't include those registers." Since kernel 5.4 and mips support for generic vDSO [2], the kernel fail to build for mips r6 cpus with gcc 10 for the same reason as glibc. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=020b2a97bb15f807c0482f0faee2184ed05bcad8 [2] '24640f233b46 ("mips: Add support for generic vDSO")' Signed-off-by: Romain Naour <[email protected]> Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 137fceb commit 1d7ba01

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

arch/mips/include/asm/vdso/gettimeofday.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020

2121
#define VDSO_HAS_CLOCK_GETRES 1
2222

23+
#if MIPS_ISA_REV < 6
24+
#define VDSO_SYSCALL_CLOBBERS "hi", "lo",
25+
#else
26+
#define VDSO_SYSCALL_CLOBBERS
27+
#endif
28+
2329
static __always_inline long gettimeofday_fallback(
2430
struct __kernel_old_timeval *_tv,
2531
struct timezone *_tz)
@@ -35,7 +41,9 @@ static __always_inline long gettimeofday_fallback(
3541
: "=r" (ret), "=r" (error)
3642
: "r" (tv), "r" (tz), "r" (nr)
3743
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
38-
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
44+
"$14", "$15", "$24", "$25",
45+
VDSO_SYSCALL_CLOBBERS
46+
"memory");
3947

4048
return error ? -ret : ret;
4149
}
@@ -59,7 +67,9 @@ static __always_inline long clock_gettime_fallback(
5967
: "=r" (ret), "=r" (error)
6068
: "r" (clkid), "r" (ts), "r" (nr)
6169
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
62-
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
70+
"$14", "$15", "$24", "$25",
71+
VDSO_SYSCALL_CLOBBERS
72+
"memory");
6373

6474
return error ? -ret : ret;
6575
}
@@ -83,7 +93,9 @@ static __always_inline int clock_getres_fallback(
8393
: "=r" (ret), "=r" (error)
8494
: "r" (clkid), "r" (ts), "r" (nr)
8595
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
86-
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
96+
"$14", "$15", "$24", "$25",
97+
VDSO_SYSCALL_CLOBBERS
98+
"memory");
8799

88100
return error ? -ret : ret;
89101
}
@@ -105,7 +117,9 @@ static __always_inline long clock_gettime32_fallback(
105117
: "=r" (ret), "=r" (error)
106118
: "r" (clkid), "r" (ts), "r" (nr)
107119
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
108-
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
120+
"$14", "$15", "$24", "$25",
121+
VDSO_SYSCALL_CLOBBERS
122+
"memory");
109123

110124
return error ? -ret : ret;
111125
}
@@ -125,7 +139,9 @@ static __always_inline int clock_getres32_fallback(
125139
: "=r" (ret), "=r" (error)
126140
: "r" (clkid), "r" (ts), "r" (nr)
127141
: "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13",
128-
"$14", "$15", "$24", "$25", "hi", "lo", "memory");
142+
"$14", "$15", "$24", "$25",
143+
VDSO_SYSCALL_CLOBBERS
144+
"memory");
129145

130146
return error ? -ret : ret;
131147
}

0 commit comments

Comments
 (0)