From owner-freebsd-arch@freebsd.org Thu Aug 23 09:43:48 2018 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9A241087E34 for ; Thu, 23 Aug 2018 09:43:47 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 5FC668A90E for ; Thu, 23 Aug 2018 09:43:47 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: by mailman.ysv.freebsd.org (Postfix) id 247C91087E33; Thu, 23 Aug 2018 09:43:47 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 022021087E32 for ; Thu, 23 Aug 2018 09:43:47 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B9298A909; Thu, 23 Aug 2018 09:43:46 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from [78.46.172.3] (helo=sslproxy06.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1fsm9Y-00056z-Dk; Thu, 23 Aug 2018 11:43:44 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy06.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1fsm9Y-000O98-7H; Thu, 23 Aug 2018 11:43:44 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id EEC832A165C; Thu, 23 Aug 2018 11:43:46 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id toTV3S-33h5c; Thu, 23 Aug 2018 11:43:44 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 1D42D2A167F; Thu, 23 Aug 2018 11:43:44 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7M2Qg7nOWnvX; Thu, 23 Aug 2018 11:43:44 +0200 (CEST) Received: from [192.168.96.149] (unknown [192.168.96.149]) by mail.embedded-brains.de (Postfix) with ESMTPSA id E28762A165C; Thu, 23 Aug 2018 11:43:43 +0200 (CEST) Subject: Re: C++ in the kernel? To: Eitan Adler , "freebsd-arch@freebsd.org" , David Chisnall , Justin Hibbits , Maxim Sobolev References: From: Sebastian Huber Message-ID: <501127e3-3ff0-3606-4a24-b3ab0b9c11e6@embedded-brains.de> Date: Thu, 23 Aug 2018 11:43:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.100.1/24865/Thu Aug 23 07:52:53 2018) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Aug 2018 09:43:48 -0000 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= .