-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[RFC] Symbol versioning in libutee.so, the easy part #5833
base: master
Are you sure you want to change the base?
Commits on Feb 20, 2023
-
build: mk/lib.mk: use full path to shared library in flags variable
To add link flags for a shared library, a makefile variable is used that is called lib-ldflags$(libuuid). That's incorrect because the UUID is not enough to uniquely identify a shared library in the build. For example when both 32-bit and 64-bit user space is generated there are two versions of the shared library with the same UUID. It is not a problem at the moment because lib-ldflags$(libuuid) is used only for one target: ta_arm64, but fix this anyways so that the variable may be used for more complex cases. Signed-off-by: Jerome Forissier <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9d53864 - Browse repository at this point
Copy the full SHA 9d53864View commit details -
lib: link shared user space libraries with version script if it exists
If a user-space library such as lib/libutee is compiled as a shared library (CFG_ULIBS_SHARED=y) and a file called lib/libutee/libutee.ver exists, then use this file as a version script for the linker. Signed-off-by: Jerome Forissier <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ed48924 - Browse repository at this point
Copy the full SHA ed48924View commit details -
compiler.h: add macros to add symbol version info to shared library
Add the SYMVER_GP131() and SYMVER_COMPAT_GP11() macros to help define versioned symbols for functions when building shared libraries. - SYMVER_GP131(foo) associates version GP_1.3.1 to symbol foo and makes it the default version, that is, the version that is recorded by the linker when a TA links against the shared library and references foo. Such a symbol is shown as foo@@GP_1.3.1 by the command: readelf -W --dyn-syms libname.so The undefined symbol created in the application by linking against this entry is displayed as foo@GP_1.3.1. Symbol foo (unversioned) is removed from the linker output. - SYMVER_COMPAT_GP11(foo) defines symbol foo with version GP_1.1 and makes it the same as the unversioned symbol __GP11_foo. Signed-off-by: Jerome Forissier <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6cb54f4 - Browse repository at this point
Copy the full SHA 6cb54f4View commit details -
[WIP] libutee: add symbol versioning for shared library
Add the required macros and version script to associate version numbers with TEE API functions when libutee is built as a shared library (CFG_ULIBS_SHARED=y). The version script lib/libutee/libutee.ver declares two versions: GP_1.1 and GP_1.3.1. All symbols matching the glob pattern "TEE_[A-Z]*" are tagged with default version GP_1.1 (TEE_foo@@GP_1.1), unless version GP_1.3.1 is explicitly assigned in the source code via SYMVER_GP131(). In this case the default version symbol is GP_1.3.1 (TEE_foo@@GP_1.3.1). All GP1.3.1 function have a compatibility inplementation called __GP11_*() which is globally visible as an unversioned symbol (otherwise TAs that use the __OPTEE_CORE_API_COMPAT_1_1 mechanism would not work) and also as a versioned TEE_foo symbol with non-default version GP_1.1 (TEE_foo@GP_1.1). The UUID of libutee is reverted to the one it had before the GP 1.3.1 update since the library is now compatible with the old one. FIXME: THIS CAN NOT WORK until ldelf can resolve versioned symbols. Test case: xtest 4002. There is an infinite loop as follows: __utee_entry() entry_open_session() init_instance() get_memtag_implementation TEE_GetPropertyAsU32() TEE_CheckMemoryAccessRights() /* * That should call 1.3.1 but due to ldelf not knowing * about versions, __GP11_TEE_CheckMemoryAccessRights() * is called instead, which is supposed to call * TEE_CheckMemoryAccessRights() 1.3.1 => infinite loop */ Signed-off-by: Jerome Forissier <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4d4289b - Browse repository at this point
Copy the full SHA 4d4289bView commit details