Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <romain.naour@gmail.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Romain Naour and committed by
Thomas Bogendoerfer
1d7ba016 137fceb7

+21 -5
+21 -5
arch/mips/include/asm/vdso/gettimeofday.h
··· 20 20 21 21 #define VDSO_HAS_CLOCK_GETRES 1 22 22 23 + #if MIPS_ISA_REV < 6 24 + #define VDSO_SYSCALL_CLOBBERS "hi", "lo", 25 + #else 26 + #define VDSO_SYSCALL_CLOBBERS 27 + #endif 28 + 23 29 static __always_inline long gettimeofday_fallback( 24 30 struct __kernel_old_timeval *_tv, 25 31 struct timezone *_tz) ··· 41 35 : "=r" (ret), "=r" (error) 42 36 : "r" (tv), "r" (tz), "r" (nr) 43 37 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 44 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 38 + "$14", "$15", "$24", "$25", 39 + VDSO_SYSCALL_CLOBBERS 40 + "memory"); 45 41 46 42 return error ? -ret : ret; 47 43 } ··· 67 59 : "=r" (ret), "=r" (error) 68 60 : "r" (clkid), "r" (ts), "r" (nr) 69 61 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 70 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 62 + "$14", "$15", "$24", "$25", 63 + VDSO_SYSCALL_CLOBBERS 64 + "memory"); 71 65 72 66 return error ? -ret : ret; 73 67 } ··· 93 83 : "=r" (ret), "=r" (error) 94 84 : "r" (clkid), "r" (ts), "r" (nr) 95 85 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 96 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 86 + "$14", "$15", "$24", "$25", 87 + VDSO_SYSCALL_CLOBBERS 88 + "memory"); 97 89 98 90 return error ? -ret : ret; 99 91 } ··· 117 105 : "=r" (ret), "=r" (error) 118 106 : "r" (clkid), "r" (ts), "r" (nr) 119 107 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 120 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 108 + "$14", "$15", "$24", "$25", 109 + VDSO_SYSCALL_CLOBBERS 110 + "memory"); 121 111 122 112 return error ? -ret : ret; 123 113 } ··· 139 125 : "=r" (ret), "=r" (error) 140 126 : "r" (clkid), "r" (ts), "r" (nr) 141 127 : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", 142 - "$14", "$15", "$24", "$25", "hi", "lo", "memory"); 128 + "$14", "$15", "$24", "$25", 129 + VDSO_SYSCALL_CLOBBERS 130 + "memory"); 143 131 144 132 return error ? -ret : ret; 145 133 }