New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practice to include library into TA? #1003

Closed
flottetotte opened this Issue Aug 19, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@flottetotte

flottetotte commented Aug 19, 2016

Hello,

i would like to ask what's the best practice to add a library to a TA (note: cross compiling the library to be used in the user-space was not hard). As a naive start, i followed the discussion of this issue #901. However, i quickly noticed after cross compiling the lib (libgmp) and adding it like in the issues mentioned before, that when i try to actually compile the TA not all functions required (linking) by the library are there, for example (among others):

/devel/optee/optee_os/out/arm/export-ta_arm64/lib/libgmp.a(printffuns.o):(.data.rel.ro+0x0): undefined reference to vfprintf

Of course one could adapt the library, but that seems to be a quite cumbersome task.
So is there some way to allow the TA to use user-space libraries directly?

Thanks!
Torsten

@jforissier

This comment has been minimized.

Contributor

jforissier commented Aug 19, 2016

You get an undefined reference to vprintf because libutils.a (which is more or less our C library for TAs) does not provide this function. The primary API that TAs are supposed to use it the GobalPlatform TEE Core Internal API. That is why we are not trying to provide a complete C library in libutils.a, although we do provide some well-known functions (you can see which ones with $(CROSS_COMPILE)-nm libutils.a | grep " T "). They are provided mainly to help implement the GP API.

A TA has to be fully statically linked, i.e., it can not use shared objects, let alone .so files from the normal world. But you might be able to use pre-compiled static libraries for your target.

Another option is to add the missing functions to libutils.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment