From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id D59123858297 for ; Wed, 5 Oct 2022 11:41:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D59123858297 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 11D3321982; Wed, 5 Oct 2022 11:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1664970111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w6gPDljlsnbSRfeTNjeLwnf902JyD/yl4HcvpCd7vgs=; b=N2PgJjl/sfPdohO0FZiuSkHg4m8oIpoWK1WcGeXGjV5rpqnBN6Ya86f8IwT/uwtcfjMfuK 4rCpdfpwrwhDUrit8RXBtLEbtXdBJPTWWy8mduhEVtwC5u0KvbyYRtlon+Ju1zE6pUgn9Y BPWxBZj6U1zIB45Jp0XvQuZhet5G07E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1664970111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w6gPDljlsnbSRfeTNjeLwnf902JyD/yl4HcvpCd7vgs=; b=0Q7+sYK9jIXVeA9jzzXYxGQDmxItO+YXHV7e0Sv59ZhQ8IZnsTFqr+c2MKpit10RfkPw5P 3gKi1Ecc+juVBcDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EF96413345; Wed, 5 Oct 2022 11:41:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SDd5OX5tPWMCVQAAMHmgww (envelope-from ); Wed, 05 Oct 2022 11:41:50 +0000 Message-ID: Date: Wed, 5 Oct 2022 13:41:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] IPA: support -flto + -flive-patching=inline-clone To: gcc-patches@gcc.gnu.org Content-Language: en-US Cc: Jan Hubicka , Martin Jambor Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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