Skip to content

Commit

Permalink
examples: polish linking script
Browse files Browse the repository at this point in the history
- remove wildcard imports: "use core::ffi::*;"
- since "c_size_t" is an unstable feature for current Rustc
  (2024-05-14), replace them with "usize", which is equivalent
  on ARM32 and ARM64.
  • Loading branch information
DemesneGH committed Oct 17, 2024
1 parent a84e96d commit 4a9b369
Show file tree
Hide file tree
Showing 40 changed files with 60 additions and 80 deletions.
1 change: 0 additions & 1 deletion examples/acipher-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/acipher-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/aes-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/aes-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/authentication-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/authentication-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/big_int-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

use optee_utee::BigInt;
use optee_utee::{
Expand Down
6 changes: 3 additions & 3 deletions examples/big_int-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/diffie_hellman-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/diffie_hellman-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/digest-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/digest-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/error_handling-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/error_handling-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/hello_world-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

use optee_utee::{
ta_close_session, ta_create, ta_destroy, ta_invoke_command, ta_open_session, trace_println,
Expand Down
6 changes: 3 additions & 3 deletions examples/hello_world-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/hotp-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/hotp-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/message_passing_interface-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// under the License.

#![no_main]
#![feature(c_size_t)]

use optee_utee::{
ta_close_session, ta_create, ta_destroy, ta_invoke_command, ta_open_session, trace_println,
Expand Down
6 changes: 3 additions & 3 deletions examples/message_passing_interface-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/random-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/random-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
1 change: 0 additions & 1 deletion examples/secure_storage-rs/ta/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#![no_std]
#![no_main]
#![feature(c_size_t)]

extern crate alloc;

Expand Down
6 changes: 3 additions & 3 deletions examples/secure_storage-rs/ta/ta_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use core::ffi::*;
use core::ffi::{c_int, c_void};
use core::mem;
use core::primitive::u64;

Expand All @@ -39,13 +39,13 @@ pub static ta_head: optee_utee_sys::ta_head = optee_utee_sys::ta_head {
pub static ta_heap: [u8; TA_DATA_SIZE as usize] = [0; TA_DATA_SIZE as usize];

#[no_mangle]
pub static ta_heap_size: c_size_t = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
pub static ta_heap_size: usize = mem::size_of::<u8>() * TA_DATA_SIZE as usize;
static FLAG_BOOL: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_SINGLE_INSTANCE) != 0;
static FLAG_MULTI: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_MULTI_SESSION) != 0;
static FLAG_INSTANCE: bool = (TA_FLAGS & optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE) != 0;

#[no_mangle]
pub static ta_num_props: c_size_t = 9;
pub static ta_num_props: usize = 9;

#[no_mangle]
pub static ta_props: [optee_utee_sys::user_ta_property; 9] = [
Expand Down
Loading

0 comments on commit 4a9b369

Please sign in to comment.