From patchwork Thu Jan 19 16:50:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 644096 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp320823pvb; Thu, 19 Jan 2023 08:50:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtUNXUJ8TgTh1/XXH0p+7wD3Cz0z4jkJayDOzr++BrPcl13KysUC4Pxp+Uc9qH24A9My57 X-Received: by 2002:a05:6214:5cb:b0:532:1db4:405c with SMTP id t11-20020a05621405cb00b005321db4405cmr15838442qvz.34.1674147026908; Thu, 19 Jan 2023 08:50:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674147026; cv=none; d=google.com; s=arc-20160816; b=T1CyF0DEt20zdQBznjI324hczk8Rp4GpiT99N8BQHb1Tkts34NKKvWo7M6sIsybn/6 6XD2pk4ub9/fdJW33PZ5zECkYMHsNNWhjnwuPVW/aCgi+PQjnNv4RhKxDvoGuPe+5ayy Z+ob25XXTCquhV+uatgoxRArohUXmwMi+q3pQkp2AiXeExdng5e4WnohqGLrAZede4ng yox+MNLUcj8zSvs07wywGb8Nz5CbEjacqwb1PYyoB5risjqzp6lYZmq8WofCmO8u/864 PhK4qK2F/6vmXAF46ATb/mILodreKwHK3J1X5zpLAqLnh++1soMRa3ZPjUMouE8l5mFS D+Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=FFeIttlONvVj1CijWZulOP3y4frElXKsrPTdIWRMz5A=; b=raL6ffyB/r0vgg3b34vAy64ZDfAxd080Fbb4JMnkcsWLrbv0vFpgKZde5gV9qKxsEl CuksPo7pJqAdwZYPJ6hcaLYT8e6ue7wDclrk6+7yXdMWxKFGtWa72jlWpCnQJ2oFQiRg Qm1fsXYjA24EWYLYoMnkJviGjuhICIenyF9vsyQGZ6NriijHvf2vSOBNOvSG44oXE+iP GaYQcBjTXHAocIVc3BAO4lQDo5By5Bn2Zy/ibpuHqXPD+CttMpt7EvULor5B1lwmS1V5 6WSzI/WJuE+nrJ4XFHJCavY0e8p0Hhui9nu1JQ9WcsmLuJuIzjAhMDjvvpTHAKY4jicg vtGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sdmpAKXT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gh9-20020a05621429c900b0053533bd0ea6si4686519qvb.223.2023.01.19.08.50.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 08:50:26 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sdmpAKXT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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 @@ #include "exec/helper-head.h" +/* + * 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; #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; #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; #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; #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; #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; #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; #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; #define IN_HELPER_PROTO @@ -51,5 +66,6 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ #undef DEF_HELPER_FLAGS_5 #undef DEF_HELPER_FLAGS_6 #undef DEF_HELPER_FLAGS_7 +#undef DEF_HELPER_ATTR #endif /* HELPER_PROTO_H */