From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 55F64469710 for ; Thu, 28 May 2020 23:01:56 +0300 (MSK) From: "Timur Safin" References: <9024fa0b72a0af657b9aaf29ff0265ae1ed692ed.1590617769.git.v.shpilevoy@tarantool.org> In-Reply-To: <9024fa0b72a0af657b9aaf29ff0265ae1ed692ed.1590617769.git.v.shpilevoy@tarantool.org> Date: Thu, 28 May 2020 23:01:52 +0300 Message-ID: <048301d6352a$d5098dc0$7f1ca940$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Tarantool-patches] [PATCH 1/1] test: stop linking msgpuck lib with test modules List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Vladislav Shpilevoy' , tarantool-patches@dev.tarantool.org, avtikhon@tarantool.org Huh, indeed, very correct idea to link testing executable with msgpuck from Tarantool executable! LGTM! Timur : -----Original Message----- : From: Vladislav Shpilevoy : Sent: Thursday, May 28, 2020 1:18 AM : To: tarantool-patches@dev.tarantool.org; avtikhon@tarantool.org; : tsafin@tarantool.org : Subject: [PATCH 1/1] test: stop linking msgpuck lib with test modules : : Test modules are shared libraries. They link with Tarantool at : runtime and resolve missing symbols then. However in case they : already contain some of the same symbols used by tarantool, that : leads to a conflict in ASAN build. Nothing serious, there are : strict rules how a linker should behave in this case, but there : is still a warning. This is how it looked (the text is shortened): : : ==25624==ERROR: AddressSanitizer: odr-violation (0x000001123b60): : [1] size=1024 'mp_type_hint' : /builds/nZUxDh2c/0/tarantool/tarantool/src/lib/msgpuck/hints.c:39:20 : [2] size=1024 'mp_type_hint' : /builds/nZUxDh2c/0/tarantool/tarantool/src/lib/msgpuck/hints.c:39:20 : These globals were registered at these points: : [1]: : #0 0x478b8e in __asan_register_globals : (/builds/nZUxDh2c/0/tarantool/tarantool/src/tarantool+0x478b8e) : #1 0x7ff7a9bc9d0b in asan.module_ctor : (/tmp/tntz2FLhA/function1.so+0x6d0b) : : [2]: : #0 0x478b8e in __asan_register_globals : (/builds/nZUxDh2c/0/tarantool/tarantool/src/tarantool+0x478b8e) : #1 0xab990b in asan.module_ctor : (/builds/nZUxDh2c/0/tarantool/tarantool/src/tarantool+0xab990b) : : The symbol mp_type_hint is defined both in tarantool executable, : and in function1.so dynamic library. This is because both build : with msgpuck static library. : : However the modules don't need to be built with msgpuck. They can : link with it at runtime from tarantool executable. : : This patch removes msgpuck from test dynamic modules, and exports : all msgpuck non-inlined symbols explicitly, so they couldn't be : removed by the linker in future. : : Follow-up #2971 : Follow-up #5001 : Closes #5023 : --- : Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-5023- : msgpuck-conflict-full-ci : Issue: https://github.com/tarantool/tarantool/issues/5023 : : src/exports.h | 14 ++++++++++++++ : test/CMakeLists.txt | 1 - : 2 files changed, 14 insertions(+), 1 deletion(-) : : diff --git a/src/exports.h b/src/exports.h : index bffb1636b..29797ae5a 100644 : --- a/src/exports.h : +++ b/src/exports.h : @@ -319,6 +319,7 @@ EXPORT(luaT_istuple) : EXPORT(luaT_pushtuple) : EXPORT(luaT_state) : EXPORT(luaT_tolstring) : +EXPORT(mp_char2escape) : EXPORT(mp_decode_double) : EXPORT(mp_decode_extl) : EXPORT(mp_decode_float) : @@ -326,8 +327,21 @@ EXPORT(mp_encode_decimal) : EXPORT(mp_encode_double) : EXPORT(mp_encode_float) : EXPORT(mp_encode_uuid) : +EXPORT(mp_ext_hint) : +EXPORT(mp_format) : +EXPORT(mp_fprint) : +EXPORT(mp_fprint_ext) : +EXPORT(mp_fprint_ext_default) : +EXPORT(mp_fprint_recursion) : +EXPORT(mp_parser_hint) : EXPORT(mp_sizeof_decimal) : EXPORT(mp_sizeof_uuid) : +EXPORT(mp_snprint) : +EXPORT(mp_snprint_ext) : +EXPORT(mp_snprint_ext_default) : +EXPORT(mp_snprint_recursion) : +EXPORT(mp_type_hint) : +EXPORT(mp_vformat) : EXPORT(password_prepare) : EXPORT(PMurHash32) : EXPORT(PMurHash32_Process) : diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt : index 37cc099b7..8d9d0462a 100644 : --- a/test/CMakeLists.txt : +++ b/test/CMakeLists.txt : @@ -5,7 +5,6 @@ include_directories(${MSGPUCK_INCLUDE_DIRS}) : : function(build_module module files) : add_library(${module} SHARED ${files}) : - target_link_libraries(${module} ${MSGPUCK_LIBRARIES}) : set_target_properties(${module} PROPERTIES PREFIX "") : add_dependencies(${module} api) : if(TARGET_OS_DARWIN) : -- : 2.21.1 (Apple Git-122.3)