From nobody Thu Sep 05 00:19:54 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Wzg3r3Fynz5W41y for ; Thu, 05 Sep 2024 00:20:08 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (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 "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wzg3r16tjz4J6Y for ; Thu, 5 Sep 2024 00:20:08 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-498cd1112c3so38516137.0 for ; Wed, 04 Sep 2024 17:20:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725495607; x=1726100407; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r0dUOtaoVdUp7a4gmvXL7z7bVf5DA8pa5R4zXalNPvE=; b=LyC/bj2nMScItifigkJg9SGrYu3DVaIM55mpb6wMsyhQHPtLaiiWRrkpHSrJwb5u2U BtzZQuCUTb9ClrfQZsV2cT3LO9J7d2m15V/xTv2s7JZ6gGoepMvbzwIrjH/FnP9lwuAb YgNmmi/q5vLo5HZXfARzYmpU7Xm6yyn/26qhClHFKVdgnJFbYBgxxCkWG4F0SCwjFlFl +2kIsNcC/JicpwiLel6MPk+TqHny8UFrdRL4lgrGBsu7BLfdR+FpBf+DGPLWwfVG/6Ns Bes1mm8zfKrdI38pTjGX3J3UBSHBBe51iXdY6QyW74ohaWzIsCFKsNRMH+Bu2teDL8vb GNdQ== X-Forwarded-Encrypted: i=1; AJvYcCU8yFQ63i+GU6nqh/JEkJkvhXejUOJOpI2MasrxD+1pHFKhE5hgz426ov0bbfISgwrb64N49zGBjJuOOgznnbA=@freebsd.org X-Gm-Message-State: AOJu0YyDftjMBm4ec8snZTtjXoKRGuWiTuv9C+vDkfjLWsi6rSo84Yj4 wyfetpuzDknXZb20gfYvoIQpjDr+CRgkNcljKq0xthhlo5YqqE7Bc/Egr2o9UNLkuvNDUdoxLt6 3iBULu36jUW54mQOAHgw5kaXSUnKF5ci2 X-Google-Smtp-Source: AGHT+IEqCaijqyWYxBeI4Rais79ex/9D2k71KX8qWSRFDRrAv9PHJ/BQhH/hUczKATjO2m8yokVUhZlVQATwLO1XDBI= X-Received: by 2002:a67:fa91:0:b0:49b:a93d:3d0 with SMTP id ada2fe7eead31-49ba93d0904mr8133145137.1.1725495606909; Wed, 04 Sep 2024 17:20:06 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: <0.2.0-final-1725440949.866-0xb4bb20@qmda.emu.st> <78BC157F-6E30-49C4-931D-9EB539BD0322@digitaldaemon.com> <20240904221522.63E0366@slippy.cwsent.com> In-Reply-To: From: Alan Somers Date: Wed, 4 Sep 2024 18:19:54 -0600 Message-ID: Subject: Re: Rust: kernel vs user-space To: Konstantin Belousov Cc: Jacques Fourie , Cy Schubert , Jan Knepper , Mark Delany , freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Queue-Id: 4Wzg3r16tjz4J6Y On Wed, Sep 4, 2024 at 6:12=E2=80=AFPM Konstantin Belousov wrote: > > On Wed, Sep 04, 2024 at 04:43:31PM -0700, Jacques Fourie wrote: > > On Wed, Sep 4, 2024 at 3:41=E2=80=AFPM Konstantin Belousov > > wrote: > > > > > On Wed, Sep 04, 2024 at 03:15:22PM -0700, Cy Schubert wrote: > > > > In message <78BC157F-6E30-49C4-931D-9EB539BD0322@digitaldaemon.com>= , > > > Jan > > > > Kneppe > > > > r writes: > > > > > D > > > > > > > > > > www.dlang.org > > > > > > > > The problem with D is data structure definitions need to also be > > > mirrored > > > > (duplicated) in D. For example, when 64-bit inodes were implemented= D > > > > failed to build and generate any code. The reason for this was > > > > ufs/ufs/inode.h now defined 64-bit inodes while the D representatio= n as > > > > provided by the D language were still 32-bit. I had opened an issue= with > > > > upstream regarding this. To this day they still haven't figured out= how > > > to > > > > implement 64-bit inodes on newer FreeBSD systems while maintaining > > > 32-bit > > > > inode backward compatibility on older FreeBSD systems (as FreeBSD > > > > implemented this using ifunc). > > > > > > Rust is same. It still uses pre-ino64 bindings for both stdlib and l= ibc. > > > > > > > Looking at the Rust libc bindings I see the following: > > https://github.com/rust-lang/libc/blob/72c40004a3568849055c0bab5c92c997= 5b4eb132/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs#L8 > > https://github.com/rust-lang/libc/blob/72c40004a3568849055c0bab5c92c997= 5b4eb132/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs#L5 > > > > Seems to have changed to 64 bit for FreeBSD 12 and up? > > Rust libc seems to make some strange things to follow FreeBSD ABI > evolution, which is not done e.g. for glibc. But anyway, the relevant pl= ace > to look seems to be a comment and decision code at > https://github.com/rust-lang/libc/blob/72c40004a3568849055c0bab5c92c9975b= 4eb132/build.rs#L44 > > By default they seems to use FreeBSD 11 ABI from freebsd11 module still. > I do not know what is CARGO_FEATURE_RUSTC_DEP_OF_STD. The short answer is that Rust binaries still assume a FreeBSD 11 ABI. The slightly longer answer is that while definitions are in place for FreeBSD 12, 13, and 14, there's actually no way to enable them outside of libc's CI system. CARGO_FEATURE_RUSTC_DEP_OF_STD is a variable set while building the standard library. It allows the standard library to use a different FreeBSD ABI version than libc. And here is the PR that will finally raise the ABI to FreeBSD 12. It's not getting much attention, unfortunately, because none of either libc nor rustc's maintainers are FreeBSD developers, and they're afraid to make changes like this. https://github.com/rust-lang/libc/pull/2406