From owner-freebsd-arm@freebsd.org Wed Oct 7 07:52:00 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 9CB2F3FF275 for ; Wed, 7 Oct 2020 07:52:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf42.google.com (mail-qv1-xf42.google.com [IPv6:2607:f8b0:4864:20::f42]) (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 4C5mkl5hykz4VHB for ; Wed, 7 Oct 2020 07:51:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf42.google.com with SMTP id bl9so594133qvb.10 for ; Wed, 07 Oct 2020 00:51:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uGg7TQpL6/G6vPzkyt6ayGgqneyW8oAPMoIaFwHyeOk=; b=X4/YM01R7Gtiw/N39Rt/wkJegZG8XHE/kwk922n3hOblrRSFkPM20jteAFliObpKN9 R6YSvGbiLanXVVvUhqUzWUocTJZDoGDU/RbOFZaqOUaqCE/KE0mif4NeW3SyogISQO4I OS0CX2C2W5kGbjwAC0/Eh/QupE2QD04DcGLrAOrl3IoFF+4O96jmfYELkj19RgZ7Hwlw cDRMuKln1tKLyMO2iVYTkZ5CenYn0UdV2GuoJl24kY5m2R2uidtrSTxoIammRUNx1NuM PQW+DZEOi9Xp7pM20ORf5RFCTK2ADVNwQV9FHnGiGIl+D/4HBS8Rn0XOKTRrfXOVtool g89g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uGg7TQpL6/G6vPzkyt6ayGgqneyW8oAPMoIaFwHyeOk=; b=R1Zkc92aGmfOyJDmPB6RGcCehBAs+Wm1xg8wSoqZgo/YUIMcD6ZQwwa3F3sxKg5q6m WJLxw4rKAmqUhaLmEgsggYa/s9cofaKdZH6w0g1yh14lzUkQWBbzV0Iw5S2j0M3lcZFI er6TexLw3G8IG5Ust/Db9XPnFZhAyLXv4X/aacNqjwC3shvy+/VvhQN1S03fBWN1KKRU ofRzWAJVwKHlDnU5oZsnlsYowf+isIsrGOxzM++r6P44VFNcDFzbLsaJ5ai8C+IsgvYa uP2n0nx/sVwv9BdQFRWRLE3Vc9O7vUaTACevpX8vsiKmc9oF61IsBdEk0ZOSlUiWztNU gyCQ== X-Gm-Message-State: AOAM530ciSi7VeYCnvdCuXAwzFgXyzCOtdIqAKjWlMfDRnefYKksnzoi kb62Xe4PDqqMkxPkSdVRwGin/zeTisxL6+iJIQmcyw== X-Google-Smtp-Source: ABdhPJzjW36C6sx9Dl3ceJymbajueaOlMlD0DVXrRmmp3AVUnXiPfi9rAfPtoW/hz6AdEO46TerOuGgCxHc4A0LzGxE= X-Received: by 2002:a0c:a482:: with SMTP id x2mr1976426qvx.56.1602057118735; Wed, 07 Oct 2020 00:51:58 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Wed, 7 Oct 2020 01:51:46 -0600 Message-ID: Subject: Re: generic q on freebsd To: Kamal Prasad Cc: freebsd-arm@freebsd.org X-Rspamd-Queue-Id: 4C5mkl5hykz4VHB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=X4/YM01R; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::f42) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.39 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-0.92)[-0.916]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arm@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f42:from]; NEURAL_HAM_SHORT(-0.47)[-0.472]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[freebsd-arm] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 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:52:00 -0000 On Wed, Oct 7, 2020, 12:57 AM Kamal Prasad wrote: > Thanks. Why is it difficult to port the C++ runtime to the kernel? I mean > what is the technological hurdle? > Generally they make use of STL or other standard classes which has no kernel safe implementation at the moment. It's not super hard, irc, just really tedious to implement them in a safe way. Warner thanks > -kamal > > > > > > > On Oct 6, 2020, at 10:53 PM, Warner Losh wrote: > > > > On Tue, Oct 6, 2020, 11:03 AM Kamal R. Prasad wrote: > > > >> hello, > >> > >> i am curious if it is possible to compile c++ code inside the freebsd > >> kernel. > >> > > > > > > Possible? Yes, with restrictions. Easy? No. > > > > 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. > > > > 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. > > > > 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. > > > > 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. > > > > Good luck > > > > 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" > >