From owner-freebsd-arm@freebsd.org Wed Oct 7 07:48:44 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B38033FF3A7 for ; Wed, 7 Oct 2020 07:48:44 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic301-20.consmr.mail.gq1.yahoo.com (sonic301-20.consmr.mail.gq1.yahoo.com [98.137.64.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4C5mfz5BC0z4V3S for ; Wed, 7 Oct 2020 07:48:43 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: swQIhNkVM1mKxEaZhBr8T8MG8IEJHLW8D4JtYZ2tizT1OpHsB1bC3Sb6esT8qSm 5Mys7xdoGeTVmiNmzYDVjwWVyIFXt3j3mVVEJ_JfOsQGUoOPWu710pSgQB.ab_ajZAncYPQHgsY. PP7mRLgRAXGqCipguNyl19xMf9W0UVPZ5rKB5cXZV1ZKlcj__Us4__5UeGw3B2xAMuRB0eboJl4G XATD52Z4yW9kmPxaTGxURD6Z_c6qHGkWpoQrn6_xkKSC6Gwb67AJ_4DY3jgsJUNfNUsVArjx9tL8 gjDn.D.xJo7SZHLQCT.zoKK2wvsyROdyxoPIlPef8PSWvUWqBOg_mGeOoJrJm_MlNc8vRNza3ZsM JVvTRSQ9d..TcUzupbgC130hyYdq04HuarkqLxlQgRX9vg8xSFpQjuJUj7Uww1QJkGNt7qsD3oWZ 1Rhz3AyQFoZtb3Rk9qqfFZuVUw89h5seSqR8XDoPIMGLIoDwlZiDk4.2APGaCWqs_KwpAFzwwhMy 4uKbVM20ttOyxWT2ND6z_mH0FYPXnb93fcESMNlQGqwqpiaomkWR2YQo5vUNvgXn48mZthiXL7eI e_o.S2VlLI_0cO.zPJoLpe.T2Tsoe21ZRm5SC6C.N2p9.45zib_He9ras4noRVDi2Vvzo8i.2uYz deVm9URlju3aF3WIr6juBsIAWdlZi2qRdslB80RJdkbHBTzQwKWRbNmOqne1vCnWx6U_fWRtWH22 rggcFxVi5fAt8zesxZD6bWPVFZ7kyeVAht7LkZT3hZZ5hpA.QqslcIu53tsY0utx96U04hBCyol3 .CsXcy0UjVTfbW3wDGIh6fEHPutWdJFpZDxw92iCehnF2D13_VU3OHrt8xjALDtQW1BDA9ZI.Z4E uy5gK7XvQDR69l7yfZa1Nz4zFSCAATCIN405CuPtx.UYLbN2WewLewSLxD3mbbxKaa5_DXQzyu4p 3D189w5jf_9IfRELJIMjsVxTW5Rurzqc64R8cbDhKv4NjxMQSEETWnUumU7ZzGxe3kUcPR68DdxM szH2mBi3Pw21xgo0i4Ir1xgWlyLVftdb3YDesEItYHYr7qw7f3QiFocBieBRE9v5McPgxV9KmuW7 AqxsQ8ZHGoeE7NXPFZUgi5d3j0JeXjxGVLOWSsSpR1ylnHMEzrxQpTiW4TM9lHK7Qe4psaSUJaF7 EYYun74noYbDB9lBslKe.Lk2YD3ZRcMSU.P8algL8_SqvZRlir7pduj9BEvJwXOarEf5uMKTwrYf 499KX90g5kFYn_esbl4UoUKeOSgGMa7MhWOLr2fi7ZSprl0y073frBHAx7kLjtHIJV0gT0UoHit7 C4Yj_XY.014PF_RoDy1_hjWuezVSpaqbXGdkxhWIK51kVgy0Ayt4echmH97SbSHsymj6E47oCTSE GXNUZoUewuQTUEmBjRdQhkSnkjphVx8a0U2ZUPWI7SmokSVlf2mP0YTBauO6Co.E8itVoW4mhxNy wKg.DEKMIeyerVavmM2OAm6RD4DWPKoGtWmQJTq3QVFKoUPxJDC3afNRL7neDOrACysoBvAat_j6 LFT0kxiKfigS7o79YHuFriuDW11K5q3uz.g-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Wed, 7 Oct 2020 07:48:42 +0000 Received: by smtp410.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 7725db3d258e50cec608a5baeff70f2a; Wed, 07 Oct 2020 07:48:39 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: generic q on freebsd From: Mark Millard In-Reply-To: Date: Wed, 7 Oct 2020 00:48:37 -0700 Cc: Warner Losh , "freebsd-arm@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Kamal Prasad X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4C5mfz5BC0z4V3S X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.63 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-1.09)[-1.094]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.015]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.02)[-1.017]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.146:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.146:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-arm] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Oct 2020 07:48:44 -0000 On 2020-Oct-7, at 00:20, Kamal Prasad wrote: > Android has a libc++. I think that can be ported into the kernel. > https://developer.android.com/ndk/guides/cpp-support=20 So far as I know, Android has libc++ but not in its kernel. FreeBSD has libc++, but not in its kernel. In both contexts, libc++ is from LLVM. In both contexts, userspace programs do not need libc++ to be in the kernel. In both contexts, the C++ involved is a "hosted implementation" instead of being limited to a "Freestanding implemenation". See https://en.cppreference.com/w/cpp/freestanding about freestanding vs. hosted. In part: QUOTE In a freestanding implementation execution may happen without an = operating system END QUOTE > thanks > -kamal >=20 >> On Oct 7, 2020, at 12:40 PM, Kamal Prasad wrote: >>=20 >> Thanks. Why is it difficult to port the C++ runtime to the kernel? I = mean what is the technological hurdle? >>=20 >> thanks >> -kamal >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >> On Oct 6, 2020, at 10:53 PM, Warner Losh wrote: >>>=20 >>> On Tue, Oct 6, 2020, 11:03 AM Kamal R. Prasad = wrote: >>>=20 >>>> hello, >>>>=20 >>>> i am curious if it is possible to compile c++ code inside the = freebsd >>>> kernel. >>>>=20 >>>=20 >>>=20 >>> Possible? Yes, with restrictions. Easy? No. >>>=20 >>> There are a number of restrictions on doing this. There is no C++ = runtime >>> support provided in stock FreeBSD. You have to write your own, or = find >>> someone else that has published theirs. And the code is likely to be >>> compiler dependent. People have done it and talked or blogged about = it. >>>=20 >>> Generally, if you don't use exceptions, templates, RTTI, expressions = that >>> result in the automatic allocation of objects, have large objects (> = 1k) on >>> the stack, etc, it may be possible. I tried it in the 90s and had to = write >>> just a few routines to make simple classes work, but there's a lot = of >>> dragons here and very little C++ code is written these days w/o = reference >>> to the standard libraries, which aren't present in the kernel. >>>=20 >>> Some googling turns up: >>> https://github.com/adamlsd/libcpp.ko from 6 years ago >>> = https://lists.freebsd.org/pipermail/freebsd-arch/2018-June/019069.html = has >>> some details from 2 years ago about command line args you might = need. >>>=20 >>> Many have tried. Few have succeeded. Those that have write all their = code >>> to conform to a subset of the language. Few have had success moving = C++ >>> code for other purposes into the kernel, though if it was written = using the >>> proposed (but never ratified) eC++ (embedded subset), then chances = are >>> greater. >>=20 =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)