SGX target and "no operating system" x86/x86_64 targets in general

1 What should the target for SGX be? Should there be a x86_64-intel-sgx target? Should we use some x86_64-pc-none target?

We are internally using x86_64-unknown-none-gnu, see Port libstd to "no operating system" target by jethrogb · Pull Request #37133 · rust-lang/rust · GitHub and latest port at GitHub - jseyfried/rust at no_os. This is quite the misnomer of course, since there is no GNU.

There is of course no standard (yet). I'm sure we can come up with something reasonable here. For example:

  • arch: x86_64 (or i686)
  • os: none (or unknown?)
  • env: sgx (possibly a hint to the compiler meaning SGX in-enclave user leaf instructions should work)
  • vendor: unknown (for raw SGX usage), or intel (when compiling with the Intel SDK), or some other vendor

2 What should the target for an (x86-64) operating system kernel be?

I'd say something like x86_64-none-unknown

3 What is the preferred route to creating a way to target an (x86_64) subset of libstd that where libstd provides a heap but none of the (I/O) services that delegate to an OS?

That would probably be Refactoring std for ultimate portability. I think there is consensus around the design, someone just needs to do the work. Note that Rust's std currently requires a source of randomness to operate (because of std::collections::hash_map::RandomState). This is fine on x86_64 if you have RDRAND, but on other platforms operating std without an OS might just not be possible.

1 Like