From patchwork Fri Jan 20 21:04:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 63490 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8A5A138582A1 for ; Fri, 20 Jan 2023 21:04:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id D0C213858409; Fri, 20 Jan 2023 21:04:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0C213858409 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.97,233,1669104000"; d="scan'208,223";a="95186128" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 20 Jan 2023 13:04:08 -0800 IronPort-SDR: CV5Zj3gZyHVdoGxYToNQ1iMQtRh0eEtt5VhY4C/zeB0DTgy1jFv4f+eLsMlTkZabhqy3NZ2GXC 2dSaJ7KffJxKAO8MZZX83P7p7M6rgopk5Nxr6zAMxTSKuEdLabwBY5ZIH5V6+CQEWOT1PoW8Jm LqDbJ/7618/xCw3DHuQEqM5BWtBaZwlubfSZSbaO6WFqT8sUIqnDL0NdmAXWNFS0YsVWTisfOe g+ozn/tFYnVquvS3LP109xGcJRs1bpOyAsZ0lzvepzB2mlaiZlRl8ir/uxhuPFJ8t1zegZVOL1 DRg= From: Thomas Schwinge To: CC: , Tom de Vries , Andrew Stubbs Subject: nvptx, libgcc: Stub unwinding implementation In-Reply-To: References: User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Fri, 20 Jan 2023 22:04:02 +0100 Message-ID: <87pmb82a0t.fsf@dem-tschwing-1.ger.mentorg.com> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! We've been (t)asked to enable (portions of) GCC/Fortran I/O for nvptx offloading, which means building a normal (non-'LIBGFOR_MINIMAL') configuration of libgfortran. One prerequisite patch, based on WIP work by Andrew Stubbs, is: "nvptx, libgcc: Stub unwinding implementation", see attached. This I've just pushed to devel/omp/gcc-12 branch in commit 26d3146736218ccaaaafdaba4da1edf969bc190d, and would like to push to master branch once other pending GCC patches have been accepted. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 From 26d3146736218ccaaaafdaba4da1edf969bc190d Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 21 Sep 2022 18:58:34 +0200 Subject: [PATCH] nvptx, libgcc: Stub unwinding implementation Adding stub '_Unwind_Backtrace', '_Unwind_GetIPInfo' functions is necessary for linking libbacktrace, as a normal (non-'LIBGFOR_MINIMAL') configuration of libgfortran wants to do, for example. The file 'libgcc/config/nvptx/unwind-nvptx.c' is copied from 'libgcc/config/gcn/unwind-gcn.c'. libgcc/ChangeLog: * config/nvptx/t-nvptx: Add unwind-nvptx.c. * config/nvptx/unwind-nvptx.c: New file. Co-authored-by: Andrew Stubbs --- libgcc/ChangeLog.omp | 6 +++++ libgcc/config/nvptx/t-nvptx | 3 ++- libgcc/config/nvptx/unwind-nvptx.c | 36 ++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 libgcc/config/nvptx/unwind-nvptx.c diff --git a/libgcc/ChangeLog.omp b/libgcc/ChangeLog.omp index 2e7bf5cc029..c46f49bf5b7 100644 --- a/libgcc/ChangeLog.omp +++ b/libgcc/ChangeLog.omp @@ -1,3 +1,9 @@ +2023-01-20 Thomas Schwinge + Andrew Stubbs + + * config/nvptx/t-nvptx: Add unwind-nvptx.c. + * config/nvptx/unwind-nvptx.c: New file. + 2023-01-20 Thomas Schwinge * config/nvptx/crtstuff.c ["mgomp"] diff --git a/libgcc/config/nvptx/t-nvptx b/libgcc/config/nvptx/t-nvptx index 9a0454c3a4d..1845a38a35e 100644 --- a/libgcc/config/nvptx/t-nvptx +++ b/libgcc/config/nvptx/t-nvptx @@ -1,6 +1,7 @@ LIB2ADD=$(srcdir)/config/nvptx/reduction.c \ $(srcdir)/config/nvptx/mgomp.c \ - $(srcdir)/config/nvptx/atomic.c + $(srcdir)/config/nvptx/atomic.c \ + $(srcdir)/config/nvptx/unwind-nvptx.c LIB2ADDEH= LIB2FUNCS_EXCLUDE= diff --git a/libgcc/config/nvptx/unwind-nvptx.c b/libgcc/config/nvptx/unwind-nvptx.c new file mode 100644 index 00000000000..c657b2af6f3 --- /dev/null +++ b/libgcc/config/nvptx/unwind-nvptx.c @@ -0,0 +1,36 @@ +/* Stub unwinding implementation. + + Copyright (C) 2019-2023 Free Software Foundation, Inc. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + . */ + +#include "unwind.h" + +_Unwind_Reason_Code +_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument) +{ + return 0; +} + +_Unwind_Ptr +_Unwind_GetIPInfo (struct _Unwind_Context *c, int *ip_before_insn) +{ + return 0; +} -- 2.25.1