Building with ancient gcc versions results in a stream of build errors like:
arch/arm/include/asm/io.h:100: error: impossible constraint in 'asm' arch/arm/include/asm/io.h:118: error: impossible constraint in 'asm'
This reverts to an older version of __raw_readl, __raw_writel and __my_cpu_offset, which seem to be the only functions affected by this.
Signed-off-by: Arnd Bergmann arnd@arndb.de --- arch/arm/include/asm/io.h | 8 ++++++++ arch/arm/include/asm/percpu.h | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 6f89a4d9fc85..d0f89c4cb8e2 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -97,8 +97,12 @@ static inline void __raw_writeb(u8 val, volatile void __iomem *addr) #define __raw_writel __raw_writel static inline void __raw_writel(u32 val, volatile void __iomem *addr) { +#if GCC_VERSION < 40200 + *(volatile u32 __force *)addr = val; +#else asm volatile("str %1, %0" : : "Qo" (*(volatile u32 __force *)addr), "r" (val)); +#endif }
#define __raw_readb __raw_readb @@ -115,9 +119,13 @@ static inline u8 __raw_readb(const volatile void __iomem *addr) static inline u32 __raw_readl(const volatile void __iomem *addr) { u32 val; +#if GCC_VERSION < 40200 + val = *(volatile u32 __force *)addr; +#else asm volatile("ldr %0, %1" : "=r" (val) : "Qo" (*(volatile u32 __force *)addr)); +#endif return val; }
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h index a89b4076cde4..dee4c89b4458 100644 --- a/arch/arm/include/asm/percpu.h +++ b/arch/arm/include/asm/percpu.h @@ -36,9 +36,12 @@ static inline unsigned long __my_cpu_offset(void) * We want to allow caching the value, so avoid using volatile and * instead use a fake stack read to hazard against barrier(). */ +#if GCC_VERSION < 40200 + asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : : "memory"); +#else asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : "Q" (*(const unsigned long *)current_stack_pointer)); - +#endif return off; } #define __my_cpu_offset __my_cpu_offset()