From nobody Sat May 18 14:10:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1674156856; cv=none; d=zohomail.com; s=zohoarc; b=Bl2qj1Ayh+0A8HHp8ELeZAWD9+aMHvZBqu4RjtIBEqmbO9QgYxtfVboebX4xHgaHxAaBV36ZgTf3+eyzzEGzwi0CpfTU77XghF0s6NqrV0gonA3Tuv8fVGrhIT3xshFVX5notbSKz3/Gg6q0iomntTFiQttvpArUi6D93kzXaQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674156856; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=FFeIttlONvVj1CijWZulOP3y4frElXKsrPTdIWRMz5A=; b=jI7S5ub5szWpXD8Jk/V/O4SDqVmAWV76ULOzDO0t9ytbDUmnh4/4gz6vU6ztDAnzpjg3iD5bB30OShJB+b1PuLBYMksoIqchYG7KOQezNdVQFjVl85BNSb8ZNuOG6M4cbLe7Aa9jlO/QHrQwfaXaiyTruOqMbRT3re+i1ON866U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16741568558331004.1511024492694; Thu, 19 Jan 2023 11:34:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pIY7C-00069E-Pk; Thu, 19 Jan 2023 11:50:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pIY7B-00068q-6Q for qemu-devel@nongnu.org; Thu, 19 Jan 2023 11:50:13 -0500 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIY79-0000by-AH for qemu-devel@nongnu.org; Thu, 19 Jan 2023 11:50:12 -0500 Received: by mail-pj1-x1033.google.com with SMTP id a14-20020a17090a70ce00b00229a2f73c56so6399595pjm.3 for ; Thu, 19 Jan 2023 08:50:10 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id m4-20020a170902bb8400b00192a8b35fa3sm25314683pls.122.2023.01.19.08.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 08:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FFeIttlONvVj1CijWZulOP3y4frElXKsrPTdIWRMz5A=; b=sdmpAKXTaWIqse8E577ioc6kZR8aHYGFZwtyfJBSANJ6ppoPNVIYtZtZ0esXbsef6r S6xVGdLxhOhCX3A1c5oW+t/1QnGzMP4VuNXT9SmFkWIRDSAo8ZyyJGZFYqrV1PXEG+9Z Ywx5X00lu8n8EINz04QqWSZE9MkQC7x1mqe+326oqYNx2nI2MRAoRFQZzKyLir/rXCDm ixASGWyHPVryH4QCIAiO+c7jjJHXGHNJmzz5fs6aOqiJLPj9SKt3k+2mKJEWsD75/eft JmJTSQry1T5wno2orbXvPh0l27kGWyyVxO0uy/hhgdfbYAudAuUPkgJdBNbSma4R47MZ a7EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FFeIttlONvVj1CijWZulOP3y4frElXKsrPTdIWRMz5A=; b=gDSjTYhF3owS9Wku79Y7l1AgXJclgKs7pTX4S4yJwNycSl8hiOm4gHsfH5h7oHrydr snmxyjhJn1UU6rnxr6xFD2eOUfFRdX3EtmEdDXLYOfObKwI+AFmadt9VnVjkW7LkOoXp bScN0ZNFbD8pIzSa1EdLJEflIFPSssn/TK1FOo/8L4EsdK8DTz28sL83aZvd0RHHUPpm 4hM0IvtJ05f+A5vFfQqeusTJS+3KHsJana8I42juacClL1JjbSOgoYm++UsVGI6hHZAG 6bqE/gRZWW64NoPxE/kMkMIPg/AO1kR8Lm9uozjRG3yezjTyPWRSOYLekXignrwkDzSI 7RaQ== X-Gm-Message-State: AFqh2krt51o5b6G4UzM3SmBJvrAEsbVO4Ovv+Js2yVRoKLfHI+ofABPN opJUCY4Yp77Qwl/xi68iGFFEJ9MLWyID6Sci X-Google-Smtp-Source: AMrXdXuxr0XGE0h7lepKQYtwLYTAUCFbjfI0BuzSi/gngHKb2wUpmYGsDtCW1rNNwjOebRsF00ke0g== X-Received: by 2002:a17:902:eec6:b0:191:35c9:db30 with SMTP id h6-20020a170902eec600b0019135c9db30mr12280243plb.5.1674147009354; Thu, 19 Jan 2023 08:50:09 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, idan.horowitz@gmail.com Subject: [PATCH] tcg: Mark tcg helpers noinline to avoid an issue with LTO Date: Thu, 19 Jan 2023 06:50:06 -1000 Message-Id: <20230119165006.742073-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1674156856827100003 Content-Type: text/plain; charset="utf-8" Marking helpers __attribute__((noinline)) prevents an issue with GCC's ipa-split pass under --enable-lto. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1454 Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Idan Horowitz --- Idan, please give this a try. By inspection, it fixes the issue with s390x's helper_divs32 function. r~ --- include/exec/helper-proto.h | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h index c4b1bda632..7a3f04b58c 100644 --- a/include/exec/helper-proto.h +++ b/include/exec/helper-proto.h @@ -6,34 +6,49 @@ =20 #include "exec/helper-head.h" =20 +/* + * Work around an issue with --enable-lto, in which GCC's ipa-split pass + * decides to split out the noreturn code paths that raise an exception, + * taking the __builtin_return_address() along into the new function, + * where it no longer computes a value that returns to TCG generated code. + * Despite the name, the noinline attribute affects splitter, so this + * prevents the optimization in question. Given that helpers should not + * otherwise be called directly, this should have any other visible effect. + * + * See https://gitlab.com/qemu-project/qemu/-/issues/1454 + */ +#define DEF_HELPER_ATTR __attribute__((noinline)) + #define DEF_HELPER_FLAGS_0(name, flags, ret) \ -dh_ctype(ret) HELPER(name) (void); +dh_ctype(ret) HELPER(name) (void) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_1(name, flags, ret, t1) \ -dh_ctype(ret) HELPER(name) (dh_ctype(t1)); +dh_ctype(ret) HELPER(name) (dh_ctype(t1)) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_2(name, flags, ret, t1, t2) \ -dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)); +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2)) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_3(name, flags, ret, t1, t2, t3) \ -dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3)); +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), \ + dh_ctype(t3)) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_4(name, flags, ret, t1, t2, t3, t4) \ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ - dh_ctype(t4)); + dh_ctype(t4)) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_5(name, flags, ret, t1, t2, t3, t4, t5) \ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ - dh_ctype(t4), dh_ctype(t5)); + dh_ctype(t4), dh_ctype(t5)) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_6(name, flags, ret, t1, t2, t3, t4, t5, t6) \ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ - dh_ctype(t4), dh_ctype(t5), dh_ctype(t6)); + dh_ctype(t4), dh_ctype(t5), \ + dh_ctype(t6)) DEF_HELPER_ATTR; =20 #define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7) \ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \ - dh_ctype(t7)); + dh_ctype(t7)) DEF_HELPER_ATTR; =20 #define IN_HELPER_PROTO =20 @@ -51,5 +66,6 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), d= h_ctype(t3), \ #undef DEF_HELPER_FLAGS_5 #undef DEF_HELPER_FLAGS_6 #undef DEF_HELPER_FLAGS_7 +#undef DEF_HELPER_ATTR =20 #endif /* HELPER_PROTO_H */ --=20 2.34.1