|
| 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