From patchwork Wed May 22 22:21:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1103704 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-501483-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qB4zkfSG"; 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 458RvX1rQQz9s1c for ; Thu, 23 May 2019 08:22:16 +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 :subject:to:message-id:date:mime-version:content-type; q=dns; s= default; b=N4Own9H6dErIYc1wysF3gdRBROkr/7Dbk8lmefavFeHT7O5kmkW2j yn2Zvu77clb17o0lTef7LtnZznZsgjuXwNpHOyhFibBXIm+SSJMxirPqGSMNxmS6 3IaHchL6/NXyUB+sjXpCb9IS6YZDnIBnaIMdJuXrHNaZl1kybLOMPI= 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 :subject:to:message-id:date:mime-version:content-type; s= default; bh=Y+mn3dbSlDUGPeGRRG2Z6LpuYvw=; b=qB4zkfSGLC+z2hvKSQWo fQjV13i9tWgS6Tqv1y7pVs1cWKZJI9ARZlCwg1vAR6SlxISmYFQ/zfUj/0d6Aykf 42BtJ+nOMOewEnfykqx4GPO1vjztPbJTFUTDzyFVtd0wChomhANKUlRAgIjFF2Rd vgq/39Rz2T4sdAoBnT0ILwE= Received: (qmail 31370 invoked by alias); 22 May 2019 22:22:08 -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 31359 invoked by uid 89); 22 May 2019 22:22:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=codesourcery, Graphics, graphics X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 May 2019 22:22:06 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1hTZcY-0000Yr-3H from Andrew_Stubbs@mentor.com for gcc-patches@gcc.gnu.org; Wed, 22 May 2019 15:22:02 -0700 Received: from [127.0.0.1] (137.202.0.90) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 22 May 2019 23:21:58 +0100 From: Andrew Stubbs Subject: [committed, amdgcn] Disable trampolines on GCN5 To: "gcc-patches@gcc.gnu.org" Message-ID: <2ea43f87-baae-ad5f-2f78-ef990de50ccd@codesourcery.com> Date: Wed, 22 May 2019 23:21:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Trampolines work just fine on GCN3 devices, but GCN5 devices have execute permission hardware, and the driver sets permission off for the private segment allocation in which the stacks are located. It may be possible to implement indirect calls to nested functions another way, but for now this will prevent unexplained crashes or hangs on unsupported devices. Fix trampoline execution failures on GCN5. 2019-05-22 Andrew Stubbs gcc/ * config/gcn/gcn.c (gcn_trampoline_init): Call "sorry" on GCN5. diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 1dd2ff2d4f0..6820837c763 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -3062,6 +3062,10 @@ gcn_asm_trampoline_template (FILE *f) static void gcn_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value) { + if (TARGET_GCN5_PLUS) + sorry ("nested function trampolines not supported on GCN5 due to" + " non-executable stacks"); + emit_block_move (m_tramp, assemble_trampoline_template (), GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL);