https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119279
--- Comment #4 from Linus Torvalds <torva...@linux-foundation.org> --- (In reply to Richard Biener from comment #3) > I think > > asm ("" : : "g" (__builtin_frame_address_(0))) > > and using that input as frame pointer looks spot-on semantically, is that > what you are actually using or are you then using %rbp anyway in the > assembler text? The kernel is actually never interested in the %rbp value at all in the asm itself. In fact, the __builtin_frame_address_(0) version is somewhat inconvenient for the kernel, because then we need a different version of the same thing when we *don't* compile with frame pointers. What we actually care about is that the asm has to be in a context where the call instruction is valid, and results in proper stack frames in the callee. IOW, it isn't about %rbp directly, it's about being able to follow stack frames when tracing or when exceptions happen. So basically *if* the code is generated with frame pointers, the ASM needs to be after the frame had been set up. That does obviously mean that %rbp is valid, but that's not the primary issue per see, and the asm doesn't itself directly care.