public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Vladimir V <vv.os.swe@gmail.com>
Cc: Keith Packard <keithp@keithp.com>, libstdc++@gcc.gnu.org
Subject: Re: Problem building libstdc++ for the avr target
Date: Fri, 8 Jan 2021 18:21:11 +0000	[thread overview]
Message-ID: <20210108182111.GE9471@redhat.com> (raw)
In-Reply-To: <CA+=iAiodYgB174_myTw5Oa9d91L4dzLstUhDO3n8TmYyk_69gA@mail.gmail.com>

On 04/01/21 12:28 +0100, Vladimir V wrote:
>Hello and Happy New Year!
>
>Getting back to the discussion we had about scalable libstdc++.
>For sure it will be very helpful for embedded targets. There are huge
>components with
>well defined boundaries that are unlikely to be often used in minimalist
>settings but require missing platform support.
>One particular example I'm looking at right now is 'filesystem'. Although
>it resorts to some
>default stubs if corresponding API is not present, I think it would be
>correct to remove it from the library
>completely if it can not/should not be used on the target.
>In case of avr-libc it is worse as the unistd is partially present but not
>sufficient to satisfy all filesystem
>dependencies.
>
>It looks like that after the filesystem support was implemented for c++17
>standard there is no option to remove
>it from the build (unlike for the filesystem-ts). Please correct me if I am
>wrong but If it is like that I would like to make this configurable.

You're right.

My thinking was that the C++ standard requires the <filesystem> header
to be present for a hosted implementation. It doesn't necessarily
require the contents to *do* much, so it's conforming for them to
exist but always report errors.

>Would it be acceptable?

I'm unsure.

Currently we support "hosted" and "freestanding", but not really
anything more fine-grained. The point of the configure switch
--disable-libstdcxx-filesystem-ts was not really to allow people to
build without it, but more to enable it for targets where it wasn't on
by default because it hadn't been tested yet.

I've recently been trying to move away from having missing features,
and make things available unconditionally, but to use useless stubs or
return errors for targets that can't support it. For example, GCC 11
always defines the std::thread type, even if the target can't actually
use it to create new threads. The idea is to always provide a complete
implementation, not have the feature set vary by target (I see a lot
of confusion on places like StackOverflow, where the answer is "yeah
sorry, that header is empty on your OS").

What you're suggesting would lead to a more modular libstdc++ where
you can enable/disable components, similar to what newlib does. If we
did that for more than just the std::filesystem library things would
get complicated (it increases the maintenance and testing burden, and
we need to be careful not to create dependencies on anything from a
conditionally-present feature).

Would your suggestion actually result in smaller/faster binaries for
AVR? Or just remove features that aren't fully functional if you
attempt to use them? If having those features in the library doesn't
actually cause bigger/slower binaries, then I don't really see a
problem with them being present.

Tangentially, the direction the C++ standard seems to be going is to
grow the feature set of freestanding. That would allow more things to
be used in freestanding environments, rather than the very limited set
of features currently guaranteed to be available. That doesn't really
help you though, as you want a hosted env with things like basic I/O,
but not the full set of features usually present for hosted.




  reply	other threads:[~2021-01-08 18:21 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 17:32 Vladimir V
2020-12-07 20:30 ` Jonathan Wakely
2020-12-07 20:32   ` Jonathan Wakely
2020-12-09  0:28     ` Vladimir V
2020-12-09 12:32       ` Vladimir V
2020-12-09 12:49         ` Jonathan Wakely
2020-12-09 17:01           ` Jonathan Wakely
2020-12-09 23:00             ` Vladimir V
2020-12-10 17:39               ` Vladimir V
2020-12-10 20:15                 ` Jonathan Wakely
2020-12-10 20:31                   ` Vladimir V
2020-12-15 11:48                 ` Jonathan Wakely
2020-12-16  7:33                   ` Vladimir V
2020-12-07 20:41   ` Keith Packard
2020-12-07 21:06     ` Jonathan Wakely
2021-01-04 11:28       ` Vladimir V
2021-01-08 18:21         ` Jonathan Wakely [this message]
2021-01-22 14:46           ` Vladimir V
2021-02-07 13:55             ` Vladimir V
2021-02-07 18:22               ` Vladimir V
2021-02-07 18:23               ` Keith Packard
2021-02-07 22:33                 ` Vladimir V
2021-02-07 23:06                   ` Keith Packard
2021-02-08 12:58                     ` Vladimir V
2021-02-08 17:38                 ` Jonathan Wakely
2021-02-08 17:45               ` Jonathan Wakely
2021-02-08 17:47                 ` Jonathan Wakely
2021-02-08 22:25                   ` Vladimir V
2021-02-09 10:47                     ` Jonathan Wakely
2021-02-09 10:54                       ` Vladimir V
2021-03-25  9:27                         ` Vladimir V
2021-03-25 12:36                           ` Jonathan Wakely
2021-03-25 18:27                             ` Jonathan Wakely
2021-03-25 21:37                               ` Vladimir V
2021-03-25 23:02                                 ` Jonathan Wakely
2021-03-26  8:25                                   ` Vladimir V
2020-12-07 21:51     ` Vladimir V
2020-12-07 23:00       ` Keith Packard
2020-12-08  8:12         ` Vladimir V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210108182111.GE9471@redhat.com \
    --to=jwakely@redhat.com \
    --cc=keithp@keithp.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=vv.os.swe@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).