Date: Thu, 23 Aug 2018 11:43:39 +0200 From: Sebastian Huber <sebastian.huber@embedded-brains.de> To: Eitan Adler <lists@eitanadler.com>, "freebsd-arch@freebsd.org" <arch@freebsd.org>, David Chisnall <theraven@freebsd.org>, Justin Hibbits <jhibbits@freebsd.org>, Maxim Sobolev <sobomax@freebsd.org> Subject: Re: C++ in the kernel? Message-ID: <501127e3-3ff0-3606-4a24-b3ab0b9c11e6@embedded-brains.de> In-Reply-To: <CAF6rxgnBx66EhEfvw4GTetKbCsa%2B_OEPgYWXHF_6qQPcRrbWKQ@mail.gmail.com> References: <CAF6rxgnBx66EhEfvw4GTetKbCsa%2B_OEPgYWXHF_6qQPcRrbWKQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 29/06/18 09:59, Eitan Adler wrote: > This was the contents of a conversation on a different list. Figured > it was more appropriate here: > >>> We are experimenting with a C++ library for systems programming and a= re interested in trying it in the FreeBSD kernel. Has anyone managed to = run C++ code in the kernel before and perhaps have patches to make the ke= rnel headers somewhat less C++-hostile that they=E2=80=99d be willing to = share? >>> A friend gave a WIP talk at BSDCan a few years ago doing this very th= ing. You can find his work at https://github.com/adamlsd/libcpp.ko >>> I believe few times I've seen this discussion over the years the main= concerns raised were uncertainty about handling of exceptions and also l= ack of the real stable ABI for the C++. Each compiler seems to have its o= wn conventions, which might vary even between compiler revisions. https:/= /youtu.be/JPQWQfDhICA?t=3D51m55s What might be possible, however, is to h= ave particular C++ "runtime" as a module itself, which is then would be u= sed by the other modules that are compiled with that particular C++ compi= ler. >>> Most kernels that use C++ require -fno-rtti -fno-exceptions, so don=E2= =80=99t rely on a runtime. The ABI concerns were a problem 20 years ago,= but *NIX systems have kept the same C++ ABI since everyone[1] adopted th= e Itanium ABI. [1] Well, almost everyone. AArch32 has a slightly differ= ent ABI, but it has also been stable for a similar length of time. >>> Thanks, the include directory of that repo looks to be exactly what I= need to get the subset of libc++ that I need working. FreeBSD started to use the Concurrency Kit in the kernel. Concurrency=20 Kit seems to be intentionally incompatible to C++: https://github.com/concurrencykit/ck/pull/89 --=20 Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine gesch=C3=A4ftliche Mitteilung im Sinne des EHUG= .
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?501127e3-3ff0-3606-4a24-b3ab0b9c11e6>