-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 42762 |
| Resolution | FIXED |
| Resolved on | Jun 23, 2020 14:17 |
| Version | trunk |
| OS | Linux |
| Blocks | #4440 #44654 |
| CC | @arndb,@chleroy,@hfinkel,@nathanchance,@rnav,@nemanjai,@tstellar |
| Fixed by commit(s) | aede24e a8eb6a5 |
Extended Description
The powerpc (32b) Linux kernel started panicing at runtime recently when built with LLVM due to a change in the kernel sources. We narrowed it down to commit, and a single call site of a static inline function containing extended inline assembly with constraints.
I think this concise test case distills this issue: https://godbolt.org/z/E4f1Us
Basically, we had:
// from arch/powerpc/include/asm/cache.h
// pre-commit 6c5875843b87 ("powerpc: slightly improve cache helpers")
void dcbz_old(void* addr)
{
asm volatile ("dcbz 0, %0" : : "r"(addr) : "memory");
}
then moved to:
// from arch/powerpc/include/asm/cache.h
// post-commit 6c5875843b87 ("powerpc: slightly improve cache helpers")
void dcbz_current(void* addr)
{
asm volatile ("dcbz %y0" :: "Z"((unsigned char)addr) : "memory");
}
It seems that GCC generates the same code for both cases, and LLVM matches GCC for the first case. In the second case, the codegen is wildly different, which seems like what's leading to our panic at runtime.
I'm not super familiar with the "Z" constraint and "%y" output format, but they might be related?