From patchwork Wed Oct 5 11:41:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp555425wrs; Wed, 5 Oct 2022 04:42:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4BuUa++TD/bzSzmr8o8TpO8LNdwk29ATPXTxFv6C515pj+SgSM4SREv0f4BeZjwd/PJdge X-Received: by 2002:a05:6402:557:b0:458:7488:8958 with SMTP id i23-20020a056402055700b0045874888958mr23569208edx.242.1664970142682; Wed, 05 Oct 2022 04:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664970142; cv=none; d=google.com; s=arc-20160816; b=vxNfVtjegTan/IkjSct8n0ej1LWl3+HSE1n67KBs4hgtV81F1WLRr9mwR3u87xw1iK oRVSA68uqjmAnDhnaxWB1fQqasufZ/1qJi/LEiZ+s8rca3nUmLvzokS8catf/VrSohsV 95E2B12NNafU9nCteMYnpy8wLEfL84WpIeAltyfd8hJeLBAy+X8VR9liWDlb6Y+xpTct eUPymzro2464IGkDvvaAoUk5QEEbQ7nJnIrh/AFCzb1/VILno+Y8aAtp5jw2Ds/TY2HH xE5DKzCSuNhlVcr61xhhfzNNyxpvWloCTST5ZGDmP8ARdwMAutGZ5NpzsogOec5DmvlJ uFTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:to:subject:from:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature:dmarc-filter:delivered-to; bh=w6gPDljlsnbSRfeTNjeLwnf902JyD/yl4HcvpCd7vgs=; b=wrSgfUKe1d4BbEMHSdvEWApTMEOpSL6s7E3sfNcnv4+jn2ICX2yqHYtbKcHEMps2g4 9zQZRJdPLMaAh4Iu2sCUrtqti4XjLeWSZIXzuzrds541JV+t7960fhnDdDVZ3leMs7GT UG3m0PyqYC0mng6p4lHJJjLsJ3v5VdB6YAFM/rIMaKQGf2gfy1kov9bVAd/zXpzBwiI+ lHNTMMasvfxuiwGejPWCCFdPwmQKiSYZjUuFkJtxVUO1JiXFWSGNtrcgdKdMLump2xEs 7MJrfP9wefA7cYL9mARofZoOd7gMzlwugV8X+J87AqVUMew/ZmaAWofRy8Da0jzX26vW mV+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@suse.cz header.s=susede2_rsa header.b="N2PgJjl/"; dkim=neutral (no key) header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ss2-20020a170907c00200b007882926c091si9362426ejc.768.2022.10.05.04.42.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 04:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=fail header.i=@suse.cz header.s=susede2_rsa header.b="N2PgJjl/"; dkim=neutral (no key) header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AB5CE385741C for ; Wed, 5 Oct 2022 11:42:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jan Hubicka Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745847732120307724?= X-GMAIL-MSGID: =?utf-8?q?1745847732120307724?= 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; +}