From patchwork Wed Feb 15 15:24:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 57596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp251844wrn; Wed, 15 Feb 2023 07:25:10 -0800 (PST) X-Google-Smtp-Source: AK7set+cB65R4dkBbpz/EG0Gz1y3FDjDYjm9HS7lRn4RxZ5vfMP49ObitwCGbbGSq4aGAQPARYyI X-Received: by 2002:a05:6402:4310:b0:4aa:9f2b:2f40 with SMTP id m16-20020a056402431000b004aa9f2b2f40mr4790018edc.2.1676474709985; Wed, 15 Feb 2023 07:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676474709; cv=none; d=google.com; s=arc-20160816; b=hWWjN7G4cMBraeaz4tJtCBWZqA7mJesgugwtbO5UVMutcsmiKQsxoaTQELZ4VjqnFg 2D+2EurQmyIUjkDq6uCG1CTEgr8uDMySMrqfkQ6F47J7mNpOBWcrMNShzPdSjcqcDuRt ZtHLpOyRmGPOAgou9V4EmtOx/yjhRgu02j3SwXcrdxlMx4bytEX/pSjIAnydd/CqEld/ MUHrJ6oyBUyNGQ1FZgj517La44dt22eod7ckY5Lba+psAYjcj5BZ6oAPLX9RGqhEPaxM 06DMOV60hBCwEbSeKnCG6zPGMkSxkdO2aXAeRK9b72t9rewpVSLmAdX6hJ33zVXSmq8l 8lWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=PywFf3oVuOOCrcLtssPpVQYSjQpl1j64IssGj6KYPq0=; b=AVVGlln+nTk94TsU6KWUlHnECXemgeZvgkxH2Wo8N3ALFfTyzHi9p2bHAY+2sTD4R6 oc4sfnoS6LtGZGHW+sShL/wv/r5n1+81JoK8OMkVVFcbGRPw54/TpBadhYIPj1LzFAlQ 1XgFkaaLaPvx3hAMQMYz10ypqD3PoaVn88wj05WqPhAPf4/tYrQt/SG8ih5T33tJxko6 arhjrHguPp3FCex55IH/h2G3/yRGbWX3T8LFdKkLQ3hYlvYQjot/mDoZpZi/hr77nnE/ 95orxj3BSEtRgQnI01Ysq9smcppKBMNBUBVnytFORPbAmBfC7kSEUWdjoO1r4YUmDMr4 tyqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=NwU2wiTv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c9-20020a056402120900b004ace6bc9f51si3699571edw.333.2023.02.15.07.25.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 07:25:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=NwU2wiTv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2357338582A3 for ; Wed, 15 Feb 2023 15:25:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2357338582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676474707; bh=PywFf3oVuOOCrcLtssPpVQYSjQpl1j64IssGj6KYPq0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=NwU2wiTvCUK60WJSRJR5yHfwdAubqlhdhoLX0OYLSE5lRCzcFHpwQHakasgW7C00g Tepr3J6ARIzXsvo4z66WW0rq+Zm3HoxABWmSS3uo9hCnUyCxgFG/Z5zPXQukyCUAEx 26/K1d1Y161JzJyOX170I1IRI7bbJFd9wKO+c5Zw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id D67EB3858D35 for ; Wed, 15 Feb 2023 15:24:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D67EB3858D35 Received: by mail-wr1-x42a.google.com with SMTP id k3so11898350wrv.5 for ; Wed, 15 Feb 2023 07:24:12 -0800 (PST) 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:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PywFf3oVuOOCrcLtssPpVQYSjQpl1j64IssGj6KYPq0=; b=vps8md8DpyQhy8qL92upq5xYNA82EHwA3UdCj6YAhTnQrQRn1W9RmFWX1taitlTxb/ d2EHD2BUkclVEJYzkS3eUPKO8n773jzXH9pMPkO3EBwi5PCrmMBjkhKiWu0OrQnarFMR U+wLq9GbNxAyCpmqJPwsy0mWshCbgtpJa31mIcGv3pKRlG01BfQbhld9Er2fTlpSq1bz DWdB9+7Wry/p6eX98KHVvHPUKyqlBtsh5Q9AJFsXTYnJtxQcguMGyG1qklkuambSUBGL LzZGo3XHESZ0+hHWtyGQ0jXEPiC+tXZ3xPeqCm23eRkVy/8VCmlW+MvzjX5XRzJ7HVKn H29w== X-Gm-Message-State: AO0yUKWtpyKqfW6v4163H7H8CYZaWBE+8L8v1jk/MXlXqSYLVopSS0j4 qbZap+Y5iAE63x2cKgMeDLO6o6cnIDbuJ51Q X-Received: by 2002:adf:ef0f:0:b0:2c5:4c93:d819 with SMTP id e15-20020adfef0f000000b002c54c93d819mr2152422wro.8.1676474650793; Wed, 15 Feb 2023 07:24:10 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id e29-20020a5d595d000000b002c53cc7504csm15660214wri.78.2023.02.15.07.24.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 07:24:10 -0800 (PST) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR target/90458 Date: Wed, 15 Feb 2023 16:24:09 +0100 Message-ID: <8221231.NyiUUSuA9g@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: , X-Patchwork-Original-From: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou 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?1757911145203177183?= X-GMAIL-MSGID: =?utf-8?q?1757911145203177183?= Hi, this is the incompatibility of -fstack-clash-protection with Windows SEH. Now the Windows ports always enable TARGET_STACK_PROBE, which means that the stack is always probed (out of line) so -fstack-clash-protection does nothing more. Tested on x86-64/Windows and Linux, OK for all active branches? 2023-02-15 Eric Botcazou * config/i386/i386.cc (ix86_compute_frame_layout): Disable the effects of -fstack-clash-protection for TARGET_STACK_PROBE. (ix86_expand_prologue): Likewise. diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 3cacf738c4a..22f444be23c 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -6876,7 +6876,9 @@ ix86_compute_frame_layout (void) stack clash protections are enabled and the allocated frame is larger than the probe interval, then use pushes to save callee saved registers. */ - || (flag_stack_clash_protection && to_allocate > get_probe_interval ())) + || (flag_stack_clash_protection + && !ix86_target_stack_probe () + && to_allocate > get_probe_interval ())) frame->save_regs_using_mov = false; if (ix86_using_red_zone () @@ -8761,8 +8763,11 @@ ix86_expand_prologue (void) sse_registers_saved = true; } - /* If stack clash protection is requested, then probe the stack. */ - if (allocate >= 0 && flag_stack_clash_protection) + /* If stack clash protection is requested, then probe the stack, unless it + is already probed on the target. */ + if (allocate >= 0 + && flag_stack_clash_protection + && !ix86_target_stack_probe ()) { ix86_adjust_stack_and_probe (allocate, int_registers_saved, false); allocate = 0;