Removing the link argument link-dead-code helps avoid linking errors with math functions such as "undefined reference to log10".
Unify OP-TEE Target Names:
"aarch64-unknown-optee" for AARCH64
"arm-unknown-optee" for ARM32
optee-utee-rs:
Macros: upgrade for quote and syn.
Temporarily remove systest as it's not compatible with the new Rust version.
Examples:
hotp-rs:
Workaround for the unexpected address of the slice with zero-length. For stable Rust, it's a normal address, but for nightly, it's 0x1, causing a TA panic when dereferencing.
tls_client-rs & tls_server-rs:
Upgrade to Ring 0.16.20 and Rustls 0.21.0.
Update TA source code to accommodate API changes.
Fix some warnings on new version:
Symbolic link to .cargo/config.toml: Xargo uses .cargo.config, not .cargo/config.toml (required for the new cargo version).
Change build_dependencies to build-dependencies: deprecated in favor of build-dependencies and will not work in the 2024 edition.
Polish building scripts
Discussions:
Xargo or -Zbuild-std When building std from source:
Using Xargo for now, although it hasn't been updated in a long time.
Upstream the OP-TEE Targets:
Benefits:
No need for the target JSON file in the SDK root.
Stay up-to-date without pinning toolchain version.
Download Rust src via rustup add components rust-src.
(Optional) Use cargo -Zbuild-std instead of Xargo.
Other considerations:
Even after upstreaming to a tier-3 target, we cannot install our target via rustup, so build-std is still needed.
For Rustls and Ring (which use optee-utee-rs APIs such as random and time), we still need to port, or open PR to add our target.
TODOs:
ARM32 TAs bug fix:
Rustc bug when linking: Rust compiler generates symbols.o for ARM32 Object files with EABI version 0, causing error source object xxx.rlib has EABI version 5, but target ta-xxx has EABI version 0. This can be fixed by applying a patch to the Rust compiler. A PR to the Rust repository will be made.
tls_client-rs TA ldelf error:
User mode data-abort at address xxx (write permission fault) before loading TA into an address.
This PR is a work in progress. Any comments would be appreciated. Thank you!
Updates:
I'm preparing the Release v.0.3.0 and temporarily drop the ARM32 support for this Release. After the Rustc PR is finished we can enable the ARM32 in the further Release version.
This PR upgrades the Rust toolchain and standard library to
nightly-2024-05-15
, and the libc crate to0.2.153
, both ported for OP-TEE targets.Additionally, it includes various build script adjustments and code modifications necessary for this upgrade.
Changes:
Port libc 0.2.153 and add OP-TEE implementation:
Pin Rust src and add OP-TEE std implementation:
No Need to Port
compiler_builtins
:link-dead-code
helps avoid linking errors with math functions such as "undefined reference to log10".Unify OP-TEE Target Names:
optee-utee-rs:
quote
andsyn
.systest
as it's not compatible with the new Rust version.Examples:
0x1
, causing a TA panic when dereferencing.0.16.20
and Rustls0.21.0
.Fix some warnings on new version:
.cargo/config.toml
: Xargo uses.cargo.config
, not.cargo/config.toml
(required for the new cargo version).build_dependencies
tobuild-dependencies
: deprecated in favor ofbuild-dependencies
and will not work in the 2024 edition.Polish building scripts
Discussions:
Xargo or
-Zbuild-std
When building std from source:cargo -Zbuild-std
is the recommended feature but has a bug that[patch.crates-io]
does not work. This prevents replacing all libc dependencies for Rust std. Reference: https://github.com/rust-lang/wg-cargo-std-aware/issues/78.cargo -Zbuild-std
since libc (with OP-TEE implementation) will be merged into the official source.cargo -Zbuild-std
at https://github.com/DemesneGH/rust-optee-trustzone-sdk/tree/upgrade-std-202405.Upstream the OP-TEE Targets:
rustup add components rust-src
.cargo -Zbuild-std
instead of Xargo.tier-3
target, we cannot install our target viarustup
, sobuild-std
is still needed.Rustls
andRing
(which use optee-utee-rs APIs such as random and time), we still need to port, or open PR to add our target.TODOs:
symbols.o
for ARM32 Object files with EABI version 0, causing errorsource object xxx.rlib has EABI version 5, but target ta-xxx has EABI version 0
. This can be fixed by applying a patch to the Rust compiler. A PR to the Rust repository will be made.User mode data-abort at address xxx (write permission fault)
before loading TA into an address.This PR is a work in progress. Any comments would be appreciated. Thank you!
Updates: