On Sat, Jun 28, 2025 at 8:30 PM H.J. Lu <hjl.to...@gmail.com> wrote: > > Update functions with no_callee_saved_registers/preserve_none attribute > to preserve frame pointer since caller may use it to save the current > stack: > > pushq %rbp > movq %rsp, %rbp > ... > call function > ... > leave > ret > > If callee changes frame pointer without restoring it, caller will fail > to restore its stack after callee returns. Do we know why the caller failed to restore rbp? Are there any assumptions in the middle-end that frame pointers must be callee saved registers(even if it's marked as caller-saved)?
> /* The current function is a function specified with the "no_callee_saved_registers" attribute. */ TYPE_NO_CALLEE_SAVED_REGISTERS, - /* The current function is a function specified with the "noreturn" - attribute. */ - TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP, Comments of "noreturn" part should be merged into that of TYPE_NO_CALLEE_SAVED_REGISTERS. +callee-saved registers. That is, all registers, except for stack and +frame pointers, can be used as scratch registers. For example, this The patch only excludes frame pointers but the document mentions both stack and frame pointers? -- BR, Hongtao