]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
IPA: support -flto + -flive-patching=inline-clone
authorMartin Liska <mliska@suse.cz>
Wed, 5 Oct 2022 09:15:36 +0000 (11:15 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 7 Oct 2022 13:46:30 +0000 (15:46 +0200)
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.

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
gcc/testsuite/gcc.dg/live-patching-2.c
gcc/testsuite/gcc.dg/live-patching-5.c [new file with mode: 0644]

index eb5db01de1716b8748b268fe08e65d0c155403bb..ae079fcd20eeae7a6588bae76a968e62812abe97 100644 (file)
@@ -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)
index 0dde4e9e0c07110514f425342c441b24d4dd0772..1c4f9229b82819f2dad73397d72ea1b513f0c66f 100644 (file)
@@ -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 (file)
index 0000000..098047a
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-O2 -flive-patching -flto" } */
+
+int main()
+{
+  return 0;
+}