Skip to content

Commit 0303a31

Browse files
author
Jethro Beekman
committed
Document x86_64-fortanix-unknown-sgx platform
1 parent 8abe7cb commit 0303a31

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

src/doc/rustc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- [*-unknown-openbsd](platform-support/openbsd.md)
3333
- [\*-unknown-uefi](platform-support/unknown-uefi.md)
3434
- [wasm64-unknown-unknown](platform-support/wasm64-unknown-unknown.md)
35+
- [x86_64-fortanix-unknown-sgx](platform-support/x86_64-fortanix-unknown-sgx.md)
3536
- [x86_64-unknown-none](platform-support/x86_64-unknown-none.md)
3637
- [Targets](targets/index.md)
3738
- [Built-in Targets](targets/built-in.md)

src/doc/rustc/src/platform-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ target | std | notes
174174
`wasm32-unknown-unknown` | ✓ | WebAssembly
175175
`wasm32-wasi` | ✓ | WebAssembly with WASI
176176
`x86_64-apple-ios` | ✓ | 64-bit x86 iOS
177-
`x86_64-fortanix-unknown-sgx` | ✓ | [Fortanix ABI] for 64-bit Intel SGX
177+
[`x86_64-fortanix-unknown-sgx`](platform-support/x86_64-fortanix-unknown-sgx.md) | ✓ | [Fortanix ABI] for 64-bit Intel SGX
178178
`x86_64-fuchsia` | ✓ | 64-bit Fuchsia
179179
`x86_64-linux-android` | ✓ | 64-bit x86 Android
180180
`x86_64-pc-solaris` | ✓ | 64-bit Solaris 10/11, illumos
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# `x86_64-fortanix-unknown-sgx`
2+
3+
**Tier: 2**
4+
5+
Secure enclaves using [Intel Software Guard Extensions
6+
(SGX)](https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/overview.html)
7+
based on the ABI defined by Fortanix for the [Enclave Development Platform
8+
(EDP)](https://edp.fortanix.com/).
9+
10+
## Target maintainers
11+
12+
The [EDP team](mailto:[email protected]) at Fortanix.
13+
14+
- Jethro Beekman [@jethrogb](https://github.com/jethrogb)
15+
- Raoul Strackx [@raoulstrackx](https://github.com/raoulstrackx)
16+
- Mohsen Zohrevandi [@mzohreva](https://github.com/mzohreva)
17+
18+
## Requirements
19+
20+
The target supports `std` with a default allocator. Only cross compilation is
21+
supported.
22+
23+
Binaries support all CPUs that include Intel SGX. Only 64-bit mode is supported.
24+
25+
Not all `std` features are supported, see [Using Rust's
26+
std](https://edp.fortanix.com/docs/concepts/rust-std/) for details.
27+
28+
The `extern "C"` calling convention is the System V AMD64 ABI.
29+
30+
The supported ABI is the
31+
[fortanix-sgx-abi](https://edp.fortanix.com/docs/api/fortanix_sgx_abi/index.html).
32+
33+
The compiler output is ELF, but the native format for the platform is the SGX
34+
stream (SGXS) format. A converter like
35+
[ftxsgx-elf2sgxs](https://crates.io/crates/fortanix-sgx-tools) is needed.
36+
37+
Programs in SGXS format adhering to the Fortanix SGX ABI can be run with any
38+
compatible runner, such as
39+
[ftxsgx-runner](https://crates.io/crates/fortanix-sgx-tools).
40+
41+
See the [EDP installation
42+
guide](https://edp.fortanix.com/docs/installation/guide/) for recommendations
43+
on how to setup a development and runtime environment.
44+
45+
## Building the target
46+
47+
As a tier 2 target, the target is built by the Rust project.
48+
49+
You can configure rustbuild like so:
50+
51+
```toml
52+
[build]
53+
build-stage = 1
54+
target = ["x86_64-fortanix-unknown-sgx"]
55+
```
56+
57+
## Building Rust programs
58+
59+
Standard build flows using `cargo` or `rustc` should work.
60+
61+
## Testing
62+
63+
The Rust test suite as well as custom unit and integration tests will run on
64+
hardware that has Intel SGX enabled if a cargo runner is configured correctly,
65+
see the requirements section.
66+
67+
## Cross-compilation toolchains and C code
68+
69+
C code is not generally supported, as there is no libc. C code compiled for
70+
x86-64 in freestanding mode using the System V AMD64 ABI may work. The
71+
[rs-libc](https://crates.io/crates/rs-libc) crate contains a subset of libc
72+
that's known to work with this target.

0 commit comments

Comments
 (0)