public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Cc: Jan Hubicka <hubicka@ucw.cz>, Martin Jambor <mjambor@suse.cz>
Subject: [PATCH] IPA: support -flto + -flive-patching=inline-clone
Date: Wed, 5 Oct 2022 13:41:37 +0200	[thread overview]
Message-ID: <df64a08d-7bbf-8270-b922-bf7016f874de@suse.cz> (raw)

There's no fundamental reason why -flive-patching=inline-clone can't
coexist with -flto. Yes, one can theoretically have many more clone
function that includes a live patch. It is pretty much the same
as in-module inlining.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

	* opts.cc (finish_options): Print sorry message only
	for -flive-patching=inline-only-static.

gcc/testsuite/ChangeLog:

	* gcc.dg/live-patching-2.c: Update scanned pattern.
	* gcc.dg/live-patching-5.c: New test.
---
 gcc/opts.cc                            | 5 +++--
 gcc/testsuite/gcc.dg/live-patching-2.c | 4 ++--
 gcc/testsuite/gcc.dg/live-patching-5.c | 8 ++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/live-patching-5.c

diff --git a/gcc/opts.cc b/gcc/opts.cc
index eb5db01de17..ae079fcd20e 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -1288,8 +1288,9 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
 	   "%<-fsanitize=kernel-address%>");
 
   /* Currently live patching is not support for LTO.  */
-  if (opts->x_flag_live_patching && opts->x_flag_lto)
-    sorry ("live patching is not supported with LTO");
+  if (opts->x_flag_live_patching == LIVE_PATCHING_INLINE_ONLY_STATIC && opts->x_flag_lto)
+    sorry ("live patching (with %qs) is not supported with LTO",
+	   "inline-only-static");
 
   /* Currently vtable verification is not supported for LTO */
   if (opts->x_flag_vtable_verify && opts->x_flag_lto)
diff --git a/gcc/testsuite/gcc.dg/live-patching-2.c b/gcc/testsuite/gcc.dg/live-patching-2.c
index 0dde4e9e0c0..1c4f9229b82 100644
--- a/gcc/testsuite/gcc.dg/live-patching-2.c
+++ b/gcc/testsuite/gcc.dg/live-patching-2.c
@@ -1,10 +1,10 @@
 /* { dg-do compile } */
 /* { dg-require-effective-target lto } */
-/* { dg-options "-O2 -flive-patching -flto" } */
+/* { dg-options "-O2 -flive-patching=inline-only-static -flto" } */
 
 int main()
 {
   return 0;
 }
 
-/* { dg-message "sorry, unimplemented: live patching is not supported with LTO" "-flive-patching and -flto together" { target *-*-* } 0 } */
+/* { dg-message "sorry, unimplemented: live patching \\(with 'inline-only-static'\\) is not supported with LTO" "-flive-patching and -flto together" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/live-patching-5.c b/gcc/testsuite/gcc.dg/live-patching-5.c
new file mode 100644
index 00000000000..098047a36cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/live-patching-5.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-O2 -flive-patching -flto" } */
+
+int main()
+{
+  return 0;
+}
-- 
2.37.3


             reply	other threads:[~2022-10-05 11:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 11:41 Martin Liška [this message]
2022-10-05 14:50 ` Qing Zhao
2022-10-05 17:36   ` Martin Liška
2022-10-05 18:18     ` Qing Zhao
2022-10-06  8:29       ` Richard Biener
2022-10-06  8:40         ` Martin Liška
2022-10-06 13:18         ` Qing Zhao
2022-10-07  6:34           ` Richard Biener
2022-10-07 13:03             ` Jan Hubicka
2022-10-07 14:30               ` Qing Zhao
2022-10-07 14:43                 ` Jan Hubicka
2022-10-07 15:36                   ` Qing Zhao
2022-10-07 13:04             ` Qing Zhao
2022-10-07 13:50               ` Martin Liška

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=df64a08d-7bbf-8270-b922-bf7016f874de@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mjambor@suse.cz \
    /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).