In order to use the switchless feature of the SGX, the app binary needs
to be linked with the following flags.

```
-Wl,--whole-archive -lsgx_uswitchless -Wl,--no-whole-archive
````

Noted that there is currently no proper way to pass custom link flags to
all the binaries in a cargo project. As such, the `link_args` macro need
to be set for each of Rust files with `main` methods.

References:

* Build flags used in Intel SGX sample code: 
https://github.com/intel/linux-sgx/blob/ce4a18d9a0963b14f717cc7462241cfadd233f55/SampleCode/Switchless/Makefile#L104
* Rust tracking issue on `link_args`: 
https://github.com/rust-lang/rust/issues/29596
* PR for `cargo:rustc-link-arg-bins` in cargo build script: 
https://github.com/rust-lang/cargo/pull/8441
You can view, comment on, or merge this pull request online at:

  https://github.com/apache/incubator-teaclave-sgx-sdk/pull/260

-- Commit Summary --

  * Fix switchless sample code

-- File Changes --

    M samplecode/switchless/app/src/main.rs (3)

-- Patch Links --

https://github.com/apache/incubator-teaclave-sgx-sdk/pull/260.patch
https://github.com/apache/incubator-teaclave-sgx-sdk/pull/260.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/pull/260

Reply via email to