From patchwork Wed Feb 12 11:31:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1236800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519413-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=TcqzcLq5; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=E+eMsLAc; 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 48HcvJ4cSNz9s1x for ; Wed, 12 Feb 2020 22:32:42 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=mGl KslazI6B9xkBldbkYDPeoQYGfqRAMLOyhrMRrUBFxKxPdD4ECanhT8wQNNNTBu1x 2eYANo1THDGvMcZrpmr8wKm3Vq/Bk15EC/t44uENEcFKTtzPYGFT/SoI6lEQkod7 Wf0o8q3V9wFAwRG4GdkQmtgwIs3tFDU0dqiexxGI= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type:content-transfer-encoding; s=default; bh=hLW12uQSu 3C7zfdSrlaX0RlZRGQ=; b=TcqzcLq5Xv8QzuadzDxrMW70SJROn/AeymPQGH5Qr pqZoBRFBSqKCmXwxez1lqKRx7GHUL6wFT6logv7/bHJ5MBcbU7nFqrMmzkyeSE59 E3mdqUCbtkdxmLXaYyZH/OAXenvy2UdThZSaLcBwe9c8zi3S8uYCGftIrxTH/qLD HQ= Received: (qmail 3545 invoked by alias); 12 Feb 2020 11:32:34 -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 3533 invoked by uid 89); 12 Feb 2020 11:32:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2020 11:32:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581507151; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=uAkCKapfrOmQBmRItgDEp0ChZhaMm2fbbVWoXMSnP4A=; b=E+eMsLAcFE1jXLRkc/PfF2NtpEwX7OLU5kFHz/rzzv8NrmmWaeYJtrq1s0ZdFhiyGIIrcs Iw9VyaDza/35PpGwJgh8gahb5UsSa9ZNhQFagt8WveUc4ePbIM/FyyLzfavgs8doYRbXGc ag4oTtGTLrbhq2pq9HArOSw50wbJkyo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-XnA1c9LqOIezONEvuLv1jQ-1; Wed, 12 Feb 2020 06:32:29 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B80A18CA245 for ; Wed, 12 Feb 2020 11:32:28 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE0E45C1B0; Wed, 12 Feb 2020 11:32:27 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 01CBVuFw020966; Wed, 12 Feb 2020 12:32:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 01CBVaQg020964; Wed, 12 Feb 2020 12:31:36 +0100 Date: Wed, 12 Feb 2020 12:31:35 +0100 From: Jakub Jelinek To: Jason Merrill , Jonathan Wakely Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: Emit DFP typeinfos even when DFP is disabled [PR92906] Message-ID: <20200212113135.GY17695@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-IsSubscribed: yes Hi! Before Joseph's changes when compiling libstdc++-v3/libsupc++/fundamental_type_info.cc we were emitting _ZTIPDd, _ZTIPDe, _ZTIPDf, _ZTIPKDd, _ZTIPKDe, _ZTIPKDf, _ZTIDd, _ZTIDe, _ZTIDf symbols even when DFP wasn't usable, but now we don't and thus those 9 symbols @@CXXABI_1.3.4 are gone from libstdc++. While nothing could probably use it (except perhaps dlsym etc.), various tools don't really like symbols disappearing from symbol versioned shared libraries with stable ABI. Adding those in assembly would be possible, but would be a portability nightmare (the PR has something Red Hat uses in libstdc++_nonshared.a, but that can handle only a handful of linux ELF targets we care about). So, instead this patch hacks up the FE, so that it emits those, but in a way that won't make the DFP types available again on targets that don't support them. Bootstrapped/regtested on x86_64-linux and i686-linux (where it doesn't change anything, because DFP is supported), aarch64-linux (where it fixed FAIL: libstdc++-abi/abi_check ) and armv7hl-linux (where abi_check didn't fail because we don't have baseline file, but comparing abilist of unpatched and patched libstdc++.so.6 shows: +_ZTIDd@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 8 +_ZTIDe@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 8 +_ZTIDf@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 8 +_ZTIPDd@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 16 +_ZTIPDe@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 16 +_ZTIPDf@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 16 +_ZTIPKDd@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 16 +_ZTIPKDe@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 16 +_ZTIPKDf@@CXXABI_1.3.4 OBJECT WEAK DEFAULT 16 ). Ok for trunk? 2020-02-12 Jakub Jelinek PR libstdc++/92906 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE, CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE. (fallback_dfloat32_type, fallback_dfloat64_type, fallback_dfloat128_type): Define. * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like dfloat*_type_node. * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp is disabled for compatibility. Jakub --- gcc/cp/cp-tree.h.jj 2020-02-10 15:02:05.031846484 +0100 +++ gcc/cp/cp-tree.h 2020-02-11 23:00:25.561410042 +0100 @@ -206,6 +206,10 @@ enum cp_tree_index CPTI_SOURCE_LOCATION_IMPL, + CPTI_FALLBACK_DFLOAT32_TYPE, + CPTI_FALLBACK_DFLOAT64_TYPE, + CPTI_FALLBACK_DFLOAT128_TYPE, + CPTI_MAX }; @@ -366,6 +370,12 @@ extern GTY(()) tree cp_global_trees[CPTI #define access_default_node null_node +/* Variant of dfloat{32,64,128}_type_node only used for fundamental + rtti purposes if DFP is disabled. */ +#define fallback_dfloat32_type cp_global_trees[CPTI_FALLBACK_DFLOAT32_TYPE] +#define fallback_dfloat64_type cp_global_trees[CPTI_FALLBACK_DFLOAT64_TYPE] +#define fallback_dfloat128_type cp_global_trees[CPTI_FALLBACK_DFLOAT128_TYPE] + #include "name-lookup.h" --- gcc/cp/mangle.c.jj 2020-01-21 09:13:43.339634944 +0100 +++ gcc/cp/mangle.c 2020-02-11 22:59:28.466265009 +0100 @@ -2569,11 +2569,11 @@ write_builtin_type (tree type) write_char ('d'); else if (type == long_double_type_node) write_char ('e'); - else if (type == dfloat32_type_node) + else if (type == dfloat32_type_node || type == fallback_dfloat32_type) write_string ("Df"); - else if (type == dfloat64_type_node) + else if (type == dfloat64_type_node || type == fallback_dfloat64_type) write_string ("Dd"); - else if (type == dfloat128_type_node) + else if (type == dfloat128_type_node || type == fallback_dfloat128_type) write_string ("De"); else gcc_unreachable (); --- gcc/cp/rtti.c.jj 2020-01-21 09:13:43.359634642 +0100 +++ gcc/cp/rtti.c 2020-02-11 22:59:28.467264994 +0100 @@ -1588,6 +1588,20 @@ emit_support_tinfos (void) } for (tree t = registered_builtin_types; t; t = TREE_CHAIN (t)) emit_support_tinfo_1 (TREE_VALUE (t)); + /* For compatibility, emit DFP typeinfos even when DFP isn't enabled, + because we've emitted that in the past. */ + if (!targetm.decimal_float_supported_p ()) + { + gcc_assert (dfloat32_type_node == NULL_TREE + && dfloat64_type_node == NULL_TREE + && dfloat128_type_node == NULL_TREE); + fallback_dfloat32_type = make_node (REAL_TYPE); + fallback_dfloat64_type = make_node (REAL_TYPE); + fallback_dfloat128_type = make_node (REAL_TYPE); + emit_support_tinfo_1 (fallback_dfloat32_type); + emit_support_tinfo_1 (fallback_dfloat64_type); + emit_support_tinfo_1 (fallback_dfloat128_type); + } input_location = saved_loc; }