From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id 13EFC3898513; Tue, 15 Nov 2022 16:10:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 13EFC3898513 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1668528656; x=1700064656; h=from:to:cc:in-reply-to:subject:mime-version: content-transfer-encoding:references:message-id:date; bh=8NaTWe23dugCI3UyHfCXptGFYugFd324FbWMkPHjChA=; b=nf8xa/wlpjr3tm9QZ9grRKfhKLQ3cjw6e+/d1HTbeuZqfwT9SXTNdVpB 5U6DxI1zpkgq4XLlko13BCW8gE+hMkXq2Oa0Wa6d/kOCJETQd/BIqq528 EK8KOaqbJmgPv+DLB7mO49UVFCEft57Y93aug+liFMPp2b9Nnk9Kvuw+j UQ4QX8yvqrk3OVvMOACPfhG8UngtsHqCZqZZYJOoIfJTV/xoxGh24Tyud AZivdi8Pfs3oI5WKXqbD1YRWeViQjjGxgPgKyIlxo773WGMy1zfq3Wl7F pGgMbUtf97O/qwC91re9YWouhJj9QDPKaa+/Uh+AM43foJATI/Kmopk70 g==; From: Hans-Peter Nilsson To: Patrick Palka CC: , In-Reply-To: <20221104150525.2968778-2-ppalka@redhat.com> (message from Patrick Palka via Gcc-patches on Fri, 4 Nov 2022 16:05:25 +0100) Subject: Re: [PATCH 2/2] libstdc++: Move stream initialization into compiled library [PR44952] MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT References: <20221104150525.2968778-1-ppalka@redhat.com> <20221104150525.2968778-2-ppalka@redhat.com> Message-ID: <20221115161053.60D072043F@pchp3.se.axis.com> Date: Tue, 15 Nov 2022 17:10:53 +0100 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 List-Id: > From: Patrick Palka via Gcc-patches > Date: Fri, 4 Nov 2022 16:05:25 +0100 > 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. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look right? > Unfortunately I don't have access to a system that truly doesn't support > init priorities, so I instead tested that situation by artificially > disabling the init_priority attribute on x86_64. > > PR libstdc++/44952 > PR libstdc++/98108 > > libstdc++-v3/ChangeLog: > > * include/bits/c++config (_GLIBCXX_HAS_ATTRIBUTE): Define. > (_GLIBCXX_HAVE_ATTRIBUTE_INIT_PRIORITY): Define. > * include/std/iostream (__ioinit): Define only if init_priority > attribute isn't usable. > * src/c++98/ios_init.cc (__ioinit): Define here instead if > the init_priority is usable. > * src/c++98/ios_base_init.h: New file. This (r13-3707-g4e4e3ffd10f53e) broke statically linked programs using iostreams (affected embedded targets + "native" with -static). For me it manifests as adding some 100+ fails to my cris-elf autotester also repeatable using a native Debian 11 x86_64 build running the test-suite with -static like "make check-gcc-c++ 'RUNTESTFLAGS=--target_board=unix/-static old-deja.exp=15071.C'". I opened PR107701 for it. brgds, H-P