From patchwork Mon Nov 6 14:57:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1860243 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SPDxR6LLBz1yQ9 for ; Tue, 7 Nov 2023 01:58:18 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B1CD3386187D for ; Mon, 6 Nov 2023 14:58:15 +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 04F263858D33; Mon, 6 Nov 2023 14:57:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04F263858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 04F263858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699282682; cv=none; b=QLkqaC6mieNeDE46pjNGu4kXEgtZ96VHubm6Gn4hgxNkSbOEHzAMTDHSSFDbzPs0SKh/+mHshg4U+MqU42RXuBlcrWMJirV3BxXLCapt7EosXoJa82Zrv8SLKFDnooHgfoGV1BfLFrxp9TQ3i+P80RNLHqZVzokZatGie1iY1tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699282682; c=relaxed/simple; bh=EJjweWr/bcWmMIVMPvPJohXTQLVInGasW17dC4C1yQs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=aNlZYPHbQQQwJA6v5KACPYKIVYj0yeStUJt5bS9vox53USC0eaFcZaSGwaF0EedOY/4pOwSB1OYgQB3KP8sTDoHQKZx2GrFg5k9X4uKAKP3NzELu88rTK3NToWFur0vgiqPvnvtbLXRg/V3yaqMh41IKPrr+YeSijvQ3MaTDQ0o= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: E76/X6hSQ62E+7vv7yk6JA== X-CSE-MsgGUID: PIUGP/XnRIuY5fdHlL4LlA== X-IronPort-AV: E=Sophos;i="6.03,281,1694764800"; d="scan'208,223";a="24684120" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 06 Nov 2023 06:57:58 -0800 IronPort-SDR: NGzwG6t04yYJWAE05n9u23sPZGBZoRD610CzCc8cYuzwjt8hcM23+2T/d/lTGPSJGKSerfu+t5 YtxcXrr6Wbreb4Dgpg5II+CLWiUOpbVTm4COLVUVzdZbuCmVA21bkUYHW+eOYnJOT6R7sdPzlN PmoMsGLQEXxWP6cSZI4iGyYA4ticohdhxse07EYPiFIuiHbbRSjbCIGLjMg3NBQwzHYiJua/wv +k59KRASTR27aW7ZTdyIyhwplh1klmBy6Ghbqo//XPPgjicehMp6uzvs2yoi7FMX+wHddi3CgU QgM= From: Thomas Schwinge To: CC: Jonathan Wakely , , "Tom de Vries" Subject: nvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)' (was: libstdc++ "freestanding" ('--disable-hosted-libstdcxx') with '-fno-rtti', '-fno-exceptions': 'libstdc++-v3/libsupc++/tinfo.cc') In-Reply-To: References: <875yjzfxxg.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Mon, 6 Nov 2023 15:57:52 +0100 Message-ID: <87jzqvudxr.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! On 2022-07-14T19:39:40+0100, Jonathan Wakely wrote: > On Thu, 14 Jul 2022 at 19:14, Thomas Schwinge wrote: >> I'm looking into building GCN, nvptx offloading libstdc++ [...] >> While there is some experimental/incomplete/not-to-be-relied-on support >> for PTX symbol aliases, we're currently generally running into >> "error: alias definitions not supported in this configuration" >> [...]/libstdc++-v3/libsupc++/tinfo.cc:55:1: error: alias definitions not supported in this configuration >> 55 | std::type_info::__equal (const std::type_info& arg) const _GLIBCXX_NOEXCEPT >> | ^~~ >> make[4]: *** [Makefile:777: tinfo.lo] Error 1 >> >> That's 'libstdc++-v3/libsupc++/tinfo.cc': >> >> 1 // Methods for type_info for -*- C++ -*- Run Time Type Identification. >> [...] >> 39 // We can't rely on common symbols being shared between shared objects. >> 40 bool std::type_info:: >> 41 operator== (const std::type_info& arg) const _GLIBCXX_NOEXCEPT >> 42 { >> 43 #if __GXX_MERGED_TYPEINFO_NAMES >> 44 return name () == arg.name (); >> 45 #else >> 46 /* The name() method will strip any leading '*' prefix. Therefore >> 47 take care to look at __name rather than name() when looking for >> 48 the "pointer" prefix. */ >> 49 return (&arg == this) >> 50 || (__name[0] != '*' && (__builtin_strcmp (name (), arg.name ()) == 0)); >> 51 #endif >> 52 } >> 53 >> 54 bool >> 55 std::type_info::__equal (const std::type_info& arg) const _GLIBCXX_NOEXCEPT >> 56 __attribute__((alias("_ZNKSt9type_infoeqERKS_"))); >> 57 #endif >> [...] >> >> ..., so there's a manual alias from the line 55 function to the line 41 >> function (if I got that right). > > That's only there for backwards compatibility on ARM EABI and other > targets that don't define __GXX_TYPEINFO_EQUALITY_INLINE==1. > > My suggestion would be to define that macro for the target. Thanks, that did put me on the right track -- we shall define it this way; indirectly. Pushed to master branch commit 9837f62f066db532c9db6df38ccf2653d0c3a960 "nvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)'", see attached. 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 9837f62f066db532c9db6df38ccf2653d0c3a960 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 14 Jul 2022 23:22:35 +0200 Subject: [PATCH] nvptx: Use the usual '#define MAKE_DECL_ONE_ONLY(DECL) (DECL_WEAK (DECL) = 1)' With this 'MAKE_DECL_ONE_ONLY' definition, we get 'SUPPORTS_ONE_ONLY', and thus '__GXX_WEAK__', and thus '__GXX_TYPEINFO_EQUALITY_INLINE'. This unblocks build of 'libstdc++-v3/libsupc++/tinfo.cc', which otherwise depends on symbol alias support, which GCC/nvptx doesn't generally provide. Also, this gets us a number of FAIL -> PASS progressions in the test suite. Given that GCC/nvptx support for weak symbols isn't complete, we also get a few more of the already-known 'error: PTX does not support weak declarations (only weak definitions)': [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++14 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++17 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.other/crash11.C -std=c++98 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++14 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++17 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.old-deja/g++.pt/crash29.C -std=c++98 (test for excess errors) [-PASS:-]{+FAIL:+} 23_containers/map/56613.cc -std=gnu++17 (test for excess errors) ... as well as one more of the already-known 'sorry, unimplemented: target cannot support nonlocal goto': PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++14 (test for excess errors) PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++17 (test for excess errors) PASS: g++.dg/tree-ssa/pr22488.C -std=gnu++20 (test for excess errors) [-PASS:-]{+FAIL:+} g++.dg/tree-ssa/pr22488.C -std=gnu++98 (test for excess errors) We shall look into these, later. gcc/ * config/nvptx/nvptx.h (MAKE_DECL_ONE_ONLY): Define. --- gcc/config/nvptx/nvptx.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h index 129427e5654..407fd70f06a 100644 --- a/gcc/config/nvptx/nvptx.h +++ b/gcc/config/nvptx/nvptx.h @@ -319,6 +319,9 @@ struct GTY(()) machine_function #define SUPPORTS_WEAK 1 +#define MAKE_DECL_ONE_ONLY(DECL) \ + (DECL_WEAK (DECL) = 1) + /* The documentation states that ASM_OUTPUT_DEF_FROM_DECLS is used in preference to ASM_OUTPUT_DEF if the tree nodes are available. However, we need the tree nodes to emit the prototype, so at this point it's not clear -- 2.34.1