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: 162043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2713085vqu; Mon, 6 Nov 2023 06:58:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEKu30jbWig+hvP/uvhqW8xJIIyRq4YrCKYPzCmomtuxN4ydxEFSvKUWeDrtPpldCwPlZw6 X-Received: by 2002:a05:6214:2265:b0:675:a120:7a2a with SMTP id gs5-20020a056214226500b00675a1207a2amr1448818qvb.64.1699282712496; Mon, 06 Nov 2023 06:58:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699282712; cv=pass; d=google.com; s=arc-20160816; b=Kux1nPa9C7R1Xx1VAKOg37lHn7qUEBEwFkD8T7uci3RloBdjBs5u20Hrz6V20pMnhV xuvwqAis1qBS11qztrH1oREaNM9W293lRe6xagDWFuyBYY+YIXxm1nRlGmuL7hcY69IN Q+j+gN8H60X0Sactopi1tF/5h1zr1QIFXiw07k9E0Sg1nICd7EkBjh3PW6zHTyBDczYb 8MsP1q+N79y6/SQzLy16/uBROzcvjcdFI48u2TW2CXBRUC/b+hm5+FYn8CwNKiOzW5Qg SkAjpBRnS6nKIyLZl9qICUE0LiDnRU4EuZNCtVCshu2Dt1ZoZ/jXfBa7TieLA0pdYt9M 9YdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=zRP8+PfxZvAnLzLIayBBkFpjdxVT0b5RYWbWry2LynA=; fh=5akeXSH4/28rUBv9R5KxopXIiGCUV9lO9XjPNBa9OuQ=; b=PxQ3ss0cwx9p1cuAIQhSzeR81QgRvVSqdEUpEcmsQspkudltr6tPG1llYaNT/YZXsD OWbqHIvpbZzYP7/aaPxgb8r9+t0EPh+LgEK1etcez2aP2Y4kugyLBAiLinWHDogGr0+W pwh53B+CQwGAVv0Ov2nt0EsCenjaNQWtgSABbsai85sVXfcRr7YV1gNu0ZctZcANwpbn GKZYweqRId/25WRIGcZbD3b/tfnlsY8jqsHERBJ19EAXxZPZX+7RFvoaC945x3mR00TU PnsXtEgaRrwsQeLit4rlvohrAznPPNe28YS6p6kLoDXZoMSB6xY8//xkarLytLeG4U4V nS0A== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id dj5-20020a056214090500b006564001ff0esi5557884qvb.413.2023.11.06.06.58.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 06:58:32 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B90C23858D3C for ; Mon, 6 Nov 2023 14:58:28 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781827069596288964 X-GMAIL-MSGID: 1781827069596288964 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