The current implementation in https://github.com/apache/teaclave-trustzone-sdk/blob/main/optee-utee-build/src/linker.rs uses boolean flags and nested if/else logic that makes the code difficult to understand and maintain. We should leverage Rust's type system to create cleaner, more maintainable code.
Discussed in
#245 (comment)