On Tue, Feb 27, 2024 at 10:13 AM Jakub Jelinek <ja...@redhat.com> wrote: > > On Tue, Feb 27, 2024 at 10:04:06AM +0100, Jakub Jelinek wrote: > > > I hope we at least avoid that at -O0, possibly also with -Og? > > > > r14-8495 fixed at least that. > > > > Of course, it can break debugging experience even when the noreturn function > > is compiled with -O2 but some or all callers of that are -O0 or -Og. > > So, if unlucky and e.g. abort function in glibc gets the > > no_callee_saved_registers treatment and actually uses some call saved > > registers, backtraces when something aborts will be worse or useless. > > And we don't even have any attribute which would tell gcc not to do that. > > > > So sure, another option is just revert the PR38534 changes. > > For __libc_start_main, glibc surely just could use no_callee_saved_registers > attribute, because that is typically the outermost frame in backtrace, > there is no need to save those there. > And for kernel if it really wants it and nothing will use the backtraces, > perhaps the patch wouldn't need to be reverted completely but just guarded > the implicit no_callee_saved_registers treatment of noreturn > functions on -mcmodel=kernel or -fno-asynchronous-unwind-tables.
I guess the kernel could also add the attribute to appropriate places? Or we have a -mno-noreturn-callee-saved-registers But yeah, I think this is an overall bad change (to make this the default behavior for noreturn functions). Richard. > Jakub >