public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>,
	Uros Bizjak <ubizjak@gmail.com>,
	hjl.tools@gmail.com, Hongtao Liu <crazylht@gmail.com>,
	Jan Hubicka <jh@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] i386: Guard noreturn no-callee-saved-registers optimization with -mnoreturn-no-callee-saved-registers [PR38534]
Date: Wed, 28 Feb 2024 09:53:57 +0100	[thread overview]
Message-ID: <Zd70pRvWPKZmtT3n@tucnak> (raw)
In-Reply-To: <Zd7oGZH0FIKlTbXZ@tucnak>

Hi!

Adding Hongtao and Honza into the loop as the ones who acked the original
patch.

The no_callee_saved_registers by default for noreturn functions change can
break in-process backtrace(3) or backtraces from debugger or other process
(quite often, any time the noreturn function decides to use the bp register
and any of the parent frames uses a frame pointer; the unwinder just crashes
in the libgcc unwinder case, gdb prints stack corrupted message), so I'd
like to save bp register in that case:

https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646591.html

and additionally the no_callee_saved_registers by default for noreturn
functions change can make debugging harder, again not localized to the
noreturn function, but any of its callers.  So, if say glibc abort function
implementation needs a lot of normally callee-saved registers, no matter how
users recompile their apps, they will see garbage or optimized out
vars/parameters in their code unless they rebuild their glibc with -O0.
So, I think we should guard that by a non-default option:

https://gcc.gnu.org/pipermail/gcc-patches/2024-February/646649.html

Plus we need to somehow make sure to emit DW_CFA_undefined for the modified
but not saved normally callee-saved registers, so that we at least don't get
garbage in debug info.  H.J. posted some patches for that, so far I wasn't
happy about the implementation but the actual change is desirable.

Your thoughts on this?

	Jakub


  reply	other threads:[~2024-02-28  8:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  8:40 [PATCH] i386: For noreturn functions save at least the bp register if it is used [PR114116] Jakub Jelinek
2024-02-27  8:54 ` Richard Biener
2024-02-27  9:04   ` Jakub Jelinek
2024-02-27  9:13     ` Jakub Jelinek
2024-02-27  9:50       ` Richard Biener
2024-02-27  9:55       ` Jakub Jelinek
2024-02-27 12:09       ` Jakub Jelinek
2024-02-27 14:57         ` [PATCH] i386: Guard noreturn no-callee-saved-registers optimization with -mnoreturn-no-callee-saved-registers [PR38534] Jakub Jelinek
2024-02-28  8:00           ` Jakub Jelinek
2024-02-28  8:53             ` Jakub Jelinek [this message]
2024-02-29  6:20               ` Hongtao Liu
2024-02-29 12:26                 ` H.J. Lu
2024-02-29 12:47                   ` Jakub Jelinek
2024-02-29 13:24                     ` Richard Biener
2024-02-29 13:31                       ` Jan Hubicka
2024-02-29 13:56                         ` Jakub Jelinek
2024-02-29 14:15                           ` Jan Hubicka
2024-02-29 14:28                             ` H.J. Lu
2024-02-29 15:10                             ` Jakub Jelinek
2024-02-29 15:26                               ` Jan Hubicka
2024-03-05  4:52                 ` Hongtao Liu
2024-02-29 16:25         ` [PATCH] i386: For noreturn functions save at least the bp register if it is used [PR114116] Michael Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zd70pRvWPKZmtT3n@tucnak \
    --to=jakub@redhat.com \
    --cc=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jh@suse.cz \
    --cc=richard.guenther@gmail.com \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).