ldelf, libutee: add minimal Thread Local Storage supportPreparing for C++ support in TAs.Adds enough runtime Thread Local Storage (TLS) support for the GNU C++compilers (arm-linux-gnueabihf-g++,
ldelf, libutee: add minimal Thread Local Storage supportPreparing for C++ support in TAs.Adds enough runtime Thread Local Storage (TLS) support for the GNU C++compilers (arm-linux-gnueabihf-g++, aarch64-linux-gnu-g++) to work withOP-TEE. That is: - A Thread Control Block, - The __tls_get_addr() and dl_iterate_phdr() functions.Note that __tls_get_addr() is an ABI helper so it has no prototype in auser-accessible header file. dl_iterate_phdr() however is defined in<link.h> and may be used in a TA. The file lib/libutee/include/link.h isborrowed from Android's Bionic [1] with minor changes (added therequired #include statement and named the function parameters). Asimilar <link.h> header is provided by other C libraries such as GNUlibc, musl and FreeBSD/NetBSD/OpenBSD.Link: [1] https://android.googlesource.com/platform/bionic/+/master/libc/include/link.hSigned-off-by: Jerome Forissier <jerome@forissier.org>Acked-by: Etienne Carriere <etienne.carriere@linaro.org>Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAYAdds support for running initialization and finalization functions inTA ELF files. Such functions are used, for instance, by C++ compilers
ldelf, ta: add support for DT_INIT_ARRAY and DT_FINI_ARRAYAdds support for running initialization and finalization functions inTA ELF files. Such functions are used, for instance, by C++ compilersto construct and destruct global objects. They can also be used in Cthanks to __attribute__((constructor)) and __attribute__((destructor)).A global structure is added to libutee. ldelf is responsible forfilling it with the addresses of the functions pointer arrays presentin the ELF files whenever such a file is loaded. Since the number ofarrays is unknown at compile time (it depends on how many ELF files areloaded, and whether they have constructors or destructors), memory isallocated on the TA heap.Two helper functions are introduced: __utee_call_elf_init_fn() and__utee_call_elf_fini_fn(). They are used when the TA instance iscreated and torn down, as well as by dlopen().Signed-off-by: Jerome Forissier <jerome@forissier.org>Tested-by: Jerome Forissier <jerome@forissier.org> (QEMU, QEMUv8, HiKey960 32/64)Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
libutee,libdl: remove 0ms timeouts in TA invocationsTEE_OpenTASession(), TEE_InvokeTACommand() calls using 0ms timeoutare replaced with TEE_INFINITE_TIMEOUT to avoid risk of being cancelled.Sign
libutee,libdl: remove 0ms timeouts in TA invocationsTEE_OpenTASession(), TEE_InvokeTACommand() calls using 0ms timeoutare replaced with TEE_INFINITE_TIMEOUT to avoid risk of being cancelled.Signed-off-by: Cedric Auger <cauger@provenrun.com>Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Add libdl for TAsAdds basic support for dlopen(), dlsym() and dlclose(). The flags passedto dlopen() must be (RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); othervalues are not supported at the moment.
Add libdl for TAsAdds basic support for dlopen(), dlsym() and dlclose(). The flags passedto dlopen() must be (RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE); othervalues are not supported at the moment.Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>