https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113312
Xin Li <xin at zytor dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xin at zytor dot com --- Comment #22 from Xin Li <xin at zytor dot com> --- Per Peter's suggestion, I added __attribute__((no_callee_saved_registers)) to a linux source tree containing FRED patches: https://github.com/xinli-intel/linux-fred-public/commit/12c38143a5c33e89f2b3d8906629dd4f23f8d79c. And I compiled the linux code with a gcc built from https://gitlab.com/x86-gcc/gcc/-/tree/users/hjl/pr113312/gcc-13. Following are my observations: 1) the generated kernel boots fine on both FRED Simics model and bare metal. 2) the asm code generated for fred_entry_from_{user,kernel}() are the same, i.e., __attribute__((no_callee_saved_registers)) makes no difference (Peter said the FRED dispatch points simply do not have significant register pressure – intentionally). 3) other functions with __attribute__((no_callee_saved_registers)) do get rid of pushing/popping clobbered registers, and cause no issues because they are top-level functions, only invoked by tail call, meaning the following case won't happen: <func>: ... mov (%rbx), %r13 call foo mov %rax, (%r13) ... otherwise foo() is NOT a top-level function.