[Tarantool-patches] [PATCH 00/43] Unhide symbols

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sun Apr 12 17:25:29 MSK 2020


I tried to split exports by modules, which own the symbols.
However, obviously, it leads to a potential problem when we
need to export something from a third_party or a submodule,
which should not care about what the main executable wants
to export. I had that problem with small/ibuf and a couple of
third_party libs.

Alternatively we can split exports by places where they are
needed. For example, if some symbols are needed by digest.lua,
we make digest.c export all needed symbols from related
libraries.

If some symbols are needed only for module.h, we introduce
module.c, which exports all symbols needed here. That would
allow to keep all exports inside own tarantool libs.

Drawback is that if a symbol is needed both for FFI and for
the public C API, strictly speaking we should export it in two
places. It won't affect anything, though.

Another alternative - return to what was before Nik's patch,
when we had one huge .c file depending on everything we need
to export, and referencing each individual exported function
by pointer in a big array. It was called ffi_syms.c before
this:
https://github.com/tarantool/tarantool/commit/4c4c1ccbe422e1420ce0c0b36194fc61bb857ed4,
but I don't like having one file, which needs to include
everything directly.

On 12/04/2020 02:12, Vladislav Shpilevoy wrote:
> The patchset makes Tarantool stop hiding not explicitly exported
> symbols.
> 
> It means, all FFI and public C API related symbols are still
> always exported. All the other symbols may be exported, or may be
> not.
> 
> That feature was requested solely by Mons.
> 
> To make the needed symbols visible the hack with function
> addresses was returned back, like it was before
> https://github.com/tarantool/tarantool/commit/4c4c1ccbe422e1420ce0c0b36194fc61bb857ed4,
> but in a more structured form.
> 
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-2971-symbols
> Issue: https://github.com/tarantool/tarantool/issues/2971
> 
> Vladislav Shpilevoy (43):
>   cmake: remove double usage of some source files
>   cmake: remove dynamic-list linker option
>   build: export src/lib/core/clock.c symbols
>   build: export src/scramble.c symbols
>   build: export src/lua/socket.c symbols
>   build: export third_party/base64.c symbols
>   build: export src/lua/digest.c symbols
>   build: export src/lib/salad/guava.c symbols
>   build: export src/lib/core/random.c symbols
>   build: export src/lib/core/fiber.c symbols
>   build: export src/lua/init.c symbols
>   build: export src/lib/core/port.c symbols
>   build: export src/lib/csv/csv.c symbols
>   build: export src/title.c symbols
>   build: export src/lua/tnt_iconv.c symbols
>   build: export src/lib/core/exception.cc symbols
>   build: export src/lib/uuid/tt_uuid.c symbols
>   build: export src/lib/core/say.c symbols
>   build: export src/lib/uri/uri.c symbols
>   build: export third_party/PMurHash.c symbols
>   build: export src/crc32.c symbols
>   build: export src/lua/msgpack.c symbols
>   build: export src/main.cc symbols
>   build: export src/box/space.c symbols
>   build: export src/box/schema.cc symbols
>   build: export src/lib/crypto/crypto.c symbols
>   build: export src/lua/buffer.c symbols
>   build: export src/lib/swim/swim.c symbols
>   build: export src/lib/core/fiber_cond.c symbols
>   build: export src/lib/core/coio.cc symbols
>   build: export src/lua/utils.c symbols
>   build: export src/box/lua/tuple.c symbols
>   build: export src/lua/error.c symbols
>   build: export src/box/txn.c symbols
>   build: export src/box/key_def.c symbols
>   build: export src/box/tuple.c symbols
>   build: export src/box/index.cc symbols
>   build: export src/box/box.cc symbols
>   build: export src/box/error.cc symbols
>   build: export src/lib/core/diag.c symbols
>   build: export src/lib/core/latch.c symbols
>   build: export src/lua/string.c symbols
>   build: export public Lua symbols
> 
>  .gitignore                                  |   1 -
>  extra/exports                               | 398 --------------------
>  src/CMakeLists.txt                          |  57 +--
>  src/box/CMakeLists.txt                      |   7 +-
>  src/box/box.cc                              |  22 ++
>  src/box/error.cc                            |  14 +
>  src/box/index.cc                            |  19 +
>  src/box/key_def.c                           |  12 +
>  src/box/lua/init.c                          |  12 +
>  src/box/lua/tuple.c                         |  11 +
>  src/box/schema.cc                           |   9 +
>  src/box/space.c                             |  10 +
>  src/box/tuple.c                             |  28 ++
>  src/box/txn.c                               |  16 +
>  src/crc32.c                                 |   9 +
>  src/exports.c                               | 126 +++++++
>  src/lib/core/clock.c                        |  16 +
>  src/lib/core/coio.cc                        |  12 +
>  src/lib/core/diag.c                         |   8 +
>  src/lib/core/exception.cc                   |  10 +
>  src/lib/core/fiber.c                        |  30 ++
>  src/lib/core/fiber_cond.c                   |  14 +
>  src/lib/core/latch.c                        |  13 +
>  src/lib/core/port.c                         |   9 +
>  src/lib/core/random.c                       |   9 +
>  src/lib/core/say.c                          |  16 +
>  src/lib/crypto/crypto.c                     |  17 +
>  src/lib/csv/csv.c                           |  15 +
>  src/lib/salad/guava.c                       |   9 +
>  src/lib/small                               |   2 +-
>  src/lib/swim/swim.c                         |  32 ++
>  src/lib/uri/uri.c                           |  10 +
>  src/lib/uuid/tt_uuid.c                      |  15 +
>  src/lua/buffer.c                            |  14 +
>  src/lua/digest.c                            |   9 +
>  src/lua/error.c                             |   9 +
>  src/lua/init.c                              | 201 ++++++++++
>  src/lua/msgpack.c                           |  17 +
>  src/lua/socket.c                            |  10 +
>  src/lua/string.c                            |   9 +
>  src/lua/tnt_iconv.c                         |  11 +
>  src/lua/utils.c                             |  24 ++
>  src/main.cc                                 |  15 +
>  src/scramble.c                              |   9 +
>  src/title.c                                 |  18 +
>  test/box/gh-2971-symbol-visibility.result   |  22 ++
>  test/box/gh-2971-symbol-visibility.test.lua |  14 +
>  third_party/PMurHash.c                      |  11 +
>  third_party/base64.c                        |  11 +
>  49 files changed, 938 insertions(+), 454 deletions(-)
>  delete mode 100644 extra/exports
>  create mode 100644 src/exports.c
>  create mode 100644 test/box/gh-2971-symbol-visibility.result
>  create mode 100644 test/box/gh-2971-symbol-visibility.test.lua
> 


More information about the Tarantool-patches mailing list