From patchwork Thu Sep 21 22:04:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 817190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-462739-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="p8uYgGcK"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xyrJ72DlWz9t2Q for ; Fri, 22 Sep 2017 08:04:52 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:message-id:date:mime-version:content-type; q=dns; s= default; b=x9vnx3wxJvviXchWpG/X8utI+KnmUU6SGfv0Z89E9e6FOnBsKse3X zKIZXPg1kWjFHN4akTKpnAx1G0C9CiXogKKrhrVmAfCwqiIbK9rlcbNa8DdDf9oV X3YwX6B28eT8Sq4QcECP3Y6GTISzxCz3kiop+K4YCdtU79qso0nLG0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:message-id:date:mime-version:content-type; s= default; bh=/MYU+oI9XUs6aKTKQXETTMv68Cw=; b=p8uYgGcKsdO4KPUkjEb8 XjETmahsT7yzOcbIcrg2+vsUNfUc9ZWcdXEem6h19JnDH2TDpWN2bnU1p0Xuoalh jsYSchiDw2o45kJE4m+aU6D8JCiJnNLG9GAgHMuZvtpy5xK2gE5NqPzGihti4+A4 VIwbgBv+EBX2o/WjQ6hi0Zk= Received: (qmail 46676 invoked by alias); 21 Sep 2017 22:04:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 46666 invoked by uid 89); 21 Sep 2017 22:04:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Sep 2017 22:04:43 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57DD34E34A for ; Thu, 21 Sep 2017 22:04:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 57DD34E34A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law@redhat.com Received: from localhost.localdomain (ovpn-112-41.rdu2.redhat.com [10.10.112.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FA4460178 for ; Thu, 21 Sep 2017 22:04:39 +0000 (UTC) From: Jeff Law To: gcc-patches Subject: [committed] Fix stack-clash protection failures for x86 Solaris Message-ID: <43c0a699-bc8e-e75c-b5ae-b71069cc50d7@redhat.com> Date: Thu, 21 Sep 2017 16:04:38 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 X-IsSubscribed: yes This fixes two issues that Rainer ran into on the x86 solaris port. The x86 Solaris port handles the frame pointer differently than other x86 ports. It requires frame pointers in cases that others do not -- it's a lot like aarch64 and just needed a trivial update to handle x86 solaris specially in the target-supports.exp bits. Second, the x86 does not include space for pushed registers in its computation of the amount of space to allocate (since the allocation is done by the push). This is an allocation, just one that implicitly probes as well. Regardless even though its an allocation the debug dumps which the testsuite reads indicated no stack was allocated in a function where it clearly expected an allocation. Thus the failure. The fix is trivial. If there are callee saved registers, then we have a small allocation with no probing and we reflect that in the dump output. That fixes the Solaris issues that I can test with a cross. Installing on the trunk. Jeff commit 6063f7b33dc608a95d1d1bb53c564d668fe8bb51 Author: Jeff Law Date: Thu Sep 21 16:03:21 2017 -0600 * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): Fix dump output if the only stack space is for pushed registers. * lib/target-supports.exp (check_effective_target_frame_pointer_for_non_leaf): Add case for x86 Solaris. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36d5ec05a1f..26c388b3565 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-09-21 Jeff Law + + * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): + Fix dump output if the only stack space is for pushed registers. + 2017-09-21 Richard Sandiford * config/spu/spu.c (spu_sched_adjust_cost): Update after renaming diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index aeafd0d5d21..270ee557872 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -13946,7 +13946,13 @@ ix86_adjust_stack_and_probe_stack_clash (const HOST_WIDE_INT size) no probes are needed. */ if (!size) { - dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false); + /* However, the allocation of space via pushes for register + saves could be viewed as allocating space, but without the + need to probe. */ + if (m->frame.nregs || m->frame.nsseregs || frame_pointer_needed) + dump_stack_clash_frame_info (NO_PROBE_SMALL_FRAME, true); + else + dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false); return; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7b4805218c0..04f0c186635 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-09-21 Rainer Orth + + * lib/target-supports.exp + (check_effective_target_frame_pointer_for_non_leaf): Add + case for x86 Solaris. + 2017-09-21 Paul Thomas PR fortran/78512 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index b7fe5c0d724..887a801bbd8 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -8657,6 +8657,12 @@ proc check_effective_target_frame_pointer_for_non_leaf { } { if { [istarget aarch*-*-*] } { return 1 } + + # Solaris/x86 defaults to -fno-omit-frame-pointer. + if { [istarget i?86-*-solaris*] || [istarget x86_64-*-solaris*] } { + return 1 + } + return 0 }