From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id AF5D93858C56; Fri, 7 Oct 2022 13:47:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF5D93858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665150454; bh=HyCbNCS+uLp+xC9DTv4QAjw+E4E4JRRaqlWoTqk0xN0=; h=From:To:Subject:Date:From; b=w4vz74hLhvlMIEceJCMTYK+OMJ65y1ReNo6XNxwtO8U8UzPZxaEtvsDSsOLQmz3jn RxOaJjqgGuFjRTsYjyaszqgecG5nOf9vdY1jnhUr5k7Nja38i/u0bFMvwKKn9XtkAa Fn63nRBFEOhgUQKdVd9z4wQldHP6FNdLrgWBivBI= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3164] IPA: support -flto + -flive-patching=inline-clone X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: edbb2551d156d69a2e337dcd8daa69f2680d57ea X-Git-Newrev: 1a308905c1baf64d0ea4d09d7d92b55e79a2a339 Message-Id: <20221007134734.AF5D93858C56@sourceware.org> Date: Fri, 7 Oct 2022 13:47:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1a308905c1baf64d0ea4d09d7d92b55e79a2a339 commit r13-3164-g1a308905c1baf64d0ea4d09d7d92b55e79a2a339 Author: Martin Liska Date: Wed Oct 5 11:15:36 2022 +0200 IPA: support -flto + -flive-patching=inline-clone 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. Diff: --- 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(-) 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; +}