Page MenuHomeFreeBSD

lang/rust: Add freestanding targets for FreeBSD tier 1 archs
Needs ReviewPublic

Authored by guest-ayrton on Tue, Dec 31, 4:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 31, 6:54 AM
Unknown Object (File)
Tue, Dec 31, 6:52 AM
Unknown Object (File)
Tue, Dec 31, 5:03 AM
Unknown Object (File)
Tue, Dec 31, 4:58 AM
Unknown Object (File)
Tue, Dec 31, 4:56 AM
Subscribers
None

Details

Reviewers
imp
asomers
Group Reviewers
rust
Summary

Adds an option to build freestanding targets suitable for compiling kernel
drivers for the current FreeBSD tier 1 archs (aarch64-unknown-none-softfloat and
x86_64-unknown-none). The new option is on by default to simplify the process of
testing out rust KPI bindings. Note the new option does not affect whether rustc
uses the bundled lld since these targets are just intended for building static
archives and rlibs.

Test Plan

I tested by building and installing rust with the FREESTANDING option on ARM64
and checked that the build instructions for my rust bindings worked as expected.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 61424
Build 58308: arc lint + arc unit

Event Timeline

guest-ayrton created this revision.

One thing I forgot to note in the commit message is that this option is mutually exclusive with the DOCS options[1]. I'm not sure whether to add a .error if both are set or to just disable the freestanding option and print a .warning or .info message.

Also it'd be great to have this an on by default to make it easier on developers wanting to try out rust in the kernel, especially since rustup (the standard rust toolchain installer) currently doesn't support FreeBSD on aarch64 so the only alternative there is building rustc from source. The new targets also only build libcore.rlib, liballoc.rlib and libcompiler_builtins.rlib so they should not use significant disk space.

[1] AFAICT setting docs=true in the config.toml at the root of rustc-src will attempt to run rustdoc on std even for targets that only support core/alloc and set no-std=true (which targets containing -none set by default). I tested a few different ways of adding the new targets, but ultimately I think supporting both options would require reworking the do-configure target to generate two config.tomls.

Does this option cause the port to build both the aarch64 and x86_64 freestanding targets, regardless of the host architecture? Why not build freestanding targets only for the host arch?

Also, do you think the docs problem is a bug upstream?