Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, avtikhon@tarantool.org,
	tsafin@tarantool.org
Subject: [Tarantool-patches] [PATCH 1/1] test: stop linking msgpuck lib with test modules
Date: Thu, 28 May 2020 00:17:36 +0200	[thread overview]
Message-ID: <9024fa0b72a0af657b9aaf29ff0265ae1ed692ed.1590617769.git.v.shpilevoy@tarantool.org> (raw)

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)

             reply	other threads:[~2020-05-27 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 22:17 Vladislav Shpilevoy [this message]
2020-05-28 20:01 ` Timur Safin
2020-05-28 22:15 ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9024fa0b72a0af657b9aaf29ff0265ae1ed692ed.1590617769.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tsafin@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/1] test: stop linking msgpuck lib with test modules' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox