From patchwork Tue Jan 24 02:04:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 646009 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp2511990pvb; Mon, 23 Jan 2023 18:06:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXuExXeXqkTKn16PPyTXaS/PHr07K+wADyfgecbNb+NNjI2L1icxdm8s7m5h3oSMlLjz4bIF X-Received: by 2002:a05:622a:4a83:b0:3a8:55c:a893 with SMTP id fw3-20020a05622a4a8300b003a8055ca893mr40991072qtb.0.1674525965269; Mon, 23 Jan 2023 18:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674525965; cv=none; d=google.com; s=arc-20160816; b=uGKffyTjuWzTBL1m5l9wJ4gWXnldCBgB9LOxuGgVNDoUlvUNbpMUK8H1CLrsX4rUC1 JhlEq6iZgBlExujthr8DTV6uRIOdD8zfN513n/pmtAHOZ3wu1OXklzsvDWPZo9o1GRQ1 /UkNKlTcNMD9bxqu5lo037QI2nI6zV2Is9QpNePURKWvrCot+Awkd+pFDe+VDl4Z6txQ sTdccZYolOe5Pj0qc7cpR5fZH8YUfozAA1vbTdPUhUs4fmKTitcRf/XhR1Dcp+H2u5jN JtMr5nWIYxNozvWNy3qbWX9PHNEWXjCuJ+GYHMpD5//oYExZrtJv1M7O6CBQqyArdAau yc7g== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M+X3JDFyAdIiq7GuR1lXz08iKvUAJh5EzFJMUQ6OLSg=; b=T0g7x/vbmXHBZTVBpSDhlE4F9AJa+/emJL9kIh72m0wRLPM2yo0SNqJOHkA8BR2YIx Z88zWOrmc8JfQqW2UaJ/B6vBxYozkY6fE94/L+XNlBJuT0cgr6lQzCa5yIoDbbEIMJAY RZBj03oDzuEhAi2Kagp9fT9ynS+P9UmWTf3D8zHF7FcHZVqofmxtXGLpxClSM1p1CIGf wAwRx6YpFvy+0Rqoqgk3GJLRKP6GL9OLaiYB2z7e5N6RQGXhNFJrPHJyB8xtmIajQAbW WL3VPwtHJ+Q9gwmmT1fIakH4m/YhLWlNdFXsHA9A2+zhnMKX38OHLiCXxLcKO1OJJP84 WhQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zhZKY1iL; 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 bb28-20020a05622a1b1c00b003b63c3333easi569630qtb.158.2023.01.23.18.06.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jan 2023 18:06:05 -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=zhZKY1iL; 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 1pK8gh-0008Q9-MM; Mon, 23 Jan 2023 21:05:27 -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 1pK8gc-0008Oi-Cc for qemu-devel@nongnu.org; Mon, 23 Jan 2023 21:05:22 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK8ga-0003rF-I5 for qemu-devel@nongnu.org; Mon, 23 Jan 2023 21:05:22 -0500 Received: by mail-pl1-x634.google.com with SMTP id v23so13366929plo.1 for ; Mon, 23 Jan 2023 18:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M+X3JDFyAdIiq7GuR1lXz08iKvUAJh5EzFJMUQ6OLSg=; b=zhZKY1iLJ0tJpVwvD/7YJDpyoW/JarwVO0HSzDFFj/eL90SQtR8B3slbGcZ+dgOLF8 wwAvIrncNf7S1aIosQ6DzLS0QPiWj3A981O1c3tiOI0xLrKcDGw2fbvFyAuppjmuEDEO i0L3jsnhQ0bd3BT9M0T7REhYh8tQZTTfuMz8uA/bLJ0qrgy475EjvCoCUC6ZKLxv/35Z LieOeJeBkptKOA+YHbbD3WopmUELmWtV/dZRoLPaRz+FL/WLVSf8SRNkG5wFZ5UdthAi bxma+CHLPb1HLOJLR5XN08aHbnGcvNBlC6SpSvZOwxGfvIj52C2g5F291oBxZSuasTta 3tGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M+X3JDFyAdIiq7GuR1lXz08iKvUAJh5EzFJMUQ6OLSg=; b=1tKjPU1F4L0XfBDUKM5likXW9KrSxn8LYrnGpajGPX2i321Y4fnak51kX8x98iuREZ 44hwSj680WTugp9C+YYBL8QP4vUuz7DRtvxYFqN9XWoySjABDsPhsfuCZmh55uSokvBL llcOSfdD+54wJEixafbYp5e5eizLDQQKD6qo9KcWCJ6dY4XyuqRFahUqgFhYZtHr8SZp RdneckcuyGmqMff8tytAuWgl/R8s625uRKVANIZynne8Xx5+uehTq7TWmtyNM8Qedh/D mdQ/4s1E1GUFPYV/xpWjlXddIerpntUcG0ROWHrYAl97QceeHQpJmjCr+AMKUOGcqSaL jRTQ== X-Gm-Message-State: AFqh2kqMVvhkMWz4+eKgzYDKNahg77dzpEh72dz6rN15VCBKLIIbFmnO F9aAmYkOE+pIOgF8HPki8tsIW60YJCkaukvl X-Received: by 2002:a17:90a:1a5e:b0:22b:bc63:c8b0 with SMTP id 30-20020a17090a1a5e00b0022bbc63c8b0mr12528204pjl.34.1674525918509; Mon, 23 Jan 2023 18:05:18 -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 fh3-20020a17090b034300b00228e56d375asm283936pjb.33.2023.01.23.18.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 18:05:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Idan Horowitz Subject: [PULL v2 05/15] tcg: Mark tcg helpers noinline to avoid an issue with LTO Date: Mon, 23 Jan 2023 16:04:57 -1000 Message-Id: <20230124020507.3732200-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230124020507.3732200-1-richard.henderson@linaro.org> References: <20230124020507.3732200-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Idan Horowitz Signed-off-by: Richard Henderson --- 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 */