https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98861

--- Comment #25 from cqwrteur <unlvsur at live dot com> ---
> > 1. Freestanding C++ in the current situation is very problematic. (You do
> > not have memcpy, you do not have std::move. You do not have std::forward.
> > You do not have std::addressof(). you do not have std::array.) However, you
> > have an exception handling support.
> 
> But no dependency on stdio.

That does not mean it has no dependency. It depends on malloc/free which is
something you cannot avoid at all.

BTW, there are other issues with the implementation EH unwinder, it walks stack
twice for just more debugging information. Guess what is the information
consumed for? They output to stdio lol.

Your termination with multiple fputs calls also has issues even in a hosted
environment. Because it is not process-safe. When multiple processes throw eh
at the same time, they end up corrupting log files. (I did see that when i was
doing testing on the burden of multiple process TCP servers.) I guess changing
that to writev(2) might solve part of the problems but writev(2) does not
guarantee process safety for console or other I/O devices.
> 
> > 2. What's the point of reporting a bug when building libstdc++ with GNU
> 
> So it can be fixed, duh.
> 
> > newlib just works much better and you have an entire hosted toolchain that
> > will not break compilation? The only problem is that you never enable EH.
> > I did report bugs before. However, it was not fixed. I am not going to try
> > it again tbh since newlib works just fine.
> 
> Great. So build with --disable-libstdcxx-verbose as well and stop
> complaining about a feature that other people find useful.
> 
> Maybe we should make that the default for --with-newlib builds. That might
> be a useful improvement. More useful than your usual hyperbole and
> timewasting anyway.

I mean you can try to fix it a little. However, it breaks ABI. The effort does
not worth the cost.

More fundamental issues like binary bloat would never get fixed. Unfortunately,
the C++ compiler does not remove dead virtual functions. The entire C++
exceptions are built on virtual function calls. That stuff all add bloat you do
not want. Recently I just remove one virtual method of EH and the binary size
reduces 50KB for hello world.

If the exceptions are just designed for termination, it is nowhere better than
killing the process and restarted it again. (With __builtin_trap() you even get
higher performance than EH in the happy path because it reduces the burden of
CPU instruction cache)

For servers hosted on the internet, using EH is a disaster since it is
basically DDOS. The attacker can inject invalid input to make the process keep
throwing EH which ends up crashing. (There are security papers talking about
that. I can even show you). EH does not work for cryptography either since
cryptography requires deterministic. Any gap between timing can be a
side-channel.

Reply via email to