apache / incubator-teaclave-trustzone-sdk

Teaclave TrustZone SDK enables safe, functional, and ergonomic development of trustlets.
https://teaclave.apache.org
Apache License 2.0
204 stars 58 forks source link

rust tee toolchain #60

Closed neil1899 closed 2 years ago

neil1899 commented 2 years ago

你好,想问一下关于target是optee得时候,工具链得情况

发现此项目得.cargo/config 只用到了链接工具,难道rs文件是不需要编译得吗?还是可以理解为rs文件还是用的rustc做编译,最后使用ld生成目标平台得可执行文件?

如果用ld,那么工程下依赖得库是如何链接进去得呢?

多谢回答

DemesneGH commented 2 years ago

你好 @neil1899 Rust TA均使用xargo编译,例如: https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/220fc84662a41e9340f0751577484732c74e4b10/examples/acipher-rs/ta/Makefile#L43

.cargo/config中,默认的linker被修改为toolchains中的ld: https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/220fc84662a41e9340f0751577484732c74e4b10/.cargo/config#L19

Rust TA使用的crate均为静态链接。

neil1899 commented 2 years ago

如果换成aarch64-linux-gnu-gcc可以吗?为什么要使用ld呢

neil1899 commented 2 years ago

@DemesneGH 你好,再问一下,关于libutils,是在rust/libc里面得mod.rs通过#[link]指定得对吧。也算是静态链接吗

DemesneGH commented 2 years ago

@neil1899

换成aarch64-linux-gnu-gcc可以吗

可以,但link-arg需要改一下。

关于libutils,是在rust/libc里面得mod.rs通过#[link]指定得对吧。也算是静态链接吗

是的。

mssun commented 2 years ago

此 issue 已经解决,closed.

如有其他问题,可以提交新的 issue,多谢。