MIPS: R2: Try to bulletproof instruction_hazard against miss-compilation. Gcc has a tradition of misscompiling the previous construct using the address of a label as argument to inline assembler. Gas otoh has the annoying difference between la and dla which are only usable for 32-bit rsp. 64-bit code, so can't be used without conditional compilation. The alterantive is switching the assembler to 64-bit code which happens to work right even for 32-bit code ... Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Ralf Baechle and committed by
7043ad4f 15265251

+15 -5
+15 -5
include/asm-mips/hazards.h
··· 233 #endif 234 235 #ifdef CONFIG_CPU_MIPSR2 236 #define instruction_hazard() \ 237 do { \ 238 - __label__ __next; \ 239 __asm__ __volatile__( \ 240 " jr.hb %0 \n" \ 241 - : \ 242 - : "r" (&&__next)); \ 243 - __next: \ 244 - ; \ 245 } while (0) 246 247 #else
··· 233 #endif 234 235 #ifdef CONFIG_CPU_MIPSR2 236 + /* 237 + * gcc has a tradition of misscompiling the previous construct using the 238 + * address of a label as argument to inline assembler. Gas otoh has the 239 + * annoying difference between la and dla which are only usable for 32-bit 240 + * rsp. 64-bit code, so can't be used without conditional compilation. 241 + * The alterantive is switching the assembler to 64-bit code which happens 242 + * to work right even for 32-bit code ... 243 + */ 244 #define instruction_hazard() \ 245 do { \ 246 + unsigned long tmp; \ 247 + \ 248 __asm__ __volatile__( \ 249 + " .set mips64r2 \n" \ 250 + " dla %0, 1f \n" \ 251 " jr.hb %0 \n" \ 252 + " .set mips0 \n" \ 253 + "1: \n" \ 254 + : "=r" (tmp)); \ 255 } while (0) 256 257 #else