Link with OpTEE directly, not as static lib 91/192191/2
authorIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Tue, 30 Oct 2018 14:05:00 +0000 (15:05 +0100)
committerIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Wed, 31 Oct 2018 10:21:25 +0000 (11:21 +0100)
We need to link the TA with a c file provided by OpTEE to create a full
TA. Compiling and linking it as a static lib caused some sections (like
.ta_head) to not be pulled unless we used some symbols from the lib.
Change the CMake script so we add the OpTEE file to sources directly.

Change-Id: Ic064ff138229336a11bb5cca0c61a6b9d409c401
Signed-off-by: Igor Kotrasinski <i.kotrasinsk@partner.samsung.com>
cmake/UnifiedTADevkit.cmake.optee.in
pkgconfig/ta-devkit.pc.optee.in

index fa53d96..26a69b6 100644 (file)
@@ -72,12 +72,6 @@ LINK_DIRECTORIES(
     ${DEVKIT_TA_PATH}/lib
     )
 
-SET(DEVKIT_TA_TARGET ta-core)
-
-ADD_LIBRARY(${DEVKIT_TA_TARGET} STATIC
-    ${DEVKIT_TA_PATH}/src/user_ta_header.c
-    )
-
 # MACRO GENERATE_TA_IMAGE unifies compiling dependencies and signing/encrypting
 # Parameters:
 # TargetName        [in]    - name of target that represent TA
@@ -87,11 +81,11 @@ ADD_LIBRARY(${DEVKIT_TA_TARGET} STATIC
 
 MACRO(GENERATE_TA_IMAGE TargetName TAElfTargetName TAConfDir TAImageName)
     # Dependency to compiled linker script
-    ADD_DEPENDENCIES(${TAElfTargetName} ta-core-ld ${DEVKIT_TA_TARGET})
+    ADD_DEPENDENCIES(${TAElfTargetName} ta-core-ld)
     # Add config header of built TA
     INCLUDE_DIRECTORIES(${TAConfDir}/optee/include)
 
-    TARGET_LINK_LIBRARIES(${TAElfTargetName} ${DEVKIT_TA_TARGET})
+    TARGET_SOURCES(${TAElfTargetName} PUBLIC ${DEVKIT_TA_PATH}/src/user_ta_header.c)
 
     SET(STRIPPED_TARGET_FILE ${TAElfTargetName}.strip)
 
index 25debb2..fde15fa 100644 (file)
@@ -6,5 +6,5 @@ includedir=${prefix}/include
 Name: optee-ta-devkit
 Description: OpTEE TA development kit
 Version: @PKGCFG_VERSION@
-Libs.private: -L${libdir} -lutee -lpng -lzlib -lutils -lmpa -lta-core -lutee -lutils -lgcc_eh
+Libs.private: -L${libdir} -lutee -lpng -lzlib -lutils -lmpa -lutee -lutils -lgcc_eh
 Cflags: -I${includedir}/