https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101544
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Andrew Stubbs from comment #3) > C++ offloading works fine provided that there are no library calls or > exceptions. There's no reason std::pair, std::tuple, std::optional and types like that shouldn't work. Just making it possible to compile with -fno-rtti -fno-exceptions would be a start, and would avoid the need for exception handling. Libstdc++ headers already work fine with those options, and it should be possible to build the library itself that way (or it's a bug that can be fixed). > Ignoring unsupported C++ language features, for now, I don't think there's > any reason why libstdc++ would need to be cut down. We already build the > full libgfortran for amdgcn. System calls that make no sense on the GPU were > implemented as stubs in Newlib (mostly returning some reasonable errno > value), and it would be straight-forward to implement more the same way. But it's a waste of space in the .so to build lots of symbols that use the stubs. There are other reasons it might be nice to be able to configure libstdc++ for something in between a full hosted environment and a minimal freestanding one. > I believe static constructors work (libgfortran uses some), but exception > handling does not. I'm not sure what other exotica C++ might need? Ideally, __cxa_atexit and __cxa_thread_atexit for static and thread-local destructors, but we can survive without them (and have not-fully-conforming destruction ordering).