From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 24A363858C60 for ; Fri, 4 Nov 2022 16:57:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 24A363858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667581035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bzjBQE/AmBPyHdcG5eR8TLP5/UwDW4HNk5PR1RoloNg=; b=b/iX0TQJoIBY2eYR24DBkbpErl3gCahO64GtQsq5llEk7ok7DvvsQZ/4M8CgFJw3rha2OH +jLAZMnFuUCMOub6+5QJ+5/V/28Hg1Wyi+4yrZIyoW50xtgACO7QGVGH56kSzJvVH/+r1E ksMIzqpRQPinHouKF6tugozxaZROjEw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-W4-Qf8LlPrCA7BVLoIXmhg-1; Fri, 04 Nov 2022 12:57:14 -0400 X-MC-Unique: W4-Qf8LlPrCA7BVLoIXmhg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5DFC11C09044; Fri, 4 Nov 2022 16:57:14 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4A574EA52; Fri, 4 Nov 2022 16:57:13 +0000 (UTC) From: Florian Weimer To: Patrick Palka via Gcc-patches Cc: Patrick Palka , libstdc++@gcc.gnu.org Subject: Re: [PATCH 2/2] libstdc++: Move stream initialization into compiled library [PR44952] References: <20221104150525.2968778-1-ppalka@redhat.com> <20221104150525.2968778-2-ppalka@redhat.com> Date: Fri, 04 Nov 2022 17:57:12 +0100 In-Reply-To: <20221104150525.2968778-2-ppalka@redhat.com> (Patrick Palka via Gcc-patches's message of "Fri, 4 Nov 2022 11:05:25 -0400") Message-ID: <87eduizmhj.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 List-Id: * Patrick Palka via Gcc-patches: > This patch moves the global object for constructing the standard streams > out from and into the compiled library on targets that support > the init_priority attribute. This means that no longer > introduces a separate global constructor in each TU that includes it. > > We can do this only if the init_priority attribute is supported because > we need to force that the stream initialization runs first before any > user-defined global initializer in programs that that use a static > libstdc++.a. I think this breaks initialization of iostreams of shared objects that are preloaded with LD_PRELOAD. With the constructor, they initialize iostreams once they are loaded via their own ELF constructors (even before libstdc++'s ELF constructors run). Without the constructor in , that no longer happens. Thanks, Florian