From owner-freebsd-arm@freebsd.org Wed Oct 7 07:08:03 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 A30CF3FDF54 for ; Wed, 7 Oct 2020 07:08:03 +0000 (UTC) (envelope-from kamalpr@gmail.com) Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C5lm26tmPz4RFC for ; Wed, 7 Oct 2020 07:08:02 +0000 (UTC) (envelope-from kamalpr@gmail.com) Received: by mail-qv1-xf44.google.com with SMTP id cv1so538185qvb.2 for ; Wed, 07 Oct 2020 00:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MDGs1K6Erpnp1w59MCc0rSG38mjf7qBZn7IvVkUGAqY=; b=iHcVICaIr+CiI7ututlgYhfmOBGyu6T1zPmV9xY0ef72oBYeM17M1fV+A8t6u5wSFo sAZ6sX61ViJipGSsOR2hLX92xMSu5Q7luRUtZKfHYXT2qSBfqJLu5ykfVXgpYIuLNk3n WXH+aUjVQQ/JdQXRtCPlQC2uDMhjA0VfcyGBN/QBIPllNlpvoBfZ296Yue2beAJ8Wa2E N2yhBxeG8oRsT9LL6hsIDgPZgXxXGgPiueOLSbv9fnmcGL8ZPu0YCX1cSofpgTW+nf9j UOt9RCFaZNk2GJwj1l9mS3xiJNslczEq1ZLqOsK2c2up+XXdajYGAtBjGDx6vMPUhC61 4rnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=MDGs1K6Erpnp1w59MCc0rSG38mjf7qBZn7IvVkUGAqY=; b=bYLB+uC1Xz8ijPfogRRYqpJr1qa+4TVnwaMuBztSlKbxVsQMRLy2zcbZCxpDaQZ6QI N7qhxmrg/nBBadS9QX81oVNh/62wgHuqf0gNnTjbP6vdtuZhbTwWdDbL7iuEtXzDJrOo O+NmTUF7fz/iiHu5xux0EyWzdebIyao4Dnl/Ehno+WVhnwppatHq/D7kKTyYjB6GjlaJ /YcgSy/lZtpmVDZvsw6u4dFYoXm/xn8dJ+Y88UUBy+VwzGA6rAH5Ho1Lh7OUFKDBCNa/ KtQv8ukFOmiSmhrlMfJSWvTcO3Cfm/vqSZD70+puv858ynOpUmFDgD9/SMBViJWg2L2l WzLQ== X-Gm-Message-State: AOAM533kFeKqOm6lDIR695BQ8ufb4/P0grjWSFvn9/tIdoOcZTjGsXIx rNeKOgAl8N7p+YzsBknCZL/jFUDp/Eauv58= X-Google-Smtp-Source: ABdhPJwqlzTzCbF3ToEPlTYYTg69o9tkj6klopFg1mQR8nFnxGUdiaZCvCyyUz4W7cAa04PuEmrImw== X-Received: by 2002:a05:6214:146e:: with SMTP id c14mr1867997qvy.22.1602054482000; Wed, 07 Oct 2020 00:08:02 -0700 (PDT) Received: from [192.168.1.3] ([122.179.31.199]) by smtp.gmail.com with ESMTPSA id l19sm759169qkk.99.2020.10.07.00.07.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Oct 2020 00:08:01 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: generic q on freebsd From: Kamal Prasad In-Reply-To: Date: Wed, 7 Oct 2020 12:50:59 +0530 Cc: "freebsd-arm@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Warner Losh X-Mailer: Apple Mail (2.3273) X-Rspamd-Queue-Id: 4C5lm26tmPz4RFC X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=iHcVICaI; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of kamalpr@gmail.com designates 2607:f8b0:4864:20::f44 as permitted sender) smtp.mailfrom=kamalpr@gmail.com X-Spamd-Result: default: False [-3.57 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-0.999]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.03)[-1.030]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RECEIVED_SPAMHAUS_PBL(0.00)[122.179.31.199:received]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.04)[-1.037]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f44:from]; RCVD_TLS_ALL(0.00)[]; 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:08:03 -0000 Android has a libc++. I think that can be ported into the kernel. https://developer.android.com/ndk/guides/cpp-support=20 thanks -kamal > 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 >> Good luck >>=20 >> Warner >> _______________________________________________ >> freebsd-arm@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-arm >> To unsubscribe, send any mail to = "freebsd-arm-unsubscribe@freebsd.org" >=20