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 <l.stelmach@samsung.com>
%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}
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