From: Łukasz Stelmach Date: Fri, 7 Apr 2023 10:49:25 +0000 (+0200) Subject: tests: Add -mno-relax to link flags for server test X-Git-Tag: accepted/tizen/unified/20230808.074051~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fappfw%2Fapp2sd.git;a=commitdiff_plain;h=3d1bd7de02c1f436351ce739f6614d9d5e7eb7df tests: Add -mno-relax to link flags for server test The flag is required to prevent the test binary from using the gp register on RISC-V to access global variables. RISC-V ABI assumes the value of the register is assigned once at sartup (see load_gp() in sysdeps/riscv/start.S in glibc sources). During tests this code is called for the second time when app2sd-server-test uses dlopen() to load app2sd-server. Therefore with relaxed linking enabled for both binaries, the value set at the start of app2sd-server-test gets overwriten and the test process crashes in semi-random places. Change-Id: I6c5d550340c222bb53f8affd0d0c188cc5311765 Signed-off-by: Łukasz Stelmach --- diff --git a/packaging/app2sd.spec b/packaging/app2sd.spec index 8d23bed..d6bf656 100644 --- a/packaging/app2sd.spec +++ b/packaging/app2sd.spec @@ -60,7 +60,7 @@ cp %{SOURCE3} . %build MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -%cmake . -DUNITDIR=%{_unitdir} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +%cmake . -DUNITDIR=%{_unitdir} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DARCH=%{_arch} make %{?jobs:-j%jobs} diff --git a/unit-tests/CMakeLists.txt b/unit-tests/CMakeLists.txt index e134f28..7ae2bc8 100644 --- a/unit-tests/CMakeLists.txt +++ b/unit-tests/CMakeLists.txt @@ -11,6 +11,10 @@ SET(TARGET_SERVER_TEST "app2sd-server-test") ADD_EXECUTABLE(${TARGET_LIB_TEST} ${TEST_LIB_SRCS}) ADD_EXECUTABLE(${TARGET_SERVER_TEST} ${TEST_SERVER_SRCS}) +IF("${ARCH}" STREQUAL "riscv64") + TARGET_LINK_OPTIONS(${TARGET_SERVER_TEST} PUBLIC -mno-relax) +ENDIF() + APPLY_PKG_CONFIG(${TARGET_LIB_TEST} PUBLIC app2ext_libpkgs GMOCK_DEPS