[Tarantool-patches] [PATCH 1/1] test: stop linking msgpuck lib with test modules

Timur Safin tsafin at tarantool.org
Thu May 28 23:01:52 MSK 2020


Huh, indeed, very correct idea to link testing executable 
with msgpuck from Tarantool executable! 

LGTM!

Timur

: -----Original Message-----
: From: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
: Sent: Thursday, May 28, 2020 1:18 AM
: To: tarantool-patches at dev.tarantool.org; avtikhon at tarantool.org;
: tsafin at 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)




More information about the Tarantool-patches mailing list