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 3C5553858417 for ; Mon, 6 Feb 2023 14:25:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C5553858417 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=1675693508; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xKu6FBiPlpO3zcgVCNrp+CfW3hNon4miG1DrzpHz9NU=; b=gBAnCH1F5P0os0h9jMmRLP9Wu4kgajuAefir/CVtlJgFT6iPtJNVB91INznRO4rdLzYzN0 Mb46GujPsJlL90r6ocuFhjclmiYbKkK/eqG4HsPlkZR3VoBW1Pd8+r18qVM4eEWgR8PI4w aw7RJHMvn5hQgvdpmMNHSFMxhyUXUEc= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-96-3Fii6fbwMxea1agEH5KWlA-1; Mon, 06 Feb 2023 09:25:05 -0500 X-MC-Unique: 3Fii6fbwMxea1agEH5KWlA-1 Received: by mail-lf1-f71.google.com with SMTP id f17-20020ac25091000000b004b565e69540so4875010lfm.12 for ; Mon, 06 Feb 2023 06:25:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xKu6FBiPlpO3zcgVCNrp+CfW3hNon4miG1DrzpHz9NU=; b=bcwt7llFczI/EJG6tCm2Tpp0tHU4Gjc7obJvroOtkP3X8UehQjCXvWKo69QfHh303H Piac1ECBEIUZgZ0swLhkXkQ5Cu+78IG3ndy0MI9MyiU4tHfdjrtWOahFNg8UJgaEI4rw +VppVbnudzNj5gQ+HwBHAB65YgC1H+aKpnIKj0EJJMxWJDAls+mRDKrARYwwuRHbrzzc fv1c/x4kPho0r/lyLOYvIxLdNtluwagY5DqSIKvQByuzuIZObGmdP7wA+XxR16e65w4m t96qhdbgJ0z+iObugh+a4ESQ4O6GmtbWnKE8AGB4RybztzrzrWLrOq2Hf4o+uZsgZfMP t7Dw== X-Gm-Message-State: AO0yUKVQK1B5JI0x/rUSLyIwqCgV0tkZwAykgVBcUDr73xDuZBbt7fZb X5a6D9XlnOwOXhPzNPZklfzetDZIhX14ijDprtTFZoth8pcSFCv7oBBMzJdDOKh7Ls58ApE/THp PW3LlLJ/TXpN1RHKQMoXaViCYQ0v5uVQ= X-Received: by 2002:a2e:720c:0:b0:290:54d6:8a58 with SMTP id n12-20020a2e720c000000b0029054d68a58mr2487222ljc.49.1675693504434; Mon, 06 Feb 2023 06:25:04 -0800 (PST) X-Google-Smtp-Source: AK7set+IBy3iEjflO+Wmqa7wQ/J2zZeThDNP4mGFeCce4Ri/V2XYY4V4LdTcyhlgz6xDM6O+Vfqu7T8fUAc9P7c/JaU= X-Received: by 2002:a2e:720c:0:b0:290:54d6:8a58 with SMTP id n12-20020a2e720c000000b0029054d68a58mr2487216ljc.49.1675693504068; Mon, 06 Feb 2023 06:25:04 -0800 (PST) MIME-Version: 1.0 References: <20221020154948.2511787-1-arsen@aarsen.me> In-Reply-To: <20221020154948.2511787-1-arsen@aarsen.me> From: Jonathan Wakely Date: Mon, 6 Feb 2023 14:24:52 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Enable building libstdc++.{a,so} when !HOSTED To: =?UTF-8?Q?Arsen_Arsenovi=C4=87?= Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is pushed to trunk now. On Thu, 20 Oct 2022 at 16:53, Arsen Arsenovi=C4=87 via Libstdc++ wrote: > > This enables us to provide symbols for placeholders and numeric limits, > and allows users to mess about with linker flags less. > > libstdc++-v3/ChangeLog: > > * Makefile.am [!_GLIBCXX_HOSTED]: Enable src/ subdirectory. > * Makefile.in: Regenerate. > * src/Makefile.am [!_GLIBCXX_HOSTED]: Omit compatibility files. > There's no history to be compatible with. > * src/c++11/Makefile.am [!_GLIBCXX_HOSTED]: Omit hosted-only > source files from the build. > * src/c++17/Makefile.am [!_GLIBCXX_HOSTED]: Likewise. > * src/c++20/Makefile.am [!_GLIBCXX_HOSTED]: Likewise. > * src/c++98/Makefile.am [!_GLIBCXX_HOSTED]: Likewise. > * src/Makefile.in: Regenerate. > * src/c++11/Makefile.in: Regenerate. > * src/c++17/Makefile.in: Regenerate. > * src/c++20/Makefile.in: Regenerate. > * src/c++98/Makefile.in: Regenerate. > --- > Afternoon, > > With these changes, when we aren't hosted, we get a libstdc++ library tha= t > contains only library facilities available in freestanding (i.e. placehol= ders > and limits.cc). This is, AFAICT, the only code in libstdc++.{a,so} that = can > (and should) be available in freestanding. > > As an implementation note, this could be a little bit faster (at > build/configure time), though not necessarily nicer, by having > src/Makefile.am not try to build convenience libraries for versions of > C++ that provide nothing. I opted not to do this since it'd make > src/Makefile.am even more complex, and make future changes harder to impl= ement. > libstdc++ also isn't that slow to build, anyway. > > Tested on i686-elf. > > Have a good day! > > libstdc++-v3/Makefile.am | 4 ++-- > libstdc++-v3/Makefile.in | 4 ++-- > libstdc++-v3/src/Makefile.am | 6 +++++ > libstdc++-v3/src/Makefile.in | 8 +++++-- > libstdc++-v3/src/c++11/Makefile.am | 16 ++++++++++--- > libstdc++-v3/src/c++11/Makefile.in | 37 +++++++++++++++++++----------- > libstdc++-v3/src/c++17/Makefile.am | 4 ++++ > libstdc++-v3/src/c++17/Makefile.in | 6 +++-- > libstdc++-v3/src/c++20/Makefile.am | 4 ++++ > libstdc++-v3/src/c++20/Makefile.in | 6 +++-- > libstdc++-v3/src/c++98/Makefile.am | 4 ++++ > libstdc++-v3/src/c++98/Makefile.in | 6 +++-- > 12 files changed, 77 insertions(+), 28 deletions(-) > > diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am > index 0d147ad3ffe..d7f2b6e76a5 100644 > --- a/libstdc++-v3/Makefile.am > +++ b/libstdc++-v3/Makefile.am > @@ -24,11 +24,11 @@ include $(top_srcdir)/fragment.am > > if GLIBCXX_HOSTED > ## Note that python must come after src. > - hosted_source =3D src doc po testsuite python > + hosted_source =3D doc po testsuite python > endif > > ## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE. > -SUBDIRS =3D include libsupc++ $(hosted_source) > +SUBDIRS =3D include libsupc++ src $(hosted_source) > > ACLOCAL_AMFLAGS =3D -I . -I .. -I ../config > > diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am > index b83c222d51d..4eb78e76297 100644 > --- a/libstdc++-v3/src/Makefile.am > +++ b/libstdc++-v3/src/Makefile.am > @@ -121,7 +121,13 @@ cxx11_sources =3D \ > ${cxx0x_compat_sources} \ > ${ldbl_alt128_compat_sources} > > +if GLIBCXX_HOSTED > libstdc___la_SOURCES =3D $(cxx98_sources) $(cxx11_sources) > +else > +# When freestanding, there's currently no compatibility to preserve. Sh= ould > +# that change, any compatibility sources can be added here. > +libstdc___la_SOURCES =3D > +endif > > libstdc___la_LIBADD =3D \ > $(GLIBCXX_LIBS) \ > diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/= Makefile.am > index ecd46aafc01..72f05100c98 100644 > --- a/libstdc++-v3/src/c++11/Makefile.am > +++ b/libstdc++-v3/src/c++11/Makefile.am > @@ -51,6 +51,10 @@ else > cxx11_abi_sources =3D > endif > > +sources_freestanding =3D \ > + limits.cc \ > + placeholders.cc > + > sources =3D \ > chrono.cc \ > codecvt.cc \ > @@ -66,9 +70,7 @@ sources =3D \ > hashtable_c++0x.cc \ > ios.cc \ > ios_errcat.cc \ > - limits.cc \ > mutex.cc \ > - placeholders.cc \ > random.cc \ > regex.cc \ > shared_ptr.cc \ > @@ -118,7 +120,15 @@ endif > > vpath % $(top_srcdir)/src/c++11 > > -libc__11convenience_la_SOURCES =3D $(sources) $(inst_sources) > +if !GLIBCXX_HOSTED > +libc__11convenience_la_SOURCES =3D $(sources_freestanding) > +else > +libc__11convenience_la_SOURCES =3D \ > + $(sources_freestanding) \ > + $(sources) \ > + $(inst_sources) > +endif > + > > # Use special rules for the hashtable.cc file so that all > # the generated template functions are also instantiated. > diff --git a/libstdc++-v3/src/c++17/Makefile.am b/libstdc++-v3/src/c++17/= Makefile.am > index 3d53f652fac..72095f5b087 100644 > --- a/libstdc++-v3/src/c++17/Makefile.am > +++ b/libstdc++-v3/src/c++17/Makefile.am > @@ -60,7 +60,11 @@ sources =3D \ > > vpath % $(top_srcdir)/src/c++17 > > +if GLIBCXX_HOSTED > libc__17convenience_la_SOURCES =3D $(sources) $(inst_sources) > +else > +libc__17convenience_la_SOURCES =3D > +endif > > if GLIBCXX_LDBL_ALT128_COMPAT > floating_from_chars.lo: floating_from_chars.cc > diff --git a/libstdc++-v3/src/c++20/Makefile.am b/libstdc++-v3/src/c++20/= Makefile.am > index d4c1e26e40e..5c937f7e804 100644 > --- a/libstdc++-v3/src/c++20/Makefile.am > +++ b/libstdc++-v3/src/c++20/Makefile.am > @@ -40,7 +40,11 @@ sources =3D > > vpath % $(top_srcdir)/src/c++20 > > +if GLIBCXX_HOSTED > libc__20convenience_la_SOURCES =3D $(sources) $(inst_sources) > +else > +libc__20convenience_la_SOURCES =3D > +endif > > # AM_CXXFLAGS needs to be in each subdirectory so that it can be > # modified in a per-library or per-sub-library way. Need to manually > diff --git a/libstdc++-v3/src/c++98/Makefile.am b/libstdc++-v3/src/c++98/= Makefile.am > index b96588bd95c..f7134d80027 100644 > --- a/libstdc++-v3/src/c++98/Makefile.am > +++ b/libstdc++-v3/src/c++98/Makefile.am > @@ -148,7 +148,11 @@ sources =3D \ > > vpath % $(top_srcdir)/src/c++98 > > +if GLIBCXX_HOSTED > libc__98convenience_la_SOURCES =3D $(sources) > +else > +libc__98convenience_la_SOURCES =3D > +endif > > # Use special rules to compile with -fimplicit-templates. > c++locale.lo: c++locale.cc > # Use special rules for the deprecated source files so that they find > -- > 2.38.1 >