Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 00/43] Unhide symbols
@ 2020-04-12  0:12 Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 01/43] cmake: remove double usage of some source files Vladislav Shpilevoy
                   ` (49 more replies)
  0 siblings, 50 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

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

-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 01/43] cmake: remove double usage of some source files
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 10/43] build: export src/lib/core/fiber.c symbols Vladislav Shpilevoy
                   ` (48 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

src/cpu_feature.c, src/box/error.cc and src/box/vclock.c were used
twice. As a result it could lead to duplicate symbols.
---
 src/CMakeLists.txt     | 7 ++++---
 src/box/CMakeLists.txt | 7 +++----
 src/lib/small          | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7d865472d..a17da9901 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -82,11 +82,13 @@ target_link_libraries(stat core)
 add_library(scramble STATIC scramble.c)
 target_link_libraries(scramble core misc)
 
+add_library(cpu_feature STATIC cpu_feature.c)
+
 add_library(crc32 STATIC
     crc32.c
-    cpu_feature.c
     ${PROJECT_SOURCE_DIR}/third_party/crc32.c
 )
+target_link_libraries(crc32 cpu_feature)
 
 set (server_sources
      find_path.c
@@ -94,7 +96,6 @@ set (server_sources
      httpc.c
      pickle.c
      cfg.c
-     cpu_feature.c
      title.c
      proc_title.c
      path_lock.c
@@ -170,7 +171,7 @@ set_source_files_compile_flags(${server_sources})
 add_library(server STATIC ${server_sources})
 add_dependencies(server build_bundled_libs)
 target_link_libraries(server core coll http_parser bit uri uuid swim swim_udp
-                      swim_ev crypto)
+                      swim_ev crypto crc32)
 
 # Rule of thumb: if exporting a symbol from a static library, list the
 # library here.
diff --git a/src/box/CMakeLists.txt b/src/box/CMakeLists.txt
index 56758bd2f..402860757 100644
--- a/src/box/CMakeLists.txt
+++ b/src/box/CMakeLists.txt
@@ -26,12 +26,12 @@ set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
 include_directories(${ZSTD_INCLUDE_DIRS})
 include_directories(${CMAKE_BINARY_DIR}/src/box/sql)
 
-add_library(box_error STATIC error.cc errcode.c vclock.c)
-target_link_libraries(box_error core stat)
-
 add_library(vclock STATIC vclock.c)
 target_link_libraries(vclock core)
 
+add_library(box_error STATIC error.cc errcode.c)
+target_link_libraries(box_error core stat vclock)
+
 add_library(xrow STATIC xrow.c iproto_constants.c)
 target_link_libraries(xrow server core small vclock misc box_error
                       scramble ${MSGPUCK_LIBRARIES})
@@ -65,7 +65,6 @@ target_link_libraries(xlog core box_error crc32 ${ZSTD_LIBRARIES})
 
 add_library(box STATIC
     iproto.cc
-    error.cc
     xrow_io.cc
     tuple_convert.c
     identifier.c
diff --git a/src/lib/small b/src/lib/small
index 3df505017..cebc40574 160000
--- a/src/lib/small
+++ b/src/lib/small
@@ -1 +1 @@
-Subproject commit 3df5050171d040bfe5717b4bddf57da3b312ffe4
+Subproject commit cebc40574cb68a21dac16c438371392db8f98f66
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 10/43] build: export src/lib/core/fiber.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 01/43] cmake: remove double usage of some source files Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 11/43] build: export src/lua/init.c symbols Vladislav Shpilevoy
                   ` (47 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/fiber.lua via FFI, and needed
for the public C API.

Part of #2971
---
 extra/exports        | 24 ------------------------
 src/exports.c        |  2 ++
 src/lib/core/fiber.c | 30 ++++++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/extra/exports b/extra/exports
index 1224c550d..b4b2d90c3 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,10 +2,6 @@
 
 # FFI
 
-fiber_time
-fiber_time64
-fiber_clock
-fiber_clock64
 tarantool_lua_slab_cache
 ibuf_create
 ibuf_reinit
@@ -112,32 +108,12 @@ swim_member_is_payload_up_to_date
 # Module API
 
 _say
-fiber_attr_new
-fiber_attr_delete
-fiber_attr_setstacksize
-fiber_attr_getstacksize
-fiber_self
-fiber_new
-fiber_new_ex
-fiber_yield
-fiber_start
-fiber_wakeup
-fiber_cancel
-fiber_set_cancellable
-fiber_set_joinable
-fiber_join
-fiber_sleep
-fiber_is_cancelled
-fiber_time
-fiber_time64
-fiber_reschedule
 fiber_cond_new
 fiber_cond_delete
 fiber_cond_signal
 fiber_cond_broadcast
 fiber_cond_wait_timeout
 fiber_cond_wait
-cord_slab_cache
 coio_wait
 coio_close
 coio_call
diff --git a/src/exports.c b/src/exports.c
index cd2d49b9b..4e39528ed 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -50,6 +50,7 @@
 
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
+EXPORT(fiber_export_syms);
 EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
 EXPORT(scramble_export_syms);
@@ -61,6 +62,7 @@ export_syms(void)
 	void *syms[] = {
 		base64_export_syms,
 		clock_export_syms,
+		fiber_export_syms,
 		random_export_syms,
 		salad_guava_export_syms,
 		scramble_export_syms,
diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
index 5389ce467..347a46736 100644
--- a/src/lib/core/fiber.c
+++ b/src/lib/core/fiber.c
@@ -1748,3 +1748,33 @@ int fiber_stat(fiber_stat_cb cb, void *cb_ctx)
 	}
 	return 0;
 }
+
+void **
+fiber_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)cord_slab_cache,
+		(void *)fiber_attr_new,
+		(void *)fiber_attr_delete,
+		(void *)fiber_attr_getstacksize,
+		(void *)fiber_attr_setstacksize,
+		(void *)fiber_cancel,
+		(void *)fiber_clock,
+		(void *)fiber_clock64,
+		(void *)fiber_is_cancelled,
+		(void *)fiber_join,
+		(void *)fiber_new,
+		(void *)fiber_new_ex,
+		(void *)fiber_reschedule,
+		(void *)fiber_self,
+		(void *)fiber_set_cancellable,
+		(void *)fiber_set_joinable,
+		(void *)fiber_sleep,
+		(void *)fiber_start,
+		(void *)fiber_time,
+		(void *)fiber_time64,
+		(void *)fiber_wakeup,
+		(void *)fiber_yield,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 11/43] build: export src/lua/init.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 01/43] cmake: remove double usage of some source files Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 10/43] build: export src/lib/core/fiber.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 12/43] build: export src/lib/core/port.c symbols Vladislav Shpilevoy
                   ` (46 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports a function and a variable used by src/lua/buffer.lua
via FFI.

Part of #2971
---
 extra/exports  | 2 --
 src/lua/init.c | 4 ++++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/extra/exports b/extra/exports
index b4b2d90c3..09bbd6f33 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # FFI
 
-tarantool_lua_slab_cache
 ibuf_create
 ibuf_reinit
 ibuf_destroy
@@ -31,7 +30,6 @@ tnt_iconv
 exception_get_string
 exception_get_int
 
-tarantool_lua_ibuf
 uuid_nil
 tt_uuid_create
 tt_uuid_str
diff --git a/src/lua/init.c b/src/lua/init.c
index da1a19ccd..35a7e5884 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -747,6 +747,10 @@ tarantool_lua_export_syms(void)
 		/* Submodules. */
 		(void *)tarantool_lua_digest_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
+
+		/* Own symbols. */
+		(void *)tarantool_lua_slab_cache,
+		(void *)&tarantool_lua_ibuf,
 	};
 	return syms;
 }
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 12/43] build: export src/lib/core/port.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (2 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 11/43] build: export src/lua/init.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 13/43] build: export src/lib/csv/csv.c symbols Vladislav Shpilevoy
                   ` (45 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/box/lua/schema.lua via FFI.

Part of #2971
---
 extra/exports       | 1 -
 src/exports.c       | 2 ++
 src/lib/core/port.c | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 09bbd6f33..1d5cd1be6 100644
--- a/extra/exports
+++ b/extra/exports
@@ -6,7 +6,6 @@ ibuf_create
 ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
-port_destroy
 csv_create
 csv_destroy
 csv_setopt
diff --git a/src/exports.c b/src/exports.c
index 4e39528ed..d7e8aa3f7 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -51,6 +51,7 @@
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(fiber_export_syms);
+EXPORT(port_export_syms);
 EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
 EXPORT(scramble_export_syms);
@@ -63,6 +64,7 @@ export_syms(void)
 		base64_export_syms,
 		clock_export_syms,
 		fiber_export_syms,
+		port_export_syms,
 		random_export_syms,
 		salad_guava_export_syms,
 		scramble_export_syms,
diff --git a/src/lib/core/port.c b/src/lib/core/port.c
index 03694b466..b27c8df05 100644
--- a/src/lib/core/port.c
+++ b/src/lib/core/port.c
@@ -35,3 +35,12 @@ port_destroy(struct port *port)
 {
 	port->vtab->destroy(port);
 }
+
+void **
+port_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)port_destroy,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 13/43] build: export src/lib/csv/csv.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (3 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 12/43] build: export src/lib/core/port.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 14/43] build: export src/title.c symbols Vladislav Shpilevoy
                   ` (44 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/csv.lua via FFI.

Part of #2971
---
 extra/exports     |  7 -------
 src/exports.c     |  2 ++
 src/lib/csv/csv.c | 15 +++++++++++++++
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/extra/exports b/extra/exports
index 1d5cd1be6..5e59efa75 100644
--- a/extra/exports
+++ b/extra/exports
@@ -6,13 +6,6 @@ ibuf_create
 ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
-csv_create
-csv_destroy
-csv_setopt
-csv_iterator_create
-csv_next
-csv_feed
-csv_escape_field
 title_update
 title_get
 title_set_interpretor_name
diff --git a/src/exports.c b/src/exports.c
index d7e8aa3f7..fcc1c7842 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -50,6 +50,7 @@
 
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
+EXPORT(csv_export_syms);
 EXPORT(fiber_export_syms);
 EXPORT(port_export_syms);
 EXPORT(random_export_syms);
@@ -63,6 +64,7 @@ export_syms(void)
 	void *syms[] = {
 		base64_export_syms,
 		clock_export_syms,
+		csv_export_syms,
 		fiber_export_syms,
 		port_export_syms,
 		random_export_syms,
diff --git a/src/lib/csv/csv.c b/src/lib/csv/csv.c
index 0a2f7b4d0..648cccc55 100644
--- a/src/lib/csv/csv.c
+++ b/src/lib/csv/csv.c
@@ -409,3 +409,18 @@ csv_escape_field(struct csv *csv, const char *field,
 	*p = 0;
 	return p - dst;
 }
+
+void **
+csv_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)csv_create,
+		(void *)csv_destroy,
+		(void *)csv_escape_field,
+		(void *)csv_feed,
+		(void *)csv_iterator_create,
+		(void *)csv_next,
+		(void *)csv_setopt,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 14/43] build: export src/title.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (4 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 13/43] build: export src/lib/csv/csv.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 15/43] build: export src/lua/tnt_iconv.c symbols Vladislav Shpilevoy
                   ` (43 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/title.lua via FFI.

Part of #2971
---
 extra/exports | 10 ----------
 src/exports.c |  2 ++
 src/title.c   | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/extra/exports b/extra/exports
index 5e59efa75..cbf3906c9 100644
--- a/extra/exports
+++ b/extra/exports
@@ -6,16 +6,6 @@ ibuf_create
 ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
-title_update
-title_get
-title_set_interpretor_name
-title_get_interpretor_name
-title_set_script_name
-title_get_script_name
-title_set_custom
-title_get_custom
-title_set_status
-title_get_status
 tnt_iconv_open
 tnt_iconv_close
 tnt_iconv
diff --git a/src/exports.c b/src/exports.c
index fcc1c7842..2d16c175b 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -57,6 +57,7 @@ EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
 EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
+EXPORT(title_export_syms);
 
 void
 export_syms(void)
@@ -71,6 +72,7 @@ export_syms(void)
 		salad_guava_export_syms,
 		scramble_export_syms,
 		tarantool_lua_export_syms,
+		title_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/title.c b/src/title.c
index e07ced779..fbdd6606f 100644
--- a/src/title.c
+++ b/src/title.c
@@ -197,3 +197,21 @@ DEFINE_STRING_ACCESSORS(interpretor_name)
 DEFINE_STRING_ACCESSORS(script_name)
 DEFINE_STRING_ACCESSORS(custom)
 DEFINE_STRING_ACCESSORS(status)
+
+void **
+title_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)title_get,
+		(void *)title_get_custom,
+		(void *)title_get_interpretor_name,
+		(void *)title_get_script_name,
+		(void *)title_get_status,
+		(void *)title_set_custom,
+		(void *)title_set_interpretor_name,
+		(void *)title_set_script_name,
+		(void *)title_set_status,
+		(void *)title_update,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 15/43] build: export src/lua/tnt_iconv.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (5 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 14/43] build: export src/title.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 16/43] build: export src/lib/core/exception.cc symbols Vladislav Shpilevoy
                   ` (42 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/iconv.lua via FFI.

Also it appeared, that 'server' static library, owner of
tnt_iconv.c, didn't add ICONV_LIBRARIES dependency, even though
it used functions from there. That led to compilation errors, but
strangely only with that patch. So they are in one commit.

Part of #2971
---
 extra/exports       |  3 ---
 src/CMakeLists.txt  |  2 +-
 src/lua/init.c      |  4 ++++
 src/lua/tnt_iconv.c | 11 +++++++++++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/extra/exports b/extra/exports
index cbf3906c9..b15096a57 100644
--- a/extra/exports
+++ b/extra/exports
@@ -6,9 +6,6 @@ ibuf_create
 ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
-tnt_iconv_open
-tnt_iconv_close
-tnt_iconv
 exception_get_string
 exception_get_int
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3a8b670f2..feb26345a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -171,7 +171,7 @@ set_source_files_compile_flags(${server_sources})
 add_library(server STATIC ${server_sources})
 add_dependencies(server build_bundled_libs)
 target_link_libraries(server core coll http_parser bit uri uuid swim swim_udp
-                      swim_ev crypto crc32)
+                      swim_ev crypto crc32 ${ICONV_LIBRARIES})
 
 # Rule of thumb: if exporting a symbol from a static library, list the
 # library here.
diff --git a/src/lua/init.c b/src/lua/init.c
index 35a7e5884..a004b1342 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -737,6 +737,9 @@ tarantool_lua_digest_export_syms(void);
 void **
 tarantool_lua_socket_export_syms(void);
 
+void **
+tarantool_lua_tnt_iconv_export_syms(void);
+
 /**
  * Aggregator of all symbols defined in src/lua.
  */
@@ -747,6 +750,7 @@ tarantool_lua_export_syms(void)
 		/* Submodules. */
 		(void *)tarantool_lua_digest_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
+		(void *)tarantool_lua_tnt_iconv_export_syms,
 
 		/* Own symbols. */
 		(void *)tarantool_lua_slab_cache,
diff --git a/src/lua/tnt_iconv.c b/src/lua/tnt_iconv.c
index c91fef140..30b760d1e 100644
--- a/src/lua/tnt_iconv.c
+++ b/src/lua/tnt_iconv.c
@@ -19,3 +19,14 @@ tnt_iconv(iconv_t cd, char **inbuf, size_t *inbytesleft,
         return iconv(cd, inbuf, inbytesleft,
                      outbuf, outbytesleft);
 }
+
+void **
+tarantool_lua_tnt_iconv_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)tnt_iconv,
+		(void *)tnt_iconv_close,
+		(void *)tnt_iconv_open,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 16/43] build: export src/lib/core/exception.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (6 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 15/43] build: export src/lua/tnt_iconv.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 17/43] build: export src/lib/uuid/tt_uuid.c symbols Vladislav Shpilevoy
                   ` (41 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/error.lua via FFI.

Part of #2971
---
 extra/exports             |  2 --
 src/exports.c             |  2 ++
 src/lib/core/exception.cc | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/extra/exports b/extra/exports
index b15096a57..34c5d2df6 100644
--- a/extra/exports
+++ b/extra/exports
@@ -6,8 +6,6 @@ ibuf_create
 ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
-exception_get_string
-exception_get_int
 
 uuid_nil
 tt_uuid_create
diff --git a/src/exports.c b/src/exports.c
index 2d16c175b..fbfde5632 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -51,6 +51,7 @@
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(csv_export_syms);
+EXPORT(exception_export_syms);
 EXPORT(fiber_export_syms);
 EXPORT(port_export_syms);
 EXPORT(random_export_syms);
@@ -66,6 +67,7 @@ export_syms(void)
 		base64_export_syms,
 		clock_export_syms,
 		csv_export_syms,
+		exception_export_syms,
 		fiber_export_syms,
 		port_export_syms,
 		random_export_syms,
diff --git a/src/lib/core/exception.cc b/src/lib/core/exception.cc
index 180cb0e97..5b106f354 100644
--- a/src/lib/core/exception.cc
+++ b/src/lib/core/exception.cc
@@ -417,3 +417,13 @@ exception_init()
 }
 
 #undef BuildAlloc
+
+extern "C" void **
+exception_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)exception_get_int,
+		(void *)exception_get_string,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 17/43] build: export src/lib/uuid/tt_uuid.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (7 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 16/43] build: export src/lib/core/exception.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 18/43] build: export src/lib/core/say.c symbols Vladislav Shpilevoy
                   ` (40 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions and a variable used by src/lua/uuid.lua via FFI.

Part of #2971
---
 extra/exports          |  7 -------
 src/exports.c          |  2 ++
 src/lib/uuid/tt_uuid.c | 15 +++++++++++++++
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/extra/exports b/extra/exports
index 34c5d2df6..b81ca4492 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,13 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-uuid_nil
-tt_uuid_create
-tt_uuid_str
-tt_uuid_is_equal
-tt_uuid_is_nil
-tt_uuid_bswap
-tt_uuid_from_string
 log_level
 log_format
 uri_parse
diff --git a/src/exports.c b/src/exports.c
index fbfde5632..37570d40e 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -59,6 +59,7 @@ EXPORT(salad_guava_export_syms);
 EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
 EXPORT(title_export_syms);
+EXPORT(tt_uuid_export_syms);
 
 void
 export_syms(void)
@@ -75,6 +76,7 @@ export_syms(void)
 		scramble_export_syms,
 		tarantool_lua_export_syms,
 		title_export_syms,
+		tt_uuid_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/lib/uuid/tt_uuid.c b/src/lib/uuid/tt_uuid.c
index 1bd2e2cfe..182bd09c9 100644
--- a/src/lib/uuid/tt_uuid.c
+++ b/src/lib/uuid/tt_uuid.c
@@ -99,3 +99,18 @@ tt_uuid_from_strl(const char *in, size_t len, struct tt_uuid *uu)
 	snprintf(buf, sizeof(buf), "%.*s", (int) len, in);
 	return tt_uuid_from_string(buf, uu);
 }
+
+void **
+tt_uuid_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)tt_uuid_bswap,
+		(void *)tt_uuid_create,
+		(void *)tt_uuid_from_string,
+		(void *)tt_uuid_is_equal,
+		(void *)tt_uuid_is_nil,
+		(void *)tt_uuid_str,
+		(void *)&uuid_nil,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 18/43] build: export src/lib/core/say.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (8 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 17/43] build: export src/lib/uuid/tt_uuid.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 19/43] build: export src/lib/uri/uri.c symbols Vladislav Shpilevoy
                   ` (39 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions and variables used by src/lua/log.lua via FFI,
and visible in the public C API.

Part of #2971
---
 extra/exports      |  8 --------
 src/exports.c      |  2 ++
 src/lib/core/say.c | 16 ++++++++++++++++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/extra/exports b/extra/exports
index b81ca4492..c95ea2c80 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,8 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-log_level
-log_format
 uri_parse
 uri_format
 PMurHash32
@@ -24,13 +22,8 @@ mp_decode_extl
 mp_sizeof_decimal
 decimal_unpack
 
-log_type
-say_set_log_level
-say_logrotate
-say_set_log_format
 tarantool_uptime
 tarantool_exit
-log_pid
 space_by_id
 space_run_triggers
 space_bsize
@@ -75,7 +68,6 @@ swim_member_is_payload_up_to_date
 
 # Module API
 
-_say
 fiber_cond_new
 fiber_cond_delete
 fiber_cond_signal
diff --git a/src/exports.c b/src/exports.c
index 37570d40e..e034c46aa 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -56,6 +56,7 @@ EXPORT(fiber_export_syms);
 EXPORT(port_export_syms);
 EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
+EXPORT(say_export_syms);
 EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
 EXPORT(title_export_syms);
@@ -73,6 +74,7 @@ export_syms(void)
 		port_export_syms,
 		random_export_syms,
 		salad_guava_export_syms,
+		say_export_syms,
 		scramble_export_syms,
 		tarantool_lua_export_syms,
 		title_export_syms,
diff --git a/src/lib/core/say.c b/src/lib/core/say.c
index 5d572e1ab..4eeaa3715 100644
--- a/src/lib/core/say.c
+++ b/src/lib/core/say.c
@@ -1243,3 +1243,19 @@ log_say(struct log *log, int level, const char *filename, int line,
 	va_end(ap);
 	return total;
 }
+
+void **
+say_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)&log_format,
+		(void *)&log_level,
+		(void *)&log_pid,
+		(void *)log_type,
+		(void *)say_logrotate,
+		(void *)say_set_log_format,
+		(void *)say_set_log_level,
+		(void *)&_say,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 19/43] build: export src/lib/uri/uri.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (9 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 18/43] build: export src/lib/core/say.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:12 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 02/43] cmake: remove dynamic-list linker option Vladislav Shpilevoy
                   ` (38 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:12 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/uri.lua via FFI.

Part of #2971
---
 extra/exports     |  2 --
 src/exports.c     |  2 ++
 src/lib/uri/uri.c | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/extra/exports b/extra/exports
index c95ea2c80..3814202f7 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,8 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-uri_parse
-uri_format
 PMurHash32
 PMurHash32_Process
 PMurHash32_Result
diff --git a/src/exports.c b/src/exports.c
index e034c46aa..deb81e887 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -61,6 +61,7 @@ EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
 EXPORT(title_export_syms);
 EXPORT(tt_uuid_export_syms);
+EXPORT(uri_export_syms);
 
 void
 export_syms(void)
@@ -79,6 +80,7 @@ export_syms(void)
 		tarantool_lua_export_syms,
 		title_export_syms,
 		tt_uuid_export_syms,
+		uri_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/lib/uri/uri.c b/src/lib/uri/uri.c
index 8cc82c6f7..3953da517 100644
--- a/src/lib/uri/uri.c
+++ b/src/lib/uri/uri.c
@@ -6340,4 +6340,14 @@ uri_format(char *str, int len, const struct uri *uri, bool write_password)
 	return total;
 }
 
+void **
+uri_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)uri_format,
+		(void *)uri_parse,
+	};
+	return syms;
+}
+
 /* vim: set ft=ragel: */
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 02/43] cmake: remove dynamic-list linker option
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (10 preceding siblings ...)
  2020-04-12  0:12 ` [Tarantool-patches] [PATCH 19/43] build: export src/lib/uri/uri.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 20/43] build: export third_party/PMurHash.c symbols Vladislav Shpilevoy
                   ` (37 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

dynamic-list (exported_symbols_list on Mac) was used to forbid
export of all symbols of the tarantool executable except a given
list. Motivation of that was to avoid hacking the linker with
false usage of symbols needed to be exported. As a consequence,
symbols not listed in these options became invisible.

Before these options, when a symbol was defined, but not used in
the final executable, the linker could throw it away, even though
many symbols were used by Lua FFI, or should be visible for user's
dynamic modules. Where the linker, obviously, can't see if they
are needed.

To make the linker believe the symbols are actually needed there
was a hack with getting pointers at these functions and doing
something with them.

For example, assume we have 'test()' function in 'box' static
library:

    int
    test(void);

It is not used anywhere in the final executable. So to trick the
linker there is a function 'export()' declared, which takes a
pointer at 'test()' and seemingly does something with it (or
actually does - it does not matter):

    void
    export()
    {
        void *syms[] = {test};
        if (time(NULL) == 0) {
            syms[0]();
            syms[1]();
            ...
        }
    }

Some users want to use not documented but visible symbols, so the
patch removes the dynamic-list option, and returns the linker
hack back, but in a more structured form.

Part of #2971
---
 .gitignore         |  1 -
 src/CMakeLists.txt | 50 +++----------------------------------
 src/exports.c      | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 src/main.cc        |  5 ++++
 4 files changed, 69 insertions(+), 48 deletions(-)
 create mode 100644 src/exports.c

diff --git a/.gitignore b/.gitignore
index cda28d79f..a42c7db35 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,7 +57,6 @@ extra/dist/tarantool.logrotate
 extra/dist/tarantool@.service
 extra/dist/tarantool.tmpfiles.conf
 extra/dist/tarantool-generator
-extra/exports.*
 cmake_install.cmake
 config.mk
 config.guess
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a17da9901..3a8b670f2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -245,56 +245,12 @@ if(BUILD_STATIC)
     endif()
 endif()
 
-# Exports syntax is toolchain-dependent, preprocessing is necessary
-set(exports_file ${CMAKE_BINARY_DIR}/extra/exports.${CMAKE_SYSTEM_NAME})
-add_custom_target(preprocess_exports
-                  DEPENDS ${exports_file})
-add_custom_command(
-    OUTPUT  ${exports_file}
-    DEPENDS ${CMAKE_SOURCE_DIR}/extra/exports
-    COMMAND ${CMAKE_SOURCE_DIR}/extra/mkexports
-            ${CMAKE_SOURCE_DIR}/extra/exports
-            ${exports_file} ${CMAKE_SYSTEM_NAME}
-            ${EXPORT_LIST}
-)
-
 add_executable(
-    tarantool main.cc
+    tarantool main.cc exports.c
     ${LIBUTIL_FREEBSD_SRC}/flopen.c
     ${LIBUTIL_FREEBSD_SRC}/pidfile.c)
 
-add_dependencies(tarantool build_bundled_libs preprocess_exports sql)
-
-# Re-link if exports changed
-set_target_properties(tarantool PROPERTIES LINK_DEPENDS ${exports_file})
-
-# A note about linkers:
-# [GNU linker] When linking an *executable* visibility is ignored, and
-#              either nothing is exported (default), or any non-static
-#              symbol is exported (-rdynamic), or explicitly listed
-#              symbols are exported (--dynamic-list).
-#
-#              However, if a symbol listed lives in a static library it
-#              won't be automatically pulled, hence --whole-archive
-#              option.
-#
-# [Apple linker] One can provide an explicit export list; pulls symbols
-#                from static libraries.
-#
-if (TARGET_OS_DARWIN)
-    target_link_libraries(tarantool box ${common_libraries})
-    set_target_properties(tarantool PROPERTIES
-        LINK_FLAGS "-Wl,-exported_symbols_list,${exports_file}")
-else ()
-    target_link_libraries(tarantool
-                          -Wl,--whole-archive box ${reexport_libraries}
-                          salad -Wl,--no-whole-archive
-                          ${common_libraries}
-                          ${generic_libraries})
-    set_target_properties(tarantool PROPERTIES
-        LINK_FLAGS "-Wl,--dynamic-list,${exports_file}")
-    # get rid of -rdynamic
-    set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-endif()
+add_dependencies(tarantool build_bundled_libs sql)
+target_link_libraries(tarantool box ${common_libraries})
 
 install (TARGETS tarantool DESTINATION bin)
diff --git a/src/exports.c b/src/exports.c
new file mode 100644
index 000000000..4bb423a57
--- /dev/null
+++ b/src/exports.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2010-2020, Tarantool AUTHORS, please see AUTHORS file.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the
+ *    following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#define EXPORT(func) extern void ** func(void)
+
+/**
+ * The file is a hack to force the linker keep the needed symbols
+ * in the result tarantool executable file.
+ *
+ * Problem is that if a symbol is defined but never used, the
+ * linker may throw it away. But many symbols are needed for Lua
+ * FFI and for the public C API used by dynamic modules.
+ *
+ * This file creates a 'false usage' of needed symbols. It takes
+ * pointers at them and does something with them, so as the
+ * compiler and linker couldn't remove it.
+ *
+ * Some exporters may represent modules having submodules, and may
+ * aggregate symbols from them.
+ *
+ * Add new exporters here. Keep them in alphabetical order.
+ */
+
+void
+export_syms(void)
+{
+	void *syms[] = {
+	};
+	const int func_count = sizeof(syms) / sizeof(syms[0]);
+	for (int i = 0; i < func_count; ++i)
+		((void **(*)(void))syms[i])();
+}
+
+#undef EXPORT
diff --git a/src/main.cc b/src/main.cc
index bb0794dfe..712c70bc0 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -711,6 +711,9 @@ break_loop(struct trigger *, void *)
 	return 0;
 }
 
+extern "C" void
+export_syms(void);
+
 int
 main(int argc, char **argv)
 {
@@ -808,6 +811,8 @@ main(int argc, char **argv)
 		title_set_script_name(argv[0]);
 	}
 
+	export_syms();
+
 	random_init();
 
 	crc32_init();
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 20/43] build: export third_party/PMurHash.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (11 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 02/43] cmake: remove dynamic-list linker option Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 21/43] build: export src/crc32.c symbols Vladislav Shpilevoy
                   ` (36 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/digest.lua via FFI.

Part of #2971
---
 extra/exports          |  3 ---
 src/exports.c          |  2 ++
 third_party/PMurHash.c | 11 +++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/extra/exports b/extra/exports
index 3814202f7..91703c6bb 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,9 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-PMurHash32
-PMurHash32_Process
-PMurHash32_Result
 crc32_calc
 mp_encode_double
 mp_encode_float
diff --git a/src/exports.c b/src/exports.c
index deb81e887..8b95dbae8 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -53,6 +53,7 @@ EXPORT(clock_export_syms);
 EXPORT(csv_export_syms);
 EXPORT(exception_export_syms);
 EXPORT(fiber_export_syms);
+EXPORT(PMurHash32_export_syms);
 EXPORT(port_export_syms);
 EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
@@ -72,6 +73,7 @@ export_syms(void)
 		csv_export_syms,
 		exception_export_syms,
 		fiber_export_syms,
+		PMurHash32_export_syms,
 		port_export_syms,
 		random_export_syms,
 		salad_guava_export_syms,
diff --git a/third_party/PMurHash.c b/third_party/PMurHash.c
index 017501264..316cdb426 100644
--- a/third_party/PMurHash.c
+++ b/third_party/PMurHash.c
@@ -315,3 +315,14 @@ void PMurHash32_test(const void *key, int len, uint32_t seed, void *out)
 }
 
 /*---------------------------------------------------------------------------*/
+
+void **
+PMurHash32_export_syms(void)
+{
+  static void *syms[] = {
+    (void *)PMurHash32,
+    (void *)PMurHash32_Process,
+    (void *)PMurHash32_Result,
+  };
+  return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 21/43] build: export src/crc32.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (12 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 20/43] build: export third_party/PMurHash.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 22/43] build: export src/lua/msgpack.c symbols Vladislav Shpilevoy
                   ` (35 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/lua/digest.lua via FFI.

Part of #2971
---
 extra/exports | 1 -
 src/crc32.c   | 9 +++++++++
 src/exports.c | 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 91703c6bb..edcc831b9 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,7 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-crc32_calc
 mp_encode_double
 mp_encode_float
 mp_encode_decimal
diff --git a/src/crc32.c b/src/crc32.c
index ba9dfb105..58163fd3b 100644
--- a/src/crc32.c
+++ b/src/crc32.c
@@ -48,3 +48,12 @@ crc32_init()
 	crc32_calc = &crc32c;
 #endif
 }
+
+void **
+crc32_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)&crc32_calc,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index 8b95dbae8..1f9617126 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -50,6 +50,7 @@
 
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
+EXPORT(crc32_export_syms);
 EXPORT(csv_export_syms);
 EXPORT(exception_export_syms);
 EXPORT(fiber_export_syms);
@@ -70,6 +71,7 @@ export_syms(void)
 	void *syms[] = {
 		base64_export_syms,
 		clock_export_syms,
+		crc32_export_syms,
 		csv_export_syms,
 		exception_export_syms,
 		fiber_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 22/43] build: export src/lua/msgpack.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (13 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 21/43] build: export src/crc32.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 23/43] build: export src/main.cc symbols Vladislav Shpilevoy
                   ` (34 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/msgpackffi.lua via FFI.

Part of #2971
---
 extra/exports     |  9 ---------
 src/lua/init.c    |  4 ++++
 src/lua/msgpack.c | 17 +++++++++++++++++
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/extra/exports b/extra/exports
index edcc831b9..0f068ceac 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,15 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-mp_encode_double
-mp_encode_float
-mp_encode_decimal
-mp_decode_double
-mp_decode_float
-mp_decode_extl
-mp_sizeof_decimal
-decimal_unpack
-
 tarantool_uptime
 tarantool_exit
 space_by_id
diff --git a/src/lua/init.c b/src/lua/init.c
index a004b1342..2a09b1355 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -734,6 +734,9 @@ tarantool_lua_free()
 void **
 tarantool_lua_digest_export_syms(void);
 
+void **
+tarantool_lua_msgpack_export_syms(void);
+
 void **
 tarantool_lua_socket_export_syms(void);
 
@@ -749,6 +752,7 @@ tarantool_lua_export_syms(void)
 	static void *syms[] = {
 		/* Submodules. */
 		(void *)tarantool_lua_digest_export_syms,
+		(void *)tarantool_lua_msgpack_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
 		(void *)tarantool_lua_tnt_iconv_export_syms,
 
diff --git a/src/lua/msgpack.c b/src/lua/msgpack.c
index edbc15b72..b8a853252 100644
--- a/src/lua/msgpack.c
+++ b/src/lua/msgpack.c
@@ -43,6 +43,7 @@
 
 #include "lua/decimal.h" /* lua_pushdecimal() */
 #include "lib/core/decimal.h" /* decimal_unpack() */
+#include "mp_decimal.h"
 #include "lib/core/mp_extension_types.h"
 
 #include <fiber.h>
@@ -573,3 +574,19 @@ luaopen_msgpack(lua_State *L)
 	luaL_msgpack_default = luaL_newserializer(L, "msgpack", msgpacklib);
 	return 1;
 }
+
+void **
+tarantool_lua_msgpack_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)decimal_unpack,
+		(void *)mp_encode_double,
+		(void *)mp_encode_float,
+		(void *)mp_encode_decimal,
+		(void *)mp_decode_double,
+		(void *)mp_decode_float,
+		(void *)mp_decode_extl,
+		(void *)mp_sizeof_decimal,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 23/43] build: export src/main.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (14 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 22/43] build: export src/lua/msgpack.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 24/43] build: export src/box/space.c symbols Vladislav Shpilevoy
                   ` (33 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/init.lua via FFI.

Part of #2971
---
 extra/exports |  2 --
 src/exports.c |  2 ++
 src/main.cc   | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/extra/exports b/extra/exports
index 0f068ceac..c6c656c06 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,8 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-tarantool_uptime
-tarantool_exit
 space_by_id
 space_run_triggers
 space_bsize
diff --git a/src/exports.c b/src/exports.c
index 1f9617126..cfb952b01 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -54,6 +54,7 @@ EXPORT(crc32_export_syms);
 EXPORT(csv_export_syms);
 EXPORT(exception_export_syms);
 EXPORT(fiber_export_syms);
+EXPORT(main_export_syms);
 EXPORT(PMurHash32_export_syms);
 EXPORT(port_export_syms);
 EXPORT(random_export_syms);
@@ -75,6 +76,7 @@ export_syms(void)
 		csv_export_syms,
 		exception_export_syms,
 		fiber_export_syms,
+		main_export_syms,
 		PMurHash32_export_syms,
 		port_export_syms,
 		random_export_syms,
diff --git a/src/main.cc b/src/main.cc
index 712c70bc0..53e947402 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -911,3 +911,13 @@ main(int argc, char **argv)
 	tarantool_free();
 	return exit_code;
 }
+
+extern "C" void **
+main_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)tarantool_exit,
+		(void *)tarantool_uptime,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 24/43] build: export src/box/space.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (15 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 23/43] build: export src/main.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 25/43] build: export src/box/schema.cc symbols Vladislav Shpilevoy
                   ` (32 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/box/lua/schema.lua via FFI.

Part of #2971
---
 extra/exports   |  2 --
 src/box/space.c | 10 ++++++++++
 src/exports.c   |  2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/extra/exports b/extra/exports
index c6c656c06..07788465f 100644
--- a/extra/exports
+++ b/extra/exports
@@ -8,8 +8,6 @@ ibuf_destroy
 ibuf_reserve_slow
 
 space_by_id
-space_run_triggers
-space_bsize
 box_schema_version
 
 crypto_EVP_MD_CTX_new
diff --git a/src/box/space.c b/src/box/space.c
index eecbde7fa..6dfe7ce69 100644
--- a/src/box/space.c
+++ b/src/box/space.c
@@ -773,3 +773,13 @@ generic_space_invalidate(struct space *space)
 }
 
 /* }}} */
+
+void **
+box_space_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)space_bsize,
+		(void *)space_run_triggers,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index cfb952b01..24745e16e 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_space_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(crc32_export_syms);
 EXPORT(csv_export_syms);
@@ -71,6 +72,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_space_export_syms,
 		clock_export_syms,
 		crc32_export_syms,
 		csv_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 25/43] build: export src/box/schema.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (16 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 24/43] build: export src/box/space.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 26/43] build: export src/lib/crypto/crypto.c symbols Vladislav Shpilevoy
                   ` (31 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/box/lua/schema.lua via FFI.

Part of #2971
---
 extra/exports     | 3 ---
 src/box/schema.cc | 9 +++++++++
 src/exports.c     | 2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/extra/exports b/extra/exports
index 07788465f..111dad57e 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,9 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-space_by_id
-box_schema_version
-
 crypto_EVP_MD_CTX_new
 crypto_EVP_MD_CTX_free
 crypto_HMAC_CTX_new
diff --git a/src/box/schema.cc b/src/box/schema.cc
index 456eef429..0a04b3d56 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -718,3 +718,12 @@ schema_find_name(enum schema_object_type type, uint32_t object_id)
 	return "(nil)";
 }
 
+extern "C" void **
+box_schema_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_schema_version,
+		(void *)space_by_id,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index 24745e16e..a939954c7 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(crc32_export_syms);
@@ -72,6 +73,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_schema_export_syms,
 		box_space_export_syms,
 		clock_export_syms,
 		crc32_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 26/43] build: export src/lib/crypto/crypto.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (17 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 25/43] build: export src/box/schema.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 27/43] build: export src/lua/buffer.c symbols Vladislav Shpilevoy
                   ` (30 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/crypto.lua via FFI.

Part of #2971
---
 extra/exports           | 10 ----------
 src/exports.c           |  2 ++
 src/lib/crypto/crypto.c | 17 +++++++++++++++++
 3 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/extra/exports b/extra/exports
index 111dad57e..cc7aa4f11 100644
--- a/extra/exports
+++ b/extra/exports
@@ -7,16 +7,6 @@ ibuf_reinit
 ibuf_destroy
 ibuf_reserve_slow
 
-crypto_EVP_MD_CTX_new
-crypto_EVP_MD_CTX_free
-crypto_HMAC_CTX_new
-crypto_HMAC_CTX_free
-crypto_stream_new
-crypto_stream_begin
-crypto_stream_append
-crypto_stream_commit
-crypto_stream_delete
-
 lua_static_aligned_alloc
 
 swim_is_configured
diff --git a/src/exports.c b/src/exports.c
index a939954c7..db77955ed 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -53,6 +53,7 @@ EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(crc32_export_syms);
+EXPORT(crypto_export_syms);
 EXPORT(csv_export_syms);
 EXPORT(exception_export_syms);
 EXPORT(fiber_export_syms);
@@ -77,6 +78,7 @@ export_syms(void)
 		box_space_export_syms,
 		clock_export_syms,
 		crc32_export_syms,
+		crypto_export_syms,
 		csv_export_syms,
 		exception_export_syms,
 		fiber_export_syms,
diff --git a/src/lib/crypto/crypto.c b/src/lib/crypto/crypto.c
index bbdc02836..96653356a 100644
--- a/src/lib/crypto/crypto.c
+++ b/src/lib/crypto/crypto.c
@@ -390,3 +390,20 @@ crypto_HMAC_CTX_free(HMAC_CTX *ctx)
 	HMAC_CTX_free(ctx);
 #endif
 }
+
+void **
+crypto_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)crypto_EVP_MD_CTX_free,
+		(void *)crypto_EVP_MD_CTX_new,
+		(void *)crypto_HMAC_CTX_free,
+		(void *)crypto_HMAC_CTX_new,
+		(void *)crypto_stream_append,
+		(void *)crypto_stream_begin,
+		(void *)crypto_stream_commit,
+		(void *)crypto_stream_delete,
+		(void *)crypto_stream_new,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 27/43] build: export src/lua/buffer.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (18 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 26/43] build: export src/lib/crypto/crypto.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 28/43] build: export src/lib/swim/swim.c symbols Vladislav Shpilevoy
                   ` (29 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/buffer.lua via FFI.

Part of #2971
---
 extra/exports    |  7 -------
 src/lua/buffer.c | 14 ++++++++++++++
 src/lua/init.c   |  4 ++++
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/extra/exports b/extra/exports
index cc7aa4f11..2d1d9f05e 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,13 +2,6 @@
 
 # FFI
 
-ibuf_create
-ibuf_reinit
-ibuf_destroy
-ibuf_reserve_slow
-
-lua_static_aligned_alloc
-
 swim_is_configured
 swim_cfg
 swim_set_payload
diff --git a/src/lua/buffer.c b/src/lua/buffer.c
index 5fd349261..0eb771e51 100644
--- a/src/lua/buffer.c
+++ b/src/lua/buffer.c
@@ -29,6 +29,7 @@
  * SUCH DAMAGE.
  */
 #include "small/static.h"
+#include "small/ibuf.h"
 
 /**
  * Static inline functions like in static.h can't be exported.
@@ -40,3 +41,16 @@ lua_static_aligned_alloc(size_t size, size_t alignment)
 {
 	return static_aligned_alloc(size, alignment);
 }
+
+void **
+tarantool_lua_buffer_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)ibuf_create,
+		(void *)ibuf_reinit,
+		(void *)ibuf_destroy,
+		(void *)ibuf_reserve_slow,
+		(void *)lua_static_aligned_alloc,
+	};
+	return syms;
+}
diff --git a/src/lua/init.c b/src/lua/init.c
index 2a09b1355..65c1a04ec 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -731,6 +731,9 @@ tarantool_lua_free()
 #endif
 }
 
+void **
+tarantool_lua_buffer_export_syms(void);
+
 void **
 tarantool_lua_digest_export_syms(void);
 
@@ -751,6 +754,7 @@ tarantool_lua_export_syms(void)
 {
 	static void *syms[] = {
 		/* Submodules. */
+		(void *)tarantool_lua_buffer_export_syms,
 		(void *)tarantool_lua_digest_export_syms,
 		(void *)tarantool_lua_msgpack_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 28/43] build: export src/lib/swim/swim.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (19 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 27/43] build: export src/lua/buffer.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 29/43] build: export src/lib/core/fiber_cond.c symbols Vladislav Shpilevoy
                   ` (28 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/swim.lua via FFI.

Part of #2971
---
 extra/exports       | 27 ---------------------------
 src/exports.c       |  2 ++
 src/lib/swim/swim.c | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/extra/exports b/extra/exports
index 2d1d9f05e..71dc6c3b7 100644
--- a/extra/exports
+++ b/extra/exports
@@ -1,32 +1,5 @@
 # Symbols exported by the main Tarantool executable
 
-# FFI
-
-swim_is_configured
-swim_cfg
-swim_set_payload
-swim_set_codec
-swim_add_member
-swim_remove_member
-swim_probe_member
-swim_broadcast
-swim_size
-swim_quit
-swim_self
-swim_member_by_uuid
-swim_member_status
-swim_iterator_open
-swim_iterator_next
-swim_iterator_close
-swim_member_uri
-swim_member_uuid
-swim_member_incarnation
-swim_member_payload
-swim_member_ref
-swim_member_unref
-swim_member_is_dropped
-swim_member_is_payload_up_to_date
-
 # Module API
 
 fiber_cond_new
diff --git a/src/exports.c b/src/exports.c
index db77955ed..388f21341 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -64,6 +64,7 @@ EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
 EXPORT(say_export_syms);
 EXPORT(scramble_export_syms);
+EXPORT(swim_export_syms);
 EXPORT(tarantool_lua_export_syms);
 EXPORT(title_export_syms);
 EXPORT(tt_uuid_export_syms);
@@ -89,6 +90,7 @@ export_syms(void)
 		salad_guava_export_syms,
 		say_export_syms,
 		scramble_export_syms,
+		swim_export_syms,
 		tarantool_lua_export_syms,
 		title_export_syms,
 		tt_uuid_export_syms,
diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 9a7b4ce85..21f241e81 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -2421,3 +2421,35 @@ swim_member_is_payload_up_to_date(const struct swim_member *member)
 {
 	return member->is_payload_up_to_date;
 }
+
+void **
+swim_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)swim_add_member,
+		(void *)swim_broadcast,
+		(void *)swim_cfg,
+		(void *)swim_is_configured,
+		(void *)swim_iterator_close,
+		(void *)swim_iterator_next,
+		(void *)swim_iterator_open,
+		(void *)swim_member_by_uuid,
+		(void *)swim_member_incarnation,
+		(void *)swim_member_is_dropped,
+		(void *)swim_member_is_payload_up_to_date,
+		(void *)swim_member_payload,
+		(void *)swim_member_ref,
+		(void *)swim_member_status,
+		(void *)swim_member_unref,
+		(void *)swim_member_uri,
+		(void *)swim_member_uuid,
+		(void *)swim_probe_member,
+		(void *)swim_quit,
+		(void *)swim_remove_member,
+		(void *)swim_self,
+		(void *)swim_set_codec,
+		(void *)swim_set_payload,
+		(void *)swim_size,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 29/43] build: export src/lib/core/fiber_cond.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (20 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 28/43] build: export src/lib/swim/swim.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 03/43] build: export src/lib/core/clock.c symbols Vladislav Shpilevoy
                   ` (27 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by the public C API.

Part of #2971
---
 extra/exports             |  6 ------
 src/exports.c             |  2 ++
 src/lib/core/fiber_cond.c | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/extra/exports b/extra/exports
index 71dc6c3b7..8542c85b0 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,12 +2,6 @@
 
 # Module API
 
-fiber_cond_new
-fiber_cond_delete
-fiber_cond_signal
-fiber_cond_broadcast
-fiber_cond_wait_timeout
-fiber_cond_wait
 coio_wait
 coio_close
 coio_call
diff --git a/src/exports.c b/src/exports.c
index 388f21341..eda05b094 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -56,6 +56,7 @@ EXPORT(crc32_export_syms);
 EXPORT(crypto_export_syms);
 EXPORT(csv_export_syms);
 EXPORT(exception_export_syms);
+EXPORT(fiber_cond_export_syms);
 EXPORT(fiber_export_syms);
 EXPORT(main_export_syms);
 EXPORT(PMurHash32_export_syms);
@@ -82,6 +83,7 @@ export_syms(void)
 		crypto_export_syms,
 		csv_export_syms,
 		exception_export_syms,
+		fiber_cond_export_syms,
 		fiber_export_syms,
 		main_export_syms,
 		PMurHash32_export_syms,
diff --git a/src/lib/core/fiber_cond.c b/src/lib/core/fiber_cond.c
index 4998d6494..95c57286d 100644
--- a/src/lib/core/fiber_cond.c
+++ b/src/lib/core/fiber_cond.c
@@ -123,3 +123,17 @@ fiber_cond_wait_deadline(struct fiber_cond *c, double deadline)
 	double timeout = deadline - ev_monotonic_now(loop());
 	return fiber_cond_wait_timeout(c, timeout);
 }
+
+void **
+fiber_cond_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)fiber_cond_broadcast,
+		(void *)fiber_cond_delete,
+		(void *)fiber_cond_new,
+		(void *)fiber_cond_signal,
+		(void *)fiber_cond_wait,
+		(void *)fiber_cond_wait_timeout,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 03/43] build: export src/lib/core/clock.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (21 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 29/43] build: export src/lib/core/fiber_cond.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 30/43] build: export src/lib/core/coio.cc symbols Vladislav Shpilevoy
                   ` (26 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/clock.lua via FFI.

Part of #2971
---
 extra/exports        |  8 --------
 src/exports.c        |  3 +++
 src/lib/core/clock.c | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/extra/exports b/extra/exports
index 9323996c1..6e6b5afd9 100644
--- a/extra/exports
+++ b/extra/exports
@@ -240,14 +240,6 @@ box_latch_delete
 box_latch_lock
 box_latch_trylock
 box_latch_unlock
-clock_realtime
-clock_monotonic
-clock_process
-clock_thread
-clock_realtime64
-clock_monotonic64
-clock_process64
-clock_thread64
 string_strip_helper
 
 # Lua / LuaJIT
diff --git a/src/exports.c b/src/exports.c
index 4bb423a57..378ebfb42 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -48,10 +48,13 @@
  * Add new exporters here. Keep them in alphabetical order.
  */
 
+EXPORT(clock_export_syms);
+
 void
 export_syms(void)
 {
 	void *syms[] = {
+		clock_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/lib/core/clock.c b/src/lib/core/clock.c
index ff3058485..72ba5c5d9 100644
--- a/src/lib/core/clock.c
+++ b/src/lib/core/clock.c
@@ -108,3 +108,19 @@ clock_thread64(void)
 	return (uint64_t) clock() * 1000000000 / CLOCKS_PER_SEC;
 #endif
 }
+
+void **
+clock_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)clock_realtime,
+		(void *)clock_monotonic,
+		(void *)clock_process,
+		(void *)clock_thread,
+		(void *)clock_realtime64,
+		(void *)clock_monotonic64,
+		(void *)clock_process64,
+		(void *)clock_thread64,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 30/43] build: export src/lib/core/coio.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (22 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 03/43] build: export src/lib/core/clock.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 31/43] build: export src/lua/utils.c symbols Vladislav Shpilevoy
                   ` (25 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API.

Part of #2971
---
 extra/exports        |  4 ----
 src/exports.c        |  2 ++
 src/lib/core/coio.cc | 12 ++++++++++++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/extra/exports b/extra/exports
index 8542c85b0..cd28bb221 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,10 +2,6 @@
 
 # Module API
 
-coio_wait
-coio_close
-coio_call
-coio_getaddrinfo
 luaL_pushcdata
 luaL_checkcdata
 luaL_setcdatagc
diff --git a/src/exports.c b/src/exports.c
index eda05b094..f0b3d667f 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -52,6 +52,7 @@ EXPORT(base64_export_syms);
 EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
 EXPORT(clock_export_syms);
+EXPORT(coio_export_syms);
 EXPORT(crc32_export_syms);
 EXPORT(crypto_export_syms);
 EXPORT(csv_export_syms);
@@ -79,6 +80,7 @@ export_syms(void)
 		box_schema_export_syms,
 		box_space_export_syms,
 		clock_export_syms,
+		coio_export_syms,
 		crc32_export_syms,
 		crypto_export_syms,
 		csv_export_syms,
diff --git a/src/lib/core/coio.cc b/src/lib/core/coio.cc
index 6a113aa47..bd9154694 100644
--- a/src/lib/core/coio.cc
+++ b/src/lib/core/coio.cc
@@ -806,3 +806,15 @@ coio_write_fd_timeout(int fd, const void *data, size_t size, ev_tstamp timeout)
 	}
 	return 0;
 }
+
+extern "C" void **
+coio_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)coio_call,
+		(void *)coio_close,
+		(void *)coio_getaddrinfo,
+		(void *)coio_wait,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 31/43] build: export src/lua/utils.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (23 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 30/43] build: export src/lib/core/coio.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 32/43] build: export src/box/lua/tuple.c symbols Vladislav Shpilevoy
                   ` (24 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API.

Part of #2971
---
 extra/exports   | 16 ----------------
 src/lua/init.c  |  4 ++++
 src/lua/utils.c | 24 ++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/extra/exports b/extra/exports
index cd28bb221..8a676e18b 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,26 +2,10 @@
 
 # Module API
 
-luaL_pushcdata
-luaL_checkcdata
-luaL_setcdatagc
-luaL_ctypeid
-luaL_cdef
-luaL_pushuint64
-luaL_pushint64
-luaL_checkuint64
-luaL_checkint64
-luaL_touint64
-luaL_toint64
 luaT_checktuple
 luaT_pushtuple
 luaT_istuple
 luaT_error
-luaT_call
-luaT_cpcall
-luaT_state
-luaT_tolstring
-luaL_iscallable
 box_txn
 box_txn_begin
 box_txn_commit
diff --git a/src/lua/init.c b/src/lua/init.c
index 65c1a04ec..6204961ba 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -746,6 +746,9 @@ tarantool_lua_socket_export_syms(void);
 void **
 tarantool_lua_tnt_iconv_export_syms(void);
 
+void **
+tarantool_lua_utils_export_syms(void);
+
 /**
  * Aggregator of all symbols defined in src/lua.
  */
@@ -759,6 +762,7 @@ tarantool_lua_export_syms(void)
 		(void *)tarantool_lua_msgpack_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
 		(void *)tarantool_lua_tnt_iconv_export_syms,
+		(void *)tarantool_lua_utils_export_syms,
 
 		/* Own symbols. */
 		(void *)tarantool_lua_slab_cache,
diff --git a/src/lua/utils.c b/src/lua/utils.c
index 54d18ac89..e99ddd71a 100644
--- a/src/lua/utils.c
+++ b/src/lua/utils.c
@@ -1288,3 +1288,27 @@ tarantool_lua_utils_init(struct lua_State *L)
 	assert(CTID_CONST_CHAR_PTR != 0);
 	return 0;
 }
+
+void **
+tarantool_lua_utils_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)luaL_cdef,
+		(void *)luaL_checkcdata,
+		(void *)luaL_checkint64,
+		(void *)luaL_checkuint64,
+		(void *)luaL_ctypeid,
+		(void *)luaL_iscallable,
+		(void *)luaL_pushcdata,
+		(void *)luaL_pushint64,
+		(void *)luaL_pushuint64,
+		(void *)luaL_setcdatagc,
+		(void *)luaL_toint64,
+		(void *)luaL_touint64,
+		(void *)luaT_call,
+		(void *)luaT_cpcall,
+		(void *)luaT_state,
+		(void *)luaT_tolstring,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 32/43] build: export src/box/lua/tuple.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (24 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 31/43] build: export src/lua/utils.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 33/43] build: export src/lua/error.c symbols Vladislav Shpilevoy
                   ` (23 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API.

Part of #2971
---
 extra/exports       |  3 ---
 src/box/lua/init.c  | 12 ++++++++++++
 src/box/lua/tuple.c | 11 +++++++++++
 src/exports.c       |  2 ++
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/extra/exports b/extra/exports
index 8a676e18b..30dbb63ff 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,9 +2,6 @@
 
 # Module API
 
-luaT_checktuple
-luaT_pushtuple
-luaT_istuple
 luaT_error
 box_txn
 box_txn_begin
diff --git a/src/box/lua/init.c b/src/box/lua/init.c
index 63e8b8216..fb35ea56c 100644
--- a/src/box/lua/init.c
+++ b/src/box/lua/init.c
@@ -441,3 +441,15 @@ box_lua_init(struct lua_State *L)
 
 	assert(lua_gettop(L) == 0);
 }
+
+void **
+box_lua_tuple_export_syms(void);
+
+void **
+box_lua_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_lua_tuple_export_syms,
+	};
+	return syms;
+}
diff --git a/src/box/lua/tuple.c b/src/box/lua/tuple.c
index 1e3c3d65c..957d68014 100644
--- a/src/box/lua/tuple.c
+++ b/src/box/lua/tuple.c
@@ -597,3 +597,14 @@ box_lua_tuple_init(struct lua_State *L)
 	CTID_STRUCT_TUPLE_REF = luaL_ctypeid(L, "struct tuple &");
 	assert(CTID_STRUCT_TUPLE_REF != 0);
 }
+
+void **
+box_lua_tuple_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)luaT_checktuple,
+		(void *)luaT_istuple,
+		(void *)luaT_pushtuple,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index f0b3d667f..cd409fae5 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_lua_export_syms);
 EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
 EXPORT(clock_export_syms);
@@ -77,6 +78,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_lua_export_syms,
 		box_schema_export_syms,
 		box_space_export_syms,
 		clock_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 33/43] build: export src/lua/error.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (25 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 32/43] build: export src/box/lua/tuple.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 34/43] build: export src/box/txn.c symbols Vladislav Shpilevoy
                   ` (22 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by the public C API.

Part of #2971
---
 extra/exports   | 1 -
 src/lua/error.c | 9 +++++++++
 src/lua/init.c  | 4 ++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 30dbb63ff..1e7a1a49f 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # Module API
 
-luaT_error
 box_txn
 box_txn_begin
 box_txn_commit
diff --git a/src/lua/error.c b/src/lua/error.c
index 18a990a88..e3e9c6c9a 100644
--- a/src/lua/error.c
+++ b/src/lua/error.c
@@ -124,3 +124,12 @@ tarantool_lua_error_init(struct lua_State *L)
 	CTID_CONST_STRUCT_ERROR_REF = luaL_ctypeid(L, "const struct error &");
 	assert(CTID_CONST_STRUCT_ERROR_REF != 0);
 }
+
+void **
+tarantool_lua_error_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)luaT_error,
+	};
+	return syms;
+}
diff --git a/src/lua/init.c b/src/lua/init.c
index 6204961ba..daa685f57 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -737,6 +737,9 @@ tarantool_lua_buffer_export_syms(void);
 void **
 tarantool_lua_digest_export_syms(void);
 
+void **
+tarantool_lua_error_export_syms(void);
+
 void **
 tarantool_lua_msgpack_export_syms(void);
 
@@ -759,6 +762,7 @@ tarantool_lua_export_syms(void)
 		/* Submodules. */
 		(void *)tarantool_lua_buffer_export_syms,
 		(void *)tarantool_lua_digest_export_syms,
+		(void *)tarantool_lua_error_export_syms,
 		(void *)tarantool_lua_msgpack_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
 		(void *)tarantool_lua_tnt_iconv_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 34/43] build: export src/box/txn.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (26 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 33/43] build: export src/lua/error.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 35/43] build: export src/box/key_def.c symbols Vladislav Shpilevoy
                   ` (21 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API and used by
src/box/lua/schema.lua via FFI.

Part of #2971
---
 extra/exports |  8 --------
 src/box/txn.c | 16 ++++++++++++++++
 src/exports.c |  2 ++
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/extra/exports b/extra/exports
index 1e7a1a49f..515887bcb 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,14 +2,6 @@
 
 # Module API
 
-box_txn
-box_txn_begin
-box_txn_commit
-box_txn_savepoint
-box_txn_rollback
-box_txn_rollback_to_savepoint
-box_txn_alloc
-box_txn_id
 box_key_def_new
 box_key_def_delete
 box_tuple_format_default
diff --git a/src/box/txn.c b/src/box/txn.c
index 488aa4bdd..3e2b8cab1 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -941,3 +941,19 @@ txn_on_yield(struct trigger *trigger, void *event)
 	txn_set_flag(txn, TXN_IS_ABORTED_BY_YIELD);
 	return 0;
 }
+
+void **
+box_txn_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_txn,
+		(void *)box_txn_alloc,
+		(void *)box_txn_begin,
+		(void *)box_txn_commit,
+		(void *)box_txn_id,
+		(void *)box_txn_rollback,
+		(void *)box_txn_rollback_to_savepoint,
+		(void *)box_txn_savepoint,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index cd409fae5..bb55ab7fa 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -52,6 +52,7 @@ EXPORT(base64_export_syms);
 EXPORT(box_lua_export_syms);
 EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
+EXPORT(box_txn_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(coio_export_syms);
 EXPORT(crc32_export_syms);
@@ -81,6 +82,7 @@ export_syms(void)
 		box_lua_export_syms,
 		box_schema_export_syms,
 		box_space_export_syms,
+		box_txn_export_syms,
 		clock_export_syms,
 		coio_export_syms,
 		crc32_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 35/43] build: export src/box/key_def.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (27 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 34/43] build: export src/box/txn.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 36/43] build: export src/box/tuple.c symbols Vladislav Shpilevoy
                   ` (20 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API.

Part of #2971
---
 extra/exports     |  4 ----
 src/box/key_def.c | 12 ++++++++++++
 src/exports.c     |  2 ++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/extra/exports b/extra/exports
index 515887bcb..ab26a865a 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,8 +2,6 @@
 
 # Module API
 
-box_key_def_new
-box_key_def_delete
 box_tuple_format_default
 box_tuple_new
 box_tuple_ref
@@ -25,8 +23,6 @@ box_tuple_next
 box_tuple_update
 box_tuple_upsert
 box_tuple_extract_key
-box_tuple_compare
-box_tuple_compare_with_key
 box_return_tuple
 box_space_id_by_name
 box_index_id_by_name
diff --git a/src/box/key_def.c b/src/box/key_def.c
index 3e3782163..09e419c30 100644
--- a/src/box/key_def.c
+++ b/src/box/key_def.c
@@ -891,3 +891,15 @@ key_validate_parts(const struct key_def *key_def, const char *key,
 	*key_end = key;
 	return 0;
 }
+
+void **
+box_key_def_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_key_def_delete,
+		(void *)box_key_def_new,
+		(void *)box_tuple_compare,
+		(void *)box_tuple_compare_with_key,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index bb55ab7fa..0f9a470e6 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_key_def_export_syms);
 EXPORT(box_lua_export_syms);
 EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
@@ -79,6 +80,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_key_def_export_syms,
 		box_lua_export_syms,
 		box_schema_export_syms,
 		box_space_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 36/43] build: export src/box/tuple.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (28 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 35/43] build: export src/box/key_def.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 37/43] build: export src/box/index.cc symbols Vladislav Shpilevoy
                   ` (19 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API and used by
src/box/tuple.lua via FFI.

Part of #2971
---
 extra/exports   | 20 --------------------
 src/box/tuple.c | 28 ++++++++++++++++++++++++++++
 src/exports.c   |  2 ++
 3 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/extra/exports b/extra/exports
index ab26a865a..ba8eb3039 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,26 +2,6 @@
 
 # Module API
 
-box_tuple_format_default
-box_tuple_new
-box_tuple_ref
-box_tuple_unref
-box_tuple_field_count
-box_tuple_bsize
-box_tuple_to_buf
-box_tuple_format
-box_tuple_format_new
-box_tuple_format_ref
-box_tuple_format_unref
-box_tuple_field
-box_tuple_iterator
-box_tuple_iterator_free
-box_tuple_position
-box_tuple_rewind
-box_tuple_seek
-box_tuple_next
-box_tuple_update
-box_tuple_upsert
 box_tuple_extract_key
 box_return_tuple
 box_space_id_by_name
diff --git a/src/box/tuple.c b/src/box/tuple.c
index 1f52a8cff..1a0ffe5ed 100644
--- a/src/box/tuple.c
+++ b/src/box/tuple.c
@@ -767,3 +767,31 @@ mp_str(const char *data)
 		return "<failed to format message pack>";
 	return buf;
 }
+
+void **
+box_tuple_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_tuple_format,
+		(void *)box_tuple_format_default,
+		(void *)box_tuple_format_new,
+		(void *)box_tuple_format_ref,
+		(void *)box_tuple_format_unref,
+		(void *)box_tuple_bsize,
+		(void *)box_tuple_field,
+		(void *)box_tuple_field_count,
+		(void *)box_tuple_iterator,
+		(void *)box_tuple_iterator_free,
+		(void *)box_tuple_new,
+		(void *)box_tuple_next,
+		(void *)box_tuple_position,
+		(void *)box_tuple_ref,
+		(void *)box_tuple_rewind,
+		(void *)box_tuple_seek,
+		(void *)box_tuple_to_buf,
+		(void *)box_tuple_unref,
+		(void *)box_tuple_update,
+		(void *)box_tuple_upsert,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index 0f9a470e6..400d6a658 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -53,6 +53,7 @@ EXPORT(box_key_def_export_syms);
 EXPORT(box_lua_export_syms);
 EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
+EXPORT(box_tuple_export_syms);
 EXPORT(box_txn_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(coio_export_syms);
@@ -84,6 +85,7 @@ export_syms(void)
 		box_lua_export_syms,
 		box_schema_export_syms,
 		box_space_export_syms,
+		box_tuple_export_syms,
 		box_txn_export_syms,
 		clock_export_syms,
 		coio_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 37/43] build: export src/box/index.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (29 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 36/43] build: export src/box/tuple.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 38/43] build: export src/box/box.cc symbols Vladislav Shpilevoy
                   ` (18 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function visible to the public C API.

Part of #2971
---
 extra/exports    | 11 -----------
 src/box/index.cc | 19 +++++++++++++++++++
 src/exports.c    |  2 ++
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/extra/exports b/extra/exports
index ba8eb3039..51420a322 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # Module API
 
-box_tuple_extract_key
 box_return_tuple
 box_space_id_by_name
 box_index_id_by_name
@@ -17,16 +16,6 @@ box_sequence_next
 box_sequence_current
 box_sequence_set
 box_sequence_reset
-box_index_iterator
-box_iterator_next
-box_iterator_free
-box_index_len
-box_index_bsize
-box_index_random
-box_index_get
-box_index_min
-box_index_max
-box_index_count
 box_error_type
 box_error_code
 box_error_message
diff --git a/src/box/index.cc b/src/box/index.cc
index c2fc00867..bd45d0c57 100644
--- a/src/box/index.cc
+++ b/src/box/index.cc
@@ -767,3 +767,22 @@ disabled_index_replace(struct index *index, struct tuple *old_tuple,
 }
 
 /* }}} */
+
+extern "C" void **
+box_index_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_index_bsize,
+		(void *)box_index_count,
+		(void *)box_index_get,
+		(void *)box_index_iterator,
+		(void *)box_index_len,
+		(void *)box_index_max,
+		(void *)box_index_min,
+		(void *)box_index_random,
+		(void *)box_iterator_next,
+		(void *)box_iterator_free,
+		(void *)box_tuple_extract_key,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index 400d6a658..7fc38f642 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_index_export_syms);
 EXPORT(box_key_def_export_syms);
 EXPORT(box_lua_export_syms);
 EXPORT(box_schema_export_syms);
@@ -81,6 +82,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_index_export_syms,
 		box_key_def_export_syms,
 		box_lua_export_syms,
 		box_schema_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 38/43] build: export src/box/box.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (30 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 37/43] build: export src/box/index.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 39/43] build: export src/box/error.cc symbols Vladislav Shpilevoy
                   ` (17 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API and used by
src/box/lua/schema.lua via FFI.

It is worth mentioning why box_export_syms() does not aggregate
all the other box_*_export_syms(). This is because there is a
broken dependency between main.cc and 'box' static lib.

'box' uses functions 'tarantool_uptime()' and 'load_cfg()', which
are defined in main.cc. When box_export_syms() tries to aggregate
symbols from its submodules, this break explodes. And its fix is
not as a trival as it seems, so it is postponed.

Part of #2971
---
 extra/exports  | 14 --------------
 src/box/box.cc | 22 ++++++++++++++++++++++
 src/exports.c  |  2 ++
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/extra/exports b/extra/exports
index 51420a322..81c92f503 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,20 +2,6 @@
 
 # Module API
 
-box_return_tuple
-box_space_id_by_name
-box_index_id_by_name
-box_select
-box_insert
-box_replace
-box_delete
-box_update
-box_upsert
-box_truncate
-box_sequence_next
-box_sequence_current
-box_sequence_set
-box_sequence_reset
 box_error_type
 box_error_code
 box_error_message
diff --git a/src/box/box.cc b/src/box/box.cc
index 0c15ba5e9..c8c78b3ce 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -2544,3 +2544,25 @@ box_reset_stat(void)
 	engine_reset_stat();
 	space_foreach(box_reset_space_stat, NULL);
 }
+
+extern "C" void **
+box_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_delete,
+		(void *)box_index_id_by_name,
+		(void *)box_insert,
+		(void *)box_replace,
+		(void *)box_return_tuple,
+		(void *)box_select,
+		(void *)box_sequence_current,
+		(void *)box_sequence_next,
+		(void *)box_sequence_reset,
+		(void *)box_sequence_set,
+		(void *)box_space_id_by_name,
+		(void *)box_truncate,
+		(void *)box_update,
+		(void *)box_upsert,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index 7fc38f642..109398bf1 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_export_syms);
 EXPORT(box_index_export_syms);
 EXPORT(box_key_def_export_syms);
 EXPORT(box_lua_export_syms);
@@ -82,6 +83,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_export_syms,
 		box_index_export_syms,
 		box_key_def_export_syms,
 		box_lua_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 39/43] build: export src/box/error.cc symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (31 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 38/43] build: export src/box/box.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 04/43] build: export src/scramble.c symbols Vladislav Shpilevoy
                   ` (16 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API.

Part of #2971
---
 extra/exports    |  6 ------
 src/box/error.cc | 14 ++++++++++++++
 src/exports.c    |  2 ++
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/extra/exports b/extra/exports
index 81c92f503..1503c989a 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,12 +2,6 @@
 
 # Module API
 
-box_error_type
-box_error_code
-box_error_message
-box_error_last
-box_error_clear
-box_error_set
 error_set_prev
 box_latch_new
 box_latch_delete
diff --git a/src/box/error.cc b/src/box/error.cc
index 233b312a2..3061b4df6 100644
--- a/src/box/error.cc
+++ b/src/box/error.cc
@@ -290,3 +290,17 @@ BuildAccessDeniedError(const char *file, unsigned int line,
 		return e;
 	}
 }
+
+extern "C" void **
+box_error_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_error_clear,
+		(void *)box_error_code,
+		(void *)box_error_last,
+		(void *)box_error_message,
+		(void *)box_error_set,
+		(void *)box_error_type,
+	};
+	return syms;
+}
diff --git a/src/exports.c b/src/exports.c
index 109398bf1..1794471c8 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,6 +49,7 @@
  */
 
 EXPORT(base64_export_syms);
+EXPORT(box_error_export_syms);
 EXPORT(box_export_syms);
 EXPORT(box_index_export_syms);
 EXPORT(box_key_def_export_syms);
@@ -83,6 +84,7 @@ export_syms(void)
 {
 	void *syms[] = {
 		base64_export_syms,
+		box_error_export_syms,
 		box_export_syms,
 		box_index_export_syms,
 		box_key_def_export_syms,
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 04/43] build: export src/scramble.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (32 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 39/43] build: export src/box/error.cc symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 40/43] build: export src/lib/core/diag.c symbols Vladislav Shpilevoy
                   ` (15 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/box/lua/schema.lua via FFI.

Part of #2971
---
 extra/exports  | 1 -
 src/exports.c  | 2 ++
 src/scramble.c | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 6e6b5afd9..d81b4c05c 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # FFI
 
-password_prepare
 lbox_socket_local_resolve
 lbox_socket_nonblock
 base64_decode
diff --git a/src/exports.c b/src/exports.c
index 378ebfb42..2638bcd47 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -49,12 +49,14 @@
  */
 
 EXPORT(clock_export_syms);
+EXPORT(scramble_export_syms);
 
 void
 export_syms(void)
 {
 	void *syms[] = {
 		clock_export_syms,
+		scramble_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/scramble.c b/src/scramble.c
index b7a586eeb..7f962e387 100644
--- a/src/scramble.c
+++ b/src/scramble.c
@@ -129,3 +129,12 @@ password_prepare(const char *password, int len, char *out, int out_len)
 
 	base64_encode((char *) hash2, SCRAMBLE_SIZE, out, out_len, 0);
 }
+
+void **
+scramble_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)password_prepare,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 40/43] build: export src/lib/core/diag.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (33 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 04/43] build: export src/scramble.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 41/43] build: export src/lib/core/latch.c symbols Vladislav Shpilevoy
                   ` (14 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/lua/error.lua via FFI.

Part of #2971
---
 extra/exports       | 1 -
 src/exports.c       | 2 ++
 src/lib/core/diag.c | 8 ++++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 1503c989a..809e0e07f 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # Module API
 
-error_set_prev
 box_latch_new
 box_latch_delete
 box_latch_lock
diff --git a/src/exports.c b/src/exports.c
index 1794471c8..a62c89b14 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -63,6 +63,7 @@ EXPORT(coio_export_syms);
 EXPORT(crc32_export_syms);
 EXPORT(crypto_export_syms);
 EXPORT(csv_export_syms);
+EXPORT(diag_export_syms);
 EXPORT(exception_export_syms);
 EXPORT(fiber_cond_export_syms);
 EXPORT(fiber_export_syms);
@@ -98,6 +99,7 @@ export_syms(void)
 		crc32_export_syms,
 		crypto_export_syms,
 		csv_export_syms,
+		diag_export_syms,
 		exception_export_syms,
 		fiber_cond_export_syms,
 		fiber_export_syms,
diff --git a/src/lib/core/diag.c b/src/lib/core/diag.c
index e143db18d..8b2db8c02 100644
--- a/src/lib/core/diag.c
+++ b/src/lib/core/diag.c
@@ -120,3 +120,11 @@ error_vformat_msg(struct error *e, const char *format, va_list ap)
 	vsnprintf(e->errmsg, sizeof(e->errmsg), format, ap);
 }
 
+void **
+diag_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)error_set_prev,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 41/43] build: export src/lib/core/latch.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (34 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 40/43] build: export src/lib/core/diag.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 42/43] build: export src/lua/string.c symbols Vladislav Shpilevoy
                   ` (13 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions visible to the public C API.

Part of #2971
---
 extra/exports        |  5 -----
 src/exports.c        |  2 ++
 src/lib/core/latch.c | 13 +++++++++++++
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/extra/exports b/extra/exports
index 809e0e07f..5db526d2c 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,11 +2,6 @@
 
 # Module API
 
-box_latch_new
-box_latch_delete
-box_latch_lock
-box_latch_trylock
-box_latch_unlock
 string_strip_helper
 
 # Lua / LuaJIT
diff --git a/src/exports.c b/src/exports.c
index a62c89b14..de1892026 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -53,6 +53,7 @@ EXPORT(box_error_export_syms);
 EXPORT(box_export_syms);
 EXPORT(box_index_export_syms);
 EXPORT(box_key_def_export_syms);
+EXPORT(box_latch_export_syms);
 EXPORT(box_lua_export_syms);
 EXPORT(box_schema_export_syms);
 EXPORT(box_space_export_syms);
@@ -89,6 +90,7 @@ export_syms(void)
 		box_export_syms,
 		box_index_export_syms,
 		box_key_def_export_syms,
+		box_latch_export_syms,
 		box_lua_export_syms,
 		box_schema_export_syms,
 		box_space_export_syms,
diff --git a/src/lib/core/latch.c b/src/lib/core/latch.c
index cc7120ef4..9b94a0b05 100644
--- a/src/lib/core/latch.c
+++ b/src/lib/core/latch.c
@@ -70,3 +70,16 @@ box_latch_unlock(box_latch_t* bl)
 {
 	latch_unlock(&bl->l);
 }
+
+void **
+box_latch_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)box_latch_delete,
+		(void *)box_latch_lock,
+		(void *)box_latch_new,
+		(void *)box_latch_trylock,
+		(void *)box_latch_unlock,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 42/43] build: export src/lua/string.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (35 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 41/43] build: export src/lib/core/latch.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 43/43] build: export public Lua symbols Vladislav Shpilevoy
                   ` (12 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/lua/string.lua via FFI.

Part of #2971
---
 extra/exports    | 4 ----
 src/lua/init.c   | 4 ++++
 src/lua/string.c | 9 +++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/extra/exports b/extra/exports
index 5db526d2c..2341b0861 100644
--- a/extra/exports
+++ b/extra/exports
@@ -1,9 +1,5 @@
 # Symbols exported by the main Tarantool executable
 
-# Module API
-
-string_strip_helper
-
 # Lua / LuaJIT
 
 lua_newstate
diff --git a/src/lua/init.c b/src/lua/init.c
index daa685f57..f115bd2c9 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -746,6 +746,9 @@ tarantool_lua_msgpack_export_syms(void);
 void **
 tarantool_lua_socket_export_syms(void);
 
+void **
+tarantool_lua_string_export_syms(void);
+
 void **
 tarantool_lua_tnt_iconv_export_syms(void);
 
@@ -766,6 +769,7 @@ tarantool_lua_export_syms(void)
 		(void *)tarantool_lua_msgpack_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
 		(void *)tarantool_lua_tnt_iconv_export_syms,
+		(void *)tarantool_lua_string_export_syms,
 		(void *)tarantool_lua_utils_export_syms,
 
 		/* Own symbols. */
diff --git a/src/lua/string.c b/src/lua/string.c
index c140299ff..d265697ea 100644
--- a/src/lua/string.c
+++ b/src/lua/string.c
@@ -115,3 +115,12 @@ string_strip_helper(const char *inp, size_t inp_len, const char *chars,
 
 	*newlen = inp_len - skipped;
 }
+
+void **
+tarantool_lua_string_export_syms(void)
+{
+	static void *syms[] = {
+		string_strip_helper,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 43/43] build: export public Lua symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (36 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 42/43] build: export src/lua/string.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 05/43] build: export src/lua/socket.c symbols Vladislav Shpilevoy
                   ` (11 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions which may be used by dynamic C modules via
public Lua C API and via Tarantool public C API.

Closes #2971
---
 extra/exports                               | 148 -------------------
 src/lua/init.c                              | 153 ++++++++++++++++++++
 test/box/gh-2971-symbol-visibility.result   |  22 +++
 test/box/gh-2971-symbol-visibility.test.lua |  14 ++
 4 files changed, 189 insertions(+), 148 deletions(-)
 delete mode 100644 extra/exports
 create mode 100644 test/box/gh-2971-symbol-visibility.result
 create mode 100644 test/box/gh-2971-symbol-visibility.test.lua

diff --git a/extra/exports b/extra/exports
deleted file mode 100644
index 2341b0861..000000000
--- a/extra/exports
+++ /dev/null
@@ -1,148 +0,0 @@
-# Symbols exported by the main Tarantool executable
-
-# Lua / LuaJIT
-
-lua_newstate
-lua_close
-lua_newthread
-lua_atpanic
-lua_gettop
-lua_settop
-lua_pushvalue
-lua_remove
-lua_insert
-lua_replace
-lua_checkstack
-lua_xmove
-lua_isnumber
-lua_isstring
-lua_iscfunction
-lua_isuserdata
-lua_type
-lua_typename
-lua_equal
-lua_rawequal
-lua_lessthan
-lua_tonumber
-lua_tointeger
-lua_toboolean
-lua_tolstring
-lua_objlen
-lua_tocfunction
-lua_touserdata
-lua_tothread
-lua_topointer
-lua_pushnil
-lua_pushnumber
-lua_pushinteger
-lua_pushlstring
-lua_pushstring
-lua_pushvfstring
-lua_pushfstring
-lua_pushcclosure
-lua_pushboolean
-lua_pushlightuserdata
-lua_pushthread
-lua_gettable
-lua_getfield
-lua_rawget
-lua_rawgeti
-lua_createtable
-lua_newuserdata
-lua_getmetatable
-lua_getfenv
-lua_settable
-lua_setfield
-lua_rawset
-lua_rawseti
-lua_setmetatable
-lua_setfenv
-lua_call
-lua_pcall
-lua_cpcall
-lua_load
-lua_dump
-lua_yield
-lua_resume
-lua_status
-lua_gc
-lua_error
-lua_next
-lua_concat
-lua_getallocf
-lua_setallocf
-lua_getstack
-lua_getinfo
-lua_getlocal
-lua_setlocal
-lua_getupvalue
-lua_setupvalue
-lua_sethook
-lua_gethook
-lua_gethookmask
-lua_gethookcount
-lua_upvalueid
-lua_upvaluejoin
-lua_loadx
-
-luaopen_base
-luaopen_math
-luaopen_string
-luaopen_table
-luaopen_io
-luaopen_os
-luaopen_package
-luaopen_debug
-luaopen_bit
-luaopen_jit
-luaopen_ffi
-
-luaL_openlibs
-luaL_openlib
-luaL_register
-luaL_getmetafield
-luaL_callmeta
-luaL_typerror
-luaL_argerror
-luaL_checklstring
-luaL_optlstring
-luaL_checknumber
-luaL_optnumber
-luaL_checkinteger
-luaL_optinteger
-luaL_checkstack
-luaL_checktype
-luaL_checkany
-luaL_newmetatable
-luaL_checkudata
-luaL_where
-luaL_error
-luaL_checkoption
-luaL_ref
-luaL_unref
-luaL_loadfile
-luaL_loadbuffer
-luaL_loadstring
-luaL_newstate
-luaL_gsub
-luaL_findtable
-luaL_fileresult
-luaL_execresult
-luaL_loadfilex
-luaL_loadbufferx
-luaL_traceback
-luaL_setfuncs
-luaL_pushmodule
-luaL_testudata
-luaL_setmetatable
-luaL_buffinit
-luaL_prepbuffer
-luaL_addlstring
-luaL_addstring
-luaL_addvalue
-luaL_pushresult
-
-luaJIT_setmode
-luaJIT_profile_start
-luaJIT_profile_stop
-luaJIT_profile_dumpstack
diff --git a/src/lua/init.c b/src/lua/init.c
index f115bd2c9..a891afeee 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -749,6 +749,158 @@ tarantool_lua_socket_export_syms(void);
 void **
 tarantool_lua_string_export_syms(void);
 
+static void **
+tarantool_lua_lua_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)lua_newstate,
+		(void *)lua_close,
+		(void *)lua_newthread,
+		(void *)lua_atpanic,
+		(void *)lua_gettop,
+		(void *)lua_settop,
+		(void *)lua_pushvalue,
+		(void *)lua_remove,
+		(void *)lua_insert,
+		(void *)lua_replace,
+		(void *)lua_checkstack,
+		(void *)lua_xmove,
+		(void *)lua_isnumber,
+		(void *)lua_isstring,
+		(void *)lua_iscfunction,
+		(void *)lua_isuserdata,
+		(void *)lua_type,
+		(void *)lua_typename,
+		(void *)lua_equal,
+		(void *)lua_rawequal,
+		(void *)lua_lessthan,
+		(void *)lua_tonumber,
+		(void *)lua_tointeger,
+		(void *)lua_toboolean,
+		(void *)lua_tolstring,
+		(void *)lua_objlen,
+		(void *)lua_tocfunction,
+		(void *)lua_touserdata,
+		(void *)lua_tothread,
+		(void *)lua_topointer,
+		(void *)lua_pushnil,
+		(void *)lua_pushnumber,
+		(void *)lua_pushinteger,
+		(void *)lua_pushlstring,
+		(void *)lua_pushstring,
+		(void *)lua_pushvfstring,
+		(void *)lua_pushfstring,
+		(void *)lua_pushcclosure,
+		(void *)lua_pushboolean,
+		(void *)lua_pushlightuserdata,
+		(void *)lua_pushthread,
+		(void *)lua_gettable,
+		(void *)lua_getfield,
+		(void *)lua_rawget,
+		(void *)lua_rawgeti,
+		(void *)lua_createtable,
+		(void *)lua_newuserdata,
+		(void *)lua_getmetatable,
+		(void *)lua_getfenv,
+		(void *)lua_settable,
+		(void *)lua_setfield,
+		(void *)lua_rawset,
+		(void *)lua_rawseti,
+		(void *)lua_setmetatable,
+		(void *)lua_setfenv,
+		(void *)lua_call,
+		(void *)lua_pcall,
+		(void *)lua_cpcall,
+		(void *)lua_load,
+		(void *)lua_dump,
+		(void *)lua_yield,
+		(void *)lua_resume,
+		(void *)lua_status,
+		(void *)lua_gc,
+		(void *)lua_error,
+		(void *)lua_next,
+		(void *)lua_concat,
+		(void *)lua_getallocf,
+		(void *)lua_setallocf,
+		(void *)lua_getstack,
+		(void *)lua_getinfo,
+		(void *)lua_getlocal,
+		(void *)lua_setlocal,
+		(void *)lua_getupvalue,
+		(void *)lua_setupvalue,
+		(void *)lua_sethook,
+		(void *)lua_gethook,
+		(void *)lua_gethookmask,
+		(void *)lua_gethookcount,
+		(void *)lua_upvalueid,
+		(void *)lua_upvaluejoin,
+		(void *)lua_loadx,
+
+		(void *)luaopen_base,
+		(void *)luaopen_math,
+		(void *)luaopen_string,
+		(void *)luaopen_table,
+		(void *)luaopen_io,
+		(void *)luaopen_os,
+		(void *)luaopen_package,
+		(void *)luaopen_debug,
+		(void *)luaopen_bit,
+		(void *)luaopen_jit,
+		(void *)luaopen_ffi,
+
+		(void *)luaL_openlibs,
+		(void *)luaL_openlib,
+		(void *)luaL_register,
+		(void *)luaL_getmetafield,
+		(void *)luaL_callmeta,
+		(void *)luaL_typerror,
+		(void *)luaL_argerror,
+		(void *)luaL_checklstring,
+		(void *)luaL_optlstring,
+		(void *)luaL_checknumber,
+		(void *)luaL_optnumber,
+		(void *)luaL_checkinteger,
+		(void *)luaL_optinteger,
+		(void *)luaL_checkstack,
+		(void *)luaL_checktype,
+		(void *)luaL_checkany,
+		(void *)luaL_newmetatable,
+		(void *)luaL_checkudata,
+		(void *)luaL_where,
+		(void *)luaL_error,
+		(void *)luaL_checkoption,
+		(void *)luaL_ref,
+		(void *)luaL_unref,
+		(void *)luaL_loadfile,
+		(void *)luaL_loadbuffer,
+		(void *)luaL_loadstring,
+		(void *)luaL_newstate,
+		(void *)luaL_gsub,
+		(void *)luaL_findtable,
+		(void *)luaL_fileresult,
+		(void *)luaL_execresult,
+		(void *)luaL_loadfilex,
+		(void *)luaL_loadbufferx,
+		(void *)luaL_traceback,
+		(void *)luaL_setfuncs,
+		(void *)luaL_pushmodule,
+		(void *)luaL_testudata,
+		(void *)luaL_setmetatable,
+		(void *)luaL_buffinit,
+		(void *)luaL_prepbuffer,
+		(void *)luaL_addlstring,
+		(void *)luaL_addstring,
+		(void *)luaL_addvalue,
+		(void *)luaL_pushresult,
+
+		(void *)luaJIT_setmode,
+		(void *)luaJIT_profile_start,
+		(void *)luaJIT_profile_stop,
+		(void *)luaJIT_profile_dumpstack,
+	};
+	return syms;
+}
+
 void **
 tarantool_lua_tnt_iconv_export_syms(void);
 
@@ -766,6 +918,7 @@ tarantool_lua_export_syms(void)
 		(void *)tarantool_lua_buffer_export_syms,
 		(void *)tarantool_lua_digest_export_syms,
 		(void *)tarantool_lua_error_export_syms,
+		(void *)tarantool_lua_lua_export_syms,
 		(void *)tarantool_lua_msgpack_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
 		(void *)tarantool_lua_tnt_iconv_export_syms,
diff --git a/test/box/gh-2971-symbol-visibility.result b/test/box/gh-2971-symbol-visibility.result
new file mode 100644
index 000000000..9f91a4edf
--- /dev/null
+++ b/test/box/gh-2971-symbol-visibility.result
@@ -0,0 +1,22 @@
+-- test-run result file version 2
+ffi = require('ffi')
+ | ---
+ | ...
+
+--
+-- gh-2971: Tarantool should not hide symbols. Even those which
+-- are not a part of the public API.
+--
+
+-- This symbol is not public, but should be defined.
+ffi.cdef[[                                                                      \
+bool                                                                            \
+box_is_configured(void);                                                        \
+]]
+ | ---
+ | ...
+
+ffi.C.box_is_configured()
+ | ---
+ | - true
+ | ...
diff --git a/test/box/gh-2971-symbol-visibility.test.lua b/test/box/gh-2971-symbol-visibility.test.lua
new file mode 100644
index 000000000..f19effeba
--- /dev/null
+++ b/test/box/gh-2971-symbol-visibility.test.lua
@@ -0,0 +1,14 @@
+ffi = require('ffi')
+
+--
+-- gh-2971: Tarantool should not hide symbols. Even those which
+-- are not a part of the public API.
+--
+
+-- This symbol is not public, but should be defined.
+ffi.cdef[[                                                                      \
+bool                                                                            \
+box_is_configured(void);                                                        \
+]]
+
+ffi.C.box_is_configured()
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 05/43] build: export src/lua/socket.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (37 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 43/43] build: export public Lua symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 06/43] build: export third_party/base64.c symbols Vladislav Shpilevoy
                   ` (10 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/socket.lua via FFI.

Part of #2971
---
 extra/exports    |  2 --
 src/exports.c    |  2 ++
 src/lua/init.c   | 16 ++++++++++++++++
 src/lua/socket.c | 10 ++++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/extra/exports b/extra/exports
index d81b4c05c..f034d3db1 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,8 +2,6 @@
 
 # FFI
 
-lbox_socket_local_resolve
-lbox_socket_nonblock
 base64_decode
 base64_encode
 base64_bufsize
diff --git a/src/exports.c b/src/exports.c
index 2638bcd47..fb8de55da 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -50,6 +50,7 @@
 
 EXPORT(clock_export_syms);
 EXPORT(scramble_export_syms);
+EXPORT(tarantool_lua_export_syms);
 
 void
 export_syms(void)
@@ -57,6 +58,7 @@ export_syms(void)
 	void *syms[] = {
 		clock_export_syms,
 		scramble_export_syms,
+		tarantool_lua_export_syms,
 	};
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
diff --git a/src/lua/init.c b/src/lua/init.c
index 28b6b2d62..823117d94 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -730,3 +730,19 @@ tarantool_lua_free()
 	}
 #endif
 }
+
+void **
+tarantool_lua_socket_export_syms(void);
+
+/**
+ * Aggregator of all symbols defined in src/lua.
+ */
+void **
+tarantool_lua_export_syms(void)
+{
+	static void *syms[] = {
+		/* Submodules. */
+		(void *)tarantool_lua_socket_export_syms,
+	};
+	return syms;
+}
diff --git a/src/lua/socket.c b/src/lua/socket.c
index e75a8802e..8225ad32a 100644
--- a/src/lua/socket.c
+++ b/src/lua/socket.c
@@ -1105,3 +1105,13 @@ tarantool_lua_socket_init(struct lua_State *L)
 
 	lua_pop(L, 1); /* socket.internal */
 }
+
+void **
+tarantool_lua_socket_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)lbox_socket_local_resolve,
+		(void *)lbox_socket_nonblock,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 06/43] build: export third_party/base64.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (38 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 05/43] build: export src/lua/socket.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 07/43] build: export src/lua/digest.c symbols Vladislav Shpilevoy
                   ` (9 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/lua/digest.lua via FFI.

Part of #2971
---
 extra/exports        |  3 ---
 src/exports.c        |  2 ++
 third_party/base64.c | 11 +++++++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/extra/exports b/extra/exports
index f034d3db1..3ef90a414 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,9 +2,6 @@
 
 # FFI
 
-base64_decode
-base64_encode
-base64_bufsize
 SHA1internal
 guava
 random_bytes
diff --git a/src/exports.c b/src/exports.c
index fb8de55da..4c06320c7 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -48,6 +48,7 @@
  * Add new exporters here. Keep them in alphabetical order.
  */
 
+EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
 EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
@@ -56,6 +57,7 @@ void
 export_syms(void)
 {
 	void *syms[] = {
+		base64_export_syms,
 		clock_export_syms,
 		scramble_export_syms,
 		tarantool_lua_export_syms,
diff --git a/third_party/base64.c b/third_party/base64.c
index 8ecab23eb..cb12f9c79 100644
--- a/third_party/base64.c
+++ b/third_party/base64.c
@@ -321,3 +321,14 @@ base64_decode(const char *in_base64, int in_len,
 }
 
 /* }}} */
+
+void **
+base64_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)base64_bufsize,
+		(void *)base64_decode,
+		(void *)base64_encode,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 07/43] build: export src/lua/digest.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (39 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 06/43] build: export third_party/base64.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 08/43] build: export src/lib/salad/guava.c symbols Vladislav Shpilevoy
                   ` (8 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/lua/digest.lua via FFI.

Part of #2971
---
 extra/exports    | 1 -
 src/lua/digest.c | 9 +++++++++
 src/lua/init.c   | 4 ++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 3ef90a414..cb0b823bb 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # FFI
 
-SHA1internal
 guava
 random_bytes
 fiber_time
diff --git a/src/lua/digest.c b/src/lua/digest.c
index b0572baf7..c1b1a92c7 100644
--- a/src/lua/digest.c
+++ b/src/lua/digest.c
@@ -100,3 +100,12 @@ tarantool_lua_digest_init(struct lua_State *L)
 	luaL_register_module(L, "digest", lua_digest_methods);
 	lua_pop(L, 1);
 };
+
+void **
+tarantool_lua_digest_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)SHA1internal,
+	};
+	return syms;
+}
diff --git a/src/lua/init.c b/src/lua/init.c
index 823117d94..da1a19ccd 100644
--- a/src/lua/init.c
+++ b/src/lua/init.c
@@ -731,6 +731,9 @@ tarantool_lua_free()
 #endif
 }
 
+void **
+tarantool_lua_digest_export_syms(void);
+
 void **
 tarantool_lua_socket_export_syms(void);
 
@@ -742,6 +745,7 @@ tarantool_lua_export_syms(void)
 {
 	static void *syms[] = {
 		/* Submodules. */
+		(void *)tarantool_lua_digest_export_syms,
 		(void *)tarantool_lua_socket_export_syms,
 	};
 	return syms;
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 08/43] build: export src/lib/salad/guava.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (40 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 07/43] build: export src/lua/digest.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 09/43] build: export src/lib/core/random.c symbols Vladislav Shpilevoy
                   ` (7 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/lua/digest.lua via FFI.

Part of #2971
---
 extra/exports         | 1 -
 src/exports.c         | 2 ++
 src/lib/salad/guava.c | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index cb0b823bb..4b20607ad 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # FFI
 
-guava
 random_bytes
 fiber_time
 fiber_time64
diff --git a/src/exports.c b/src/exports.c
index 4c06320c7..c88d0b10d 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -50,6 +50,7 @@
 
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
+EXPORT(salad_guava_export_syms);
 EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
 
@@ -59,6 +60,7 @@ export_syms(void)
 	void *syms[] = {
 		base64_export_syms,
 		clock_export_syms,
+		salad_guava_export_syms,
 		scramble_export_syms,
 		tarantool_lua_export_syms,
 	};
diff --git a/src/lib/salad/guava.c b/src/lib/salad/guava.c
index 46bf1ac15..c0edf1b60 100644
--- a/src/lib/salad/guava.c
+++ b/src/lib/salad/guava.c
@@ -61,3 +61,12 @@ guava(int64_t state, int32_t buckets)
 			return candidate;
 	}
 }
+
+void **
+salad_guava_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)guava,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 09/43] build: export src/lib/core/random.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (41 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 08/43] build: export src/lib/salad/guava.c symbols Vladislav Shpilevoy
@ 2020-04-12  0:13 ` Vladislav Shpilevoy
  2020-04-14 18:14   ` Timur Safin
  2020-04-12 11:34 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Konstantin Osipov
                   ` (6 subsequent siblings)
  49 siblings, 1 reply; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12  0:13 UTC (permalink / raw)
  To: tarantool-patches

Exports a function used by src/lua/digest.lua via FFI.

Part of #2971
---
 extra/exports         | 1 -
 src/exports.c         | 2 ++
 src/lib/core/random.c | 9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/extra/exports b/extra/exports
index 4b20607ad..1224c550d 100644
--- a/extra/exports
+++ b/extra/exports
@@ -2,7 +2,6 @@
 
 # FFI
 
-random_bytes
 fiber_time
 fiber_time64
 fiber_clock
diff --git a/src/exports.c b/src/exports.c
index c88d0b10d..cd2d49b9b 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -50,6 +50,7 @@
 
 EXPORT(base64_export_syms);
 EXPORT(clock_export_syms);
+EXPORT(random_export_syms);
 EXPORT(salad_guava_export_syms);
 EXPORT(scramble_export_syms);
 EXPORT(tarantool_lua_export_syms);
@@ -60,6 +61,7 @@ export_syms(void)
 	void *syms[] = {
 		base64_export_syms,
 		clock_export_syms,
+		random_export_syms,
 		salad_guava_export_syms,
 		scramble_export_syms,
 		tarantool_lua_export_syms,
diff --git a/src/lib/core/random.c b/src/lib/core/random.c
index f4fa75b1c..75680c9ea 100644
--- a/src/lib/core/random.c
+++ b/src/lib/core/random.c
@@ -97,3 +97,12 @@ rand:
 	while (generated < size)
 		buf[generated++] = rand();
 }
+
+void **
+random_export_syms(void)
+{
+	static void *syms[] = {
+		(void *)random_bytes,
+	};
+	return syms;
+}
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (42 preceding siblings ...)
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 09/43] build: export src/lib/core/random.c symbols Vladislav Shpilevoy
@ 2020-04-12 11:34 ` Konstantin Osipov
  2020-04-12 14:05   ` Vladislav Shpilevoy
  2020-04-12 14:25 ` Vladislav Shpilevoy
                   ` (5 subsequent siblings)
  49 siblings, 1 reply; 76+ messages in thread
From: Konstantin Osipov @ 2020-04-12 11:34 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/04/12 14:24]:


> 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.

The exports used to be autogenerated. Instead, you introduce
a manually crafted list. This upsets the whole idea: 
exporting everything was used in a hypothetical emergency case
when it's necessary to access some production version internals.

This included all symbols - global variables, functions.

With your patch, the manual exports will quickly get out of date
and will be useless in practice (little to no chance the needed
symbol is explicitly exported).

This is good, actually, I hope in a year or two Mons will realize
he was abusing his influence/power and the patch will finally be
deleted.

> 
> 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
> 
> -- 
> 2.21.1 (Apple Git-122.3)

-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12 11:34 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Konstantin Osipov
@ 2020-04-12 14:05   ` Vladislav Shpilevoy
  2020-04-13  9:40     ` Konstantin Osipov
  0 siblings, 1 reply; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12 14:05 UTC (permalink / raw)
  To: Konstantin Osipov, tarantool-patches

On 12/04/2020 13:34, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/04/12 14:24]:
> 
> 
>> 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.
> 
> The exports used to be autogenerated. Instead, you introduce
> a manually crafted list.

It was never autogenerated. We always patched extra/exports file.
That makes almost all your comments irrelevant.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (43 preceding siblings ...)
  2020-04-12 11:34 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Konstantin Osipov
@ 2020-04-12 14:25 ` Vladislav Shpilevoy
  2020-04-12 20:18 ` Vladislav Shpilevoy
                   ` (4 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12 14:25 UTC (permalink / raw)
  To: tarantool-patches

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
> 

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (44 preceding siblings ...)
  2020-04-12 14:25 ` Vladislav Shpilevoy
@ 2020-04-12 20:18 ` Vladislav Shpilevoy
  2020-04-13 14:26 ` Vladislav Shpilevoy
                   ` (3 subsequent siblings)
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-12 20:18 UTC (permalink / raw)
  To: tarantool-patches

I wasn't sure whether a changelog is needed here, but just
in case:

@ChangeLog
- Symbols of Tarantool executable are not hidden anymore. It means,
  some of private functions may become available via FFI or from
  a module's code, if you know definitions of the needed functions.
  Although there are no any guarantees on these symbols (gh-2971).

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12 14:05   ` Vladislav Shpilevoy
@ 2020-04-13  9:40     ` Konstantin Osipov
  2020-04-13  9:42       ` Konstantin Osipov
  0 siblings, 1 reply; 76+ messages in thread
From: Konstantin Osipov @ 2020-04-13  9:40 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/04/13 10:22]:
> It was never autogenerated. We always patched extra/exports file.
> That makes almost all your comments irrelevant.

4c4c1ccbe422e1420ce0c0b36194fc61bb857ed4 adds exports

It also adds explicit -Wl,exported_symbols_list

Before that everything was visible.

-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13  9:40     ` Konstantin Osipov
@ 2020-04-13  9:42       ` Konstantin Osipov
  2020-04-13 13:53         ` Vladislav Shpilevoy
  0 siblings, 1 reply; 76+ messages in thread
From: Konstantin Osipov @ 2020-04-13  9:42 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

* Konstantin Osipov <kostja.osipov@gmail.com> [20/04/13 12:40]:
> > It was never autogenerated. We always patched extra/exports file.
> > That makes almost all your comments irrelevant.
> 
> 4c4c1ccbe422e1420ce0c0b36194fc61bb857ed4 adds exports
> 
> It also adds explicit -Wl,exported_symbols_list

Basically the right fix is to remove this link option, not come up
with 43 patches.

-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13  9:42       ` Konstantin Osipov
@ 2020-04-13 13:53         ` Vladislav Shpilevoy
  2020-04-13 14:15           ` Konstantin Osipov
  2020-04-13 19:49           ` Sergey Ostanevich
  0 siblings, 2 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-13 13:53 UTC (permalink / raw)
  To: Konstantin Osipov, tarantool-patches



On 13/04/2020 11:42, Konstantin Osipov wrote:
> * Konstantin Osipov <kostja.osipov@gmail.com> [20/04/13 12:40]:
>>> It was never autogenerated. We always patched extra/exports file.
>>> That makes almost all your comments irrelevant.
>>
>> 4c4c1ccbe422e1420ce0c0b36194fc61bb857ed4 adds exports
>>
>> It also adds explicit -Wl,exported_symbols_list
> 
> Basically the right fix is to remove this link option, not come up
> with 43 patches.

It is not enough. Static library symbols are not exported, if they
are not used. Linker drops them. It means almost all needed symbols
are removed when you just remove the option.

Alternative is to use option all_load on clang (and whole-archive on
gcc), but that exports *all* symbols and *all* functions. Even the
ones which really are not needed, but are just a part of some library,
which we don't want to trim.

The decision was made to go for the former option.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 13:53         ` Vladislav Shpilevoy
@ 2020-04-13 14:15           ` Konstantin Osipov
  2020-04-13 14:21             ` Vladislav Shpilevoy
  2020-04-13 19:49           ` Sergey Ostanevich
  1 sibling, 1 reply; 76+ messages in thread
From: Konstantin Osipov @ 2020-04-13 14:15 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/04/13 16:57]:
> > Basically the right fix is to remove this link option, not come up
> > with 43 patches.
> 
> It is not enough. Static library symbols are not exported, if they
> are not used. Linker drops them. It means almost all needed symbols
> are removed when you just remove the option.
> 
> Alternative is to use option all_load on clang (and whole-archive on
> gcc), but that exports *all* symbols and *all* functions. Even the
> ones which really are not needed, but are just a part of some library,
> which we don't want to trim.

This is a single user feature. That single user was happy with the
previous implementation, using automatic exports. Clang, Mac OS X
or unstable export lists were not relevant to him, so a tiny patch
reverting linker option would suffice.

You are trying to make it "better" for that user. As I wrote
earlier, this won't work, since nobody's going to maintain these
lists going forward.

It is actually quite amazing how Nick made a useless patch 4 years
ago and it spawned hours of useless conversations and emails, and 
43 other useless patches now, and I don't know how many more
useless patches and emails will be written to keep this
going...

Since whatever happens it's not relevant to tarantool architecture
or code quality I don't really care - except it's a pity people
are spending time on this instead of spending it on something
more useful.

-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 14:15           ` Konstantin Osipov
@ 2020-04-13 14:21             ` Vladislav Shpilevoy
  0 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-13 14:21 UTC (permalink / raw)
  To: Konstantin Osipov, tarantool-patches

On 13/04/2020 16:15, Konstantin Osipov wrote:
> * Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/04/13 16:57]:
>>> Basically the right fix is to remove this link option, not come up
>>> with 43 patches.
>>
>> It is not enough. Static library symbols are not exported, if they
>> are not used. Linker drops them. It means almost all needed symbols
>> are removed when you just remove the option.
>>
>> Alternative is to use option all_load on clang (and whole-archive on
>> gcc), but that exports *all* symbols and *all* functions. Even the
>> ones which really are not needed, but are just a part of some library,
>> which we don't want to trim.
> 
> This is a single user feature. That single user was happy with the
> previous implementation, using automatic exports. Clang, Mac OS X
> or unstable export lists were not relevant to him, so a tiny patch
> reverting linker option would suffice.

You are not listening to me. This is not about Mac only.

> You are trying to make it "better" for that user. As I wrote
> earlier, this won't work, since nobody's going to maintain these
> lists going forward.

It was maintained for years in extra/exports.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (45 preceding siblings ...)
  2020-04-12 20:18 ` Vladislav Shpilevoy
@ 2020-04-13 14:26 ` Vladislav Shpilevoy
  2020-04-13 16:44   ` Cyrill Gorcunov
  2020-04-14  1:15 ` Vladislav Shpilevoy
                   ` (2 subsequent siblings)
  49 siblings, 1 reply; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-13 14:26 UTC (permalink / raw)
  To: tarantool-patches

Another possible improvement I can think of - instead of
using 'static void *syms[]' everywhere I could make all
*_export_syms() functions take an argument like

    void (*export_f)(void **syms)

And they would pass pointers at their functions there.

The main file, exports.c, would pass here a function, which
does nothing. Or does panic(), but we will never call these
_export_syms() functions actually. Will place it under
something like 'if (time(NULL) == 0)'.

That would allow to turn static arrays into normal arrays on
the stack and make the executable's size a bit smaller.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 14:26 ` Vladislav Shpilevoy
@ 2020-04-13 16:44   ` Cyrill Gorcunov
  2020-04-13 17:57     ` Vladislav Shpilevoy
  0 siblings, 1 reply; 76+ messages in thread
From: Cyrill Gorcunov @ 2020-04-13 16:44 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On Mon, Apr 13, 2020 at 04:26:41PM +0200, Vladislav Shpilevoy wrote:
> Another possible improvement I can think of - instead of
> using 'static void *syms[]' everywhere I could make all
> *_export_syms() functions take an argument like
> 
>     void (*export_f)(void **syms)
> 
> And they would pass pointers at their functions there.
> 
> The main file, exports.c, would pass here a function, which
> does nothing. Or does panic(), but we will never call these
> _export_syms() functions actually. Will place it under
> something like 'if (time(NULL) == 0)'.
> 
> That would allow to turn static arrays into normal arrays on
> the stack and make the executable's size a bit smaller.

Vladislav, let me summarize the overall idea and the problem:

1) Currently tarantool *already* uses extra/exports file during
   build procedure, where we keep the list of functions to be
   avaliable via Lua ffi interface to the tarantool users.

   While these functions are NOT part of API people relay on them
   and use actively, right? In other words they are semi-API I wold
   say.

2) Due to our build procedure specifics we link final executable from
   static libraries (or archives) and compiler may think that some of
   the symbols are not even used and trip them off in optimization
   phase.

3) Instead of supporting separate extra/exports file we bind symbols
   to the source files were they are defined.

   Actually I would prefer more explicit way as I shown you in face
   to face talk, but this is definitely not the option for current
   timeline. We can try to implement it later.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 16:44   ` Cyrill Gorcunov
@ 2020-04-13 17:57     ` Vladislav Shpilevoy
  2020-04-13 18:17       ` Cyrill Gorcunov
  0 siblings, 1 reply; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-13 17:57 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tarantool-patches

On 13/04/2020 18:44, Cyrill Gorcunov wrote:
> On Mon, Apr 13, 2020 at 04:26:41PM +0200, Vladislav Shpilevoy wrote:
>> Another possible improvement I can think of - instead of
>> using 'static void *syms[]' everywhere I could make all
>> *_export_syms() functions take an argument like
>>
>>     void (*export_f)(void **syms)
>>
>> And they would pass pointers at their functions there.
>>
>> The main file, exports.c, would pass here a function, which
>> does nothing. Or does panic(), but we will never call these
>> _export_syms() functions actually. Will place it under
>> something like 'if (time(NULL) == 0)'.
>>
>> That would allow to turn static arrays into normal arrays on
>> the stack and make the executable's size a bit smaller.
> 
> Vladislav, let me summarize the overall idea and the problem:
> 
> 1) Currently tarantool *already* uses extra/exports file during
>    build procedure, where we keep the list of functions to be
>    avaliable via Lua ffi interface to the tarantool users.
> 
>    While these functions are NOT part of API people relay on them
>    and use actively, right? In other words they are semi-API I wold
>    say.

Almost correct. Many symbols here are a part of the public API.
But some of them are not, and yet it does not mean people use them,
at least directly.

Non-public symbols are used by Lua FFI, by our own Lua code. So
the exported but non-public symbols we can change as we want.
Even remove from the export list when they become not needed.

Everything else is correct.

> 2) Due to our build procedure specifics we link final executable from
>    static libraries (or archives) and compiler may think that some of
>    the symbols are not even used and trip them off in optimization
>    phase.
> 
> 3) Instead of supporting separate extra/exports file we bind symbols
>    to the source files were they are defined.
> 
>    Actually I would prefer more explicit way as I shown you in face
>    to face talk, but this is definitely not the option for current
>    timeline. We can try to implement it later.
> 

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 17:57     ` Vladislav Shpilevoy
@ 2020-04-13 18:17       ` Cyrill Gorcunov
  0 siblings, 0 replies; 76+ messages in thread
From: Cyrill Gorcunov @ 2020-04-13 18:17 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On Mon, Apr 13, 2020 at 07:57:36PM +0200, Vladislav Shpilevoy wrote:
> > 
> > Vladislav, let me summarize the overall idea and the problem:
> > 
> > 1) Currently tarantool *already* uses extra/exports file during
> >    build procedure, where we keep the list of functions to be
> >    avaliable via Lua ffi interface to the tarantool users.
> > 
> >    While these functions are NOT part of API people relay on them
> >    and use actively, right? In other words they are semi-API I wold
> >    say.
> 
> Almost correct. Many symbols here are a part of the public API.
> But some of them are not, and yet it does not mean people use them,
> at least directly.
> 
> Non-public symbols are used by Lua FFI, by our own Lua code. So
> the exported but non-public symbols we can change as we want.
> Even remove from the export list when they become not needed.
> 
> Everything else is correct.

Ok, as to me this approach a way better than current extra/export
idiocity. I can't step in with you and Kostya since I've too little
experience over all architecture, thus up to you guys!

As to code itself -- Ack.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 13:53         ` Vladislav Shpilevoy
  2020-04-13 14:15           ` Konstantin Osipov
@ 2020-04-13 19:49           ` Sergey Ostanevich
  2020-04-13 21:01             ` Vladislav Shpilevoy
  1 sibling, 1 reply; 76+ messages in thread
From: Sergey Ostanevich @ 2020-04-13 19:49 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

Hi, Vlad! 

Thanks for the patch, still I've got a question:

> >> It also adds explicit -Wl,exported_symbols_list
> > 
> > Basically the right fix is to remove this link option, not come up
> > with 43 patches.
> 
> It is not enough. Static library symbols are not exported, if they
> are not used. Linker drops them. It means almost all needed symbols
> are removed when you just remove the option.

If those symbols are removed, does it mean they're not used in the
product? Why one (even Mons!) will need to call a function, that is not
a part of the product then?

Regards,
Sergos

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 19:49           ` Sergey Ostanevich
@ 2020-04-13 21:01             ` Vladislav Shpilevoy
  2020-04-13 21:38               ` Konstantin Osipov
  0 siblings, 1 reply; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-13 21:01 UTC (permalink / raw)
  To: Sergey Ostanevich; +Cc: tarantool-patches



On 13/04/2020 21:49, Sergey Ostanevich wrote:
> Hi, Vlad! 
> 
> Thanks for the patch, still I've got a question:
> 
>>>> It also adds explicit -Wl,exported_symbols_list
>>>
>>> Basically the right fix is to remove this link option, not come up
>>> with 43 patches.
>>
>> It is not enough. Static library symbols are not exported, if they
>> are not used. Linker drops them. It means almost all needed symbols
>> are removed when you just remove the option.
> 
> If those symbols are removed, does it mean they're not used in the
> product? Why one (even Mons!) will need to call a function, that is not
> a part of the product then?

If a function is not used in the final executable, it does not mean
it is legal to remove it. Some of such functions still should be
visible in case a dynamic user-implemented module will be loaded at
runtime. These are mostly wrappers around private functions, which
do a little more error checking.

On the summary, there are 3 groups of exported symbols:

- Needed for dynamically loaded modules for the public C API;

- Needed for our own Lua code to use via FFI;

- Other symbols, which are not public, and are not needed for
  Lua FFI. Typically these are all non inlined functions used in
  the final executable in one way or another. These are highly
  unstable, can be renamed, removed.

Mons wants to use the third group.

Talking of your question 'Why would he want to use them?' - I don't
know. I don't like that either. But it was discussed already millions
of times. At 1000001th time Kirill decided to surrender, the ticket
was assigned on a milestone and given to me, and so it is implemented.

> Regards,
> Sergos
> 

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 21:01             ` Vladislav Shpilevoy
@ 2020-04-13 21:38               ` Konstantin Osipov
  2020-04-14 18:01                 ` Timur Safin
  0 siblings, 1 reply; 76+ messages in thread
From: Konstantin Osipov @ 2020-04-13 21:38 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

* Vladislav Shpilevoy <v.shpilevoy@tarantool.org> [20/04/14 00:01]:
> - Other symbols, which are not public, and are not needed for
>   Lua FFI. Typically these are all non inlined functions used in
>   the final executable in one way or another. These are highly
>   unstable, can be renamed, removed.
> 
> Mons wants to use the third group.
> 
> Talking of your question 'Why would he want to use them?' - I don't
> know. I don't like that either. But it was discussed already millions
> of times. At 1000001th time Kirill decided to surrender, the ticket
> was assigned on a milestone and given to me, and so it is implemented.

Mons will be happy simply if we switch back to default gcc linking
options, -fvisibility=default, which is basically dropping
-exported_symbols_list.

-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (46 preceding siblings ...)
  2020-04-13 14:26 ` Vladislav Shpilevoy
@ 2020-04-14  1:15 ` Vladislav Shpilevoy
  2020-04-14  1:27 ` [Tarantool-patches] [PATCH 44/43] build: export src/box/lua/console.c symbols Vladislav Shpilevoy
  2020-04-15 23:15 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-14  1:15 UTC (permalink / raw)
  To: tarantool-patches

There was a concern from Kostja, that my commit exposes
only functions, but Mons wants other symbols too, such
as 'cord_ptr'. Just tried:

tarantool> ffi.cdef[[
         > struct cord;
         > extern struct cord *cord_ptr;
         > ]]
---
...

tarantool> ffi.C.cord_ptr
---
- 'cdata<struct cord *>: 0x7fff6c0cf6f9'
...

^ permalink raw reply	[flat|nested] 76+ messages in thread

* [Tarantool-patches] [PATCH 44/43] build: export src/box/lua/console.c symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (47 preceding siblings ...)
  2020-04-14  1:15 ` Vladislav Shpilevoy
@ 2020-04-14  1:27 ` Vladislav Shpilevoy
  2020-04-15 23:15 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-14  1:27 UTC (permalink / raw)
  To: tarantool-patches

Exports functions used by src/box/lua/console.lua via FFI.

Closes #2971
---

I rebased the patchset on the master and got a new commit,
since a couple of new functions were exported from the console
module.

 extra/exports         |  6 ------
 src/box/lua/console.c | 10 ++++++++++
 src/box/lua/init.c    |  4 ++++
 3 files changed, 14 insertions(+), 6 deletions(-)
 delete mode 100644 extra/exports

diff --git a/extra/exports b/extra/exports
deleted file mode 100644
index 41432a547..000000000
--- a/extra/exports
+++ /dev/null
@@ -1,6 +0,0 @@
-# Symbols exported by the main Tarantool executable
-
-# FFI
-
-console_get_output_format
-console_set_output_format
diff --git a/src/box/lua/console.c b/src/box/lua/console.c
index bd454c269..b2a6e87b7 100644
--- a/src/box/lua/console.c
+++ b/src/box/lua/console.c
@@ -803,3 +803,13 @@ error:
 	lua_settop(L, savetop);
 	return ml.list;
 }
+
+void **
+box_lua_console_export_syms(void)
+{
+	static void *syms[] = {
+		console_get_output_format,
+		console_set_output_format,
+	};
+	return syms;
+}
diff --git a/src/box/lua/init.c b/src/box/lua/init.c
index fb35ea56c..b565d6bc0 100644
--- a/src/box/lua/init.c
+++ b/src/box/lua/init.c
@@ -442,6 +442,9 @@ box_lua_init(struct lua_State *L)
 	assert(lua_gettop(L) == 0);
 }
 
+void **
+box_lua_console_export_syms(void);
+
 void **
 box_lua_tuple_export_syms(void);
 
@@ -449,6 +452,7 @@ void **
 box_lua_export_syms(void)
 {
 	static void *syms[] = {
+		(void *)box_lua_console_export_syms,
 		(void *)box_lua_tuple_export_syms,
 	};
 	return syms;
-- 
2.21.1 (Apple Git-122.3)

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-13 21:38               ` Konstantin Osipov
@ 2020-04-14 18:01                 ` Timur Safin
  2020-04-14 18:26                   ` Timur Safin
  2020-04-14 20:41                   ` 'Konstantin Osipov'
  0 siblings, 2 replies; 76+ messages in thread
From: Timur Safin @ 2020-04-14 18:01 UTC (permalink / raw)
  To: 'Konstantin Osipov', 'Vladislav Shpilevoy'
  Cc: tarantool-patches

: Mons will be happy simply if we switch back to default gcc linking
: options, -fvisibility=default, which is basically dropping
: -exported_symbols_list.
: 
: --
: Konstantin Osipov, Moscow, Russia

Nope, this won't work the desired way - linker will get rid of symbol if it's default visible and unreferenced in the executable.

We used to have FFI hack for such case, which was deleted because explicitly exported symbol (via loader list) will be retained in the binary. If we explicitly export them in the code - we will get to the same result - unreferenced/"unused" symbol will be available for external access (e.g. from LuaJIT ffi). 


Timur

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 09/43] build: export src/lib/core/random.c symbols
  2020-04-12  0:13 ` [Tarantool-patches] [PATCH 09/43] build: export src/lib/core/random.c symbols Vladislav Shpilevoy
@ 2020-04-14 18:14   ` Timur Safin
  0 siblings, 0 replies; 76+ messages in thread
From: Timur Safin @ 2020-04-14 18:14 UTC (permalink / raw)
  To: 'Vladislav Shpilevoy', tarantool-patches


: diff --git a/extra/exports b/extra/exports
: index 4b20607ad..1224c550d 100644
: --- a/extra/exports
: +++ b/extra/exports
: @@ -2,7 +2,6 @@
: 
:  # FFI
: 
: -random_bytes
:  fiber_time
:  fiber_time64
:  fiber_clock
: diff --git a/src/exports.c b/src/exports.c
: index c88d0b10d..cd2d49b9b 100644
: --- a/src/exports.c
: +++ b/src/exports.c
: @@ -50,6 +50,7 @@
: 
:  EXPORT(base64_export_syms);
:  EXPORT(clock_export_syms);
: +EXPORT(random_export_syms);
:  EXPORT(salad_guava_export_syms);
:  EXPORT(scramble_export_syms);
:  EXPORT(tarantool_lua_export_syms);
: @@ -60,6 +61,7 @@ export_syms(void)
:  	void *syms[] = {
:  		base64_export_syms,
:  		clock_export_syms,
: +		random_export_syms,
:  		salad_guava_export_syms,
:  		scramble_export_syms,
:  		tarantool_lua_export_syms,
: diff --git a/src/lib/core/random.c b/src/lib/core/random.c
: index f4fa75b1c..75680c9ea 100644
: --- a/src/lib/core/random.c
: +++ b/src/lib/core/random.c
: @@ -97,3 +97,12 @@ rand:
:  	while (generated < size)
:  		buf[generated++] = rand();
:  }
: +
: +void **
: +random_export_syms(void)
: +{
: +	static void *syms[] = {
: +		(void *)random_bytes,
: +	};
: +	return syms;
: +}

I think that this hack (if referencing to otherwise unused, but exported symbol) should be unnecessary here and in all patches below if we properly handle exported symbol in the linker. Which should retain those symbols. Let me check later tonight that we miss here...

Timur

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-14 18:01                 ` Timur Safin
@ 2020-04-14 18:26                   ` Timur Safin
  2020-04-14 20:41                   ` 'Konstantin Osipov'
  1 sibling, 0 replies; 76+ messages in thread
From: Timur Safin @ 2020-04-14 18:26 UTC (permalink / raw)
  To: 'Konstantin Osipov', 'Vladislav Shpilevoy'
  Cc: tarantool-patches



: -----Original Message-----
: From: Tarantool-patches <tarantool-patches-bounces@dev.tarantool.org> On
: Behalf Of Timur Safin
: Sent: Tuesday, April 14, 2020 9:01 PM
: To: 'Konstantin Osipov' <kostja.osipov@gmail.com>; 'Vladislav Shpilevoy'
: <v.shpilevoy@tarantool.org>
: Cc: tarantool-patches@dev.tarantool.org
: Subject: Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
: 
: : Mons will be happy simply if we switch back to default gcc linking
: : options, -fvisibility=default, which is basically dropping
: : -exported_symbols_list.
: :
: : --
: : Konstantin Osipov, Moscow, Russia
: 
: Nope, this won't work the desired way - linker will get rid of symbol if
: it's default visible and unreferenced in the executable.
: 
: We used to have FFI hack for such case, which was deleted because
: explicitly exported symbol (via loader list) will be retained in the
: binary. If we explicitly export them in the code - we will get to the same
: result - unreferenced/"unused" symbol will be available for external
: access (e.g. from LuaJIT ffi).
: 
: 
: Timur

Well, as I've realized later (after further discussions with Vlad) ld has not kept explicitly exported symbols after it has collected executable out of list of static libraries we have. That's unfortunate - we need to find out the way to make ld working more link in the case of so. Will look around.

Timur

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-14 18:01                 ` Timur Safin
  2020-04-14 18:26                   ` Timur Safin
@ 2020-04-14 20:41                   ` 'Konstantin Osipov'
  2020-04-15 10:28                     ` Mons Anderson
  2020-04-15 10:40                     ` Mons Anderson
  1 sibling, 2 replies; 76+ messages in thread
From: 'Konstantin Osipov' @ 2020-04-14 20:41 UTC (permalink / raw)
  To: Timur Safin; +Cc: tarantool-patches, 'Vladislav Shpilevoy'

* Timur Safin <tsafin@tarantool.org> [20/04/14 21:01]:
> : Mons will be happy simply if we switch back to default gcc linking
> : options, -fvisibility=default, which is basically dropping
> : -exported_symbols_list.
> : 
> : --
> : Konstantin Osipov, Moscow, Russia
> 
> Nope, this won't work the desired way - linker will get rid of symbol if it's default visible and unreferenced in the executable.
> 
> We used to have FFI hack for such case, which was deleted
> because explicitly exported symbol (via loader list) will be
> retained in the binary. If we explicitly export them in the code
> - we will get to the same result - unreferenced/"unused" symbol
> will be available for external access (e.g. from LuaJIT ffi). 

This is unrelated. 1.5 didn't have plugin api and no ffi exports 
and mons was hacking into it.

In fact he wasn't hacking into functions at all, he was hacking
into global state, such as cord_ptr->fiber, and it was not (and I
believe is not) removed from the visibility list by linker.

In short:
When trying to understand how this "feature" worked before, look
at 1.5, not 1.6+.

-- 
Konstantin Osipov, Moscow, Russia

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-14 20:41                   ` 'Konstantin Osipov'
@ 2020-04-15 10:28                     ` Mons Anderson
  2020-04-15 10:40                     ` Mons Anderson
  1 sibling, 0 replies; 76+ messages in thread
From: Mons Anderson @ 2020-04-15 10:28 UTC (permalink / raw)
  To: Konstantin Osipov; +Cc: tarantool-patches

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]


> On 14 Apr 2020, at 23:41, Konstantin Osipov <kostja.osipov@gmail.com> wrote:
> 
> This is unrelated. 1.5 didn't have plugin api and no ffi exports 
> and mons was hacking into it.
> 
> In fact he wasn't hacking into functions at all, he was hacking
> into global state, such as cord_ptr->fiber, and it was not (and I
> believe is not) removed from the visibility list by linker.
> 
> In short:
> When trying to understand how this "feature" worked before, look
> at 1.5, not 1.6+.


You are wrong. It works in 1.6 and was broken by mejedi in the middle of 1.7 and unfortunately left unseen

For ex, I’m using in 1.6:

ffi.cdef[[ uint32_t sc_version; ]]

Things like that stop working after that patch.

-- 
Mons Anderson
Software Architect, Mail.Ru Cloud Solutions <https://mcs.mail.ru/><mons@cpan.org>


[-- Attachment #2: Type: text/html, Size: 4722 bytes --]

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-14 20:41                   ` 'Konstantin Osipov'
  2020-04-15 10:28                     ` Mons Anderson
@ 2020-04-15 10:40                     ` Mons Anderson
  2020-04-15 10:50                       ` sergos
  2020-04-15 11:27                       ` Konstantin Osipov
  1 sibling, 2 replies; 76+ messages in thread
From: Mons Anderson @ 2020-04-15 10:40 UTC (permalink / raw)
  To: Konstantin Osipov, tarantool-patches

On Tue, Apr 14, 2020 at 11:41 PM Konstantin Osipov
<kostja.osipov@gmail.com> wrote:
>
> * Timur Safin <tsafin@tarantool.org> [20/04/14 21:01]:
> > : Mons will be happy simply if we switch back to default gcc linking
> > : options, -fvisibility=default, which is basically dropping
> > : -exported_symbols_list.

We've been discussing this with team. It is sufficient for me.
But you can't just drop exported_symbols_list without replacing it
with something else to guarantee presence of internal ffi functions

>
> This is unrelated. 1.5 didn't have plugin api and no ffi exports
> and mons was hacking into it.
>
> In fact he wasn't hacking into functions at all, he was hacking
> into global state, such as cord_ptr->fiber, and it was not (and I
> believe is not) removed from the visibility list by linker.
>
> In short:
> When trying to understand how this "feature" worked before, look
> at 1.5, not 1.6+.

You are wrong. It works in 1.6 and was broken by mejedi in the middle
of 1.7 and unfortunately left unseen
For ex, I’m using in 1.6:

ffi.cdef[[ uint32_t sc_version; ]]

Things like that stop working after that patch.


-- 
Best wishes,
Vladimir V. Perepelitsa aka Mons Anderson
<inthrax@gmail.com>, <mons@cpan.org>
http://github.com/Mons

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-15 10:40                     ` Mons Anderson
@ 2020-04-15 10:50                       ` sergos
  2020-04-15 21:58                         ` Vladislav Shpilevoy
  2020-04-15 11:27                       ` Konstantin Osipov
  1 sibling, 1 reply; 76+ messages in thread
From: sergos @ 2020-04-15 10:50 UTC (permalink / raw)
  To: Mons Anderson; +Cc: tarantool-patches



> On 15 Apr 2020, at 13:40, Mons Anderson <mons@cpan.org> wrote:
> 
> On Tue, Apr 14, 2020 at 11:41 PM Konstantin Osipov
> <kostja.osipov@gmail.com> wrote:
>> 
>> * Timur Safin <tsafin@tarantool.org> [20/04/14 21:01]:
>>> : Mons will be happy simply if we switch back to default gcc linking
>>> : options, -fvisibility=default, which is basically dropping
>>> : -exported_symbols_list.
> 
> We've been discussing this with team. It is sufficient for me.
> But you can't just drop exported_symbols_list without replacing it
> with something else to guarantee presence of internal ffi functions
> 
This could be done with approach from @cyrillos, AFAIU. These functions
should be annotated in the code, rather than collected in a separate 
list. If a function is not present in the tarantool binary - e.g. 
dropped as not used from static library - it should not be available 
anyways. Will it work you, Mons?

>> 
>> This is unrelated. 1.5 didn't have plugin api and no ffi exports
>> and mons was hacking into it.
>> 
>> In fact he wasn't hacking into functions at all, he was hacking
>> into global state, such as cord_ptr->fiber, and it was not (and I
>> believe is not) removed from the visibility list by linker.
>> 
>> In short:
>> When trying to understand how this "feature" worked before, look
>> at 1.5, not 1.6+.
> 
> You are wrong. It works in 1.6 and was broken by mejedi in the middle
> of 1.7 and unfortunately left unseen
> For ex, I’m using in 1.6:
> 
> ffi.cdef[[ uint32_t sc_version; ]]
> 
> Things like that stop working after that patch.
> 
> 
> -- 
> Best wishes,
> Vladimir V. Perepelitsa aka Mons Anderson
> <inthrax@gmail.com>, <mons@cpan.org>
> http://github.com/Mons

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-15 10:40                     ` Mons Anderson
  2020-04-15 10:50                       ` sergos
@ 2020-04-15 11:27                       ` Konstantin Osipov
  1 sibling, 0 replies; 76+ messages in thread
From: Konstantin Osipov @ 2020-04-15 11:27 UTC (permalink / raw)
  To: Mons Anderson; +Cc: tarantool-patches

* Mons Anderson <mons@cpan.org> [20/04/15 13:42]:
> We've been discussing this with team. It is sufficient for me.
> But you can't just drop exported_symbols_list without replacing it
> with something else to guarantee presence of internal ffi functions

It's easy to fix these with the "hack" by Roman which mejedi's
patch removed. This hack can be restored, that's it.


-- 
Konstantin Osipov, Moscow, Russia
https://scylladb.com

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-15 10:50                       ` sergos
@ 2020-04-15 21:58                         ` Vladislav Shpilevoy
  2020-04-16 12:13                           ` Cyrill Gorcunov
  0 siblings, 1 reply; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-15 21:58 UTC (permalink / raw)
  To: sergos, Mons Anderson; +Cc: tarantool-patches

>> On 15 Apr 2020, at 13:40, Mons Anderson <mons@cpan.org> wrote:
>>
>> On Tue, Apr 14, 2020 at 11:41 PM Konstantin Osipov
>> <kostja.osipov@gmail.com> wrote:
>>>
>>> * Timur Safin <tsafin@tarantool.org> [20/04/14 21:01]:
>>>> : Mons will be happy simply if we switch back to default gcc linking
>>>> : options, -fvisibility=default, which is basically dropping
>>>> : -exported_symbols_list.
>>
>> We've been discussing this with team. It is sufficient for me.
>> But you can't just drop exported_symbols_list without replacing it
>> with something else to guarantee presence of internal ffi functions
>>
> This could be done with approach from @cyrillos, AFAIU. These functions
> should be annotated in the code, rather than collected in a separate 
> list.

Yeah, the problem is that there is no a compiler option, which would
prevent removal of certain unused symbols defined in static libraries,
when they are merged into one executable.

You can either export all of them using whole-archive option, or
export a list via the option used on the master branch now (but that
masks out all other symbols).

Cyrill G. was referring to a kernel EXPORT_API macros. The problem is
it has nothing to do with compiler attributes. That macros generates a
special section for every function in assembly with a prefix __ksymtab
or something like that. That section contains the original symbol
reference + some meta.

https://github.com/torvalds/linux/blob/master/include/linux/export.h#L97

Then all such sections having the same prefix are merged into one big
section here:

https://github.com/torvalds/linux/blob/master/scripts/module-common.lds

And exported via a global array here:

https://github.com/torvalds/linux/blob/master/kernel/module.c#L379

So essentially this is the same what I am doing, but using some assembly
and a linker script.

Timur and Cyrill can correct me if I am wrong somewhere above.

I would happy to implement something like that but looks like it is
not worth the complexity.

> If a function is not present in the tarantool binary - e.g. 
> dropped as not used from static library - it should not be available 
> anyways. Will it work you, Mons?

All our public C API functions are defined in static libraries, and
many of them are not used in the executable nor used by FFI. And
still they should be available for dynamic user modules (.so, .dylib).

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
                   ` (48 preceding siblings ...)
  2020-04-14  1:27 ` [Tarantool-patches] [PATCH 44/43] build: export src/box/lua/console.c symbols Vladislav Shpilevoy
@ 2020-04-15 23:15 ` Vladislav Shpilevoy
  49 siblings, 0 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-15 23:15 UTC (permalink / raw)
  To: tarantool-patches

With help of Timur there was a discovered a little less
intrusive solution: a little hack with the compiler.

Consider this diff:

====================
diff --git a/src/exports.c b/src/exports.c
index de1892026..47fe1b9bd 100644
--- a/src/exports.c
+++ b/src/exports.c
@@ -30,6 +30,11 @@
  */
 #define EXPORT(func) extern void ** func(void)
 
+#include <time.h>
+
+extern void *bit_unused_function;
+extern void *bit_symbol;
+
 /**
  * The file is a hack to force the linker keep the needed symbols
  * in the result tarantool executable file.
@@ -121,6 +126,11 @@ export_syms(void)
 	const int func_count = sizeof(syms) / sizeof(syms[0]);
 	for (int i = 0; i < func_count; ++i)
 		((void **(*)(void))syms[i])();
+	if (time(NULL) == 0)
+	{
+		((void **(*)(void))bit_unused_function)();
+		((void **(*)(void))bit_symbol)();
+	}
 }
 
 #undef EXPORT
diff --git a/src/lib/bit/bit.c b/src/lib/bit/bit.c
index 72cc94dc3..94fe75408 100644
--- a/src/lib/bit/bit.c
+++ b/src/lib/bit/bit.c
@@ -31,6 +31,15 @@
 
 #include "bit/bit.h"
 
+void
+bit_unused_function(void)
+{
+	printf("Unused\n");
+	return;
+}
+
+int bit_symbol = 0;
+
 extern inline uint8_t
 load_u8(const void *p);
 
====================

As you can see, I managed to reference the needed symbols from a
static library without doing any includes. It means, we can
resurrect ffi_syms.c like it was before, but in a much simpler
manner, with 0 dependencies. Only extern void * of needed
variables and functions.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-15 21:58                         ` Vladislav Shpilevoy
@ 2020-04-16 12:13                           ` Cyrill Gorcunov
  2020-04-16 20:30                             ` Vladislav Shpilevoy
  0 siblings, 1 reply; 76+ messages in thread
From: Cyrill Gorcunov @ 2020-04-16 12:13 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On Wed, Apr 15, 2020 at 11:58:06PM +0200, Vladislav Shpilevoy wrote:
> >>
> > This could be done with approach from @cyrillos, AFAIU. These functions
> > should be annotated in the code, rather than collected in a separate 
> > list.
> 
> Yeah, the problem is that there is no a compiler option, which would
> prevent removal of certain unused symbols defined in static libraries,
> when they are merged into one executable.

Actually no, if symbols are reffered in executable they won't be vanished.
Accessing symbols should be done in transparent way. IOW, I think of
similar to kernel approach:

 - provide EXPORT_SYMBOL helper (macro which would put it into a section)
 - generate a special bootstrap routine which would access the cummulative
   symbols in the gathered section (linker must not drop it I think)

But this is only ideas which I didn't dive into technical details yet
and I refuse to do it in a rush! If this symbols are really that needed
then Vladislav approach should do the trick and we could switch to another
sheme transparently.

> You can either export all of them using whole-archive option, or
> export a list via the option used on the master branch now (but that
> masks out all other symbols).
> 
> Cyrill G. was referring to a kernel EXPORT_API macros. The problem is
> it has nothing to do with compiler attributes. That macros generates a
> special section for every function in assembly with a prefix __ksymtab

Not for every, only for those which are market with EXPORT_SYMBOL[_x]

> or something like that. That section contains the original symbol
> reference + some meta.

The meta actually is the virtual address and it is needed the kernel
would test checksum on start to be sure that we're not corrupted.

> https://github.com/torvalds/linux/blob/master/include/linux/export.h#L97
> 
> Then all such sections having the same prefix are merged into one big
> section here:
> 
> https://github.com/torvalds/linux/blob/master/scripts/module-common.lds
> 
> And exported via a global array here:
> 
> https://github.com/torvalds/linux/blob/master/kernel/module.c#L379
> 
> So essentially this is the same what I am doing, but using some assembly
> and a linker script.
> 
> Timur and Cyrill can correct me if I am wrong somewhere above.

Yup, correct.

> I would happy to implement something like that but looks like it is
> not worth the complexity.

As to me this is a way better in long term than current approach.
I like to see immediately that some symbol is exported instead of
stepping into extra/exports or whatever.

But again, as I said I hate to do it in a rush and any scheme you
provide now is ok for me sice we can change it transparently if we will.

> 
> > If a function is not present in the tarantool binary - e.g. 
> > dropped as not used from static library - it should not be available 
> > anyways. Will it work you, Mons?
> 
> All our public C API functions are defined in static libraries, and
> many of them are not used in the executable nor used by FFI. And
> still they should be available for dynamic user modules (.so, .dylib).

	Cyrill

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-16 12:13                           ` Cyrill Gorcunov
@ 2020-04-16 20:30                             ` Vladislav Shpilevoy
  2020-04-17  7:48                               ` Timur Safin
  2020-04-17  8:29                               ` Cyrill Gorcunov
  0 siblings, 2 replies; 76+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-16 20:30 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tarantool-patches

>>>>
>>> This could be done with approach from @cyrillos, AFAIU. These functions
>>> should be annotated in the code, rather than collected in a separate 
>>> list.
>>
>> Yeah, the problem is that there is no a compiler option, which would
>> prevent removal of certain unused symbols defined in static libraries,
>> when they are merged into one executable.
> 
> Actually no, if symbols are reffered in executable they won't be vanished.

Yeah, that is what I said - 'unused symbols', and on what my patch is
based. Don't see any contradictions.

>> I would happy to implement something like that but looks like it is
>> not worth the complexity.
> 
> As to me this is a way better in long term than current approach.
> I like to see immediately that some symbol is exported instead of
> stepping into extra/exports or whatever.

Seems like people keep ignoring my point about us not always
being able to add the macros to the place, where a symbol is
defined. I repeat:

  We  not  always  can/want  change  files  where  symbols  are
  defined.  Timur, Sergey, Cyrill - please,  realize  that.

I said it in private chats I don't know how many times already,
and in emails too. Every single attempt to bring that up was
ignored.

Some libraries, such as from third_party/, has nothing to do
with a few of their symbols needed in FFI in our src/ folder, or
considered public symbols in module.h.

For example, we want to export many things from luajit library,
because user's dynamic modules should be able to use all Lua C API
functions in their code. We can't just interfere into luajit with
our custom sections and linker scripts. It would break the module
isolation. The same can be said for all other modules not located
right inside tarantool/tarantool repository.

What if we will ever need to export something from curl? We can't
patch it, because Tarantool should be able to use vanilla curl, not
only our fork. We can't change library source code in such cases.

Or what if we ever take h2o http library? We can't just go and mark
whatever symbols we find here when we want them in FFI. We need to
export them by tarantool/tarantool means.

The only thing we can mark for export right where it is defined is
our own files in the main tarantool repository. Even submodules should
not be affected by this, such as src/lib/small.

When we want to export something from independent modules and libraries,
we need to do that in tarantool/tarantool, in dedicated places. For
example, if I want some parts of OpenSSL exported, I should do that
where it is needed: in src/lua/digest.c. I shouldn't patch OpenSSL.

But when I want to export symbols from src/box - I can do that right
in places where these symbols are defined.

That magic macros EXPORT_API should be able to work even when we
write it not right where the symbol is defined. Like in the kernel,
from what I understand.

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-16 20:30                             ` Vladislav Shpilevoy
@ 2020-04-17  7:48                               ` Timur Safin
  2020-04-17  8:29                               ` Cyrill Gorcunov
  1 sibling, 0 replies; 76+ messages in thread
From: Timur Safin @ 2020-04-17  7:48 UTC (permalink / raw)
  To: 'Vladislav Shpilevoy', 'Cyrill Gorcunov'
  Cc: tarantool-patches



: -----Original Message-----
: From: Tarantool-patches <tarantool-patches-bounces@dev.tarantool.org> On
: Behalf Of Vladislav Shpilevoy
...

: 
: Seems like people keep ignoring my point about us not always
: being able to add the macros to the place, where a symbol is
: defined. I repeat:
: 
:   We  not  always  can/want  change  files  where  symbols  are
:   defined.  Timur, Sergey, Cyrill - please,  realize  that.
: 
: I said it in private chats I don't know how many times already,
: and in emails too. Every single attempt to bring that up was
: ignored.
: 
: Some libraries, such as from third_party/, has nothing to do
: with a few of their symbols needed in FFI in our src/ folder, or
: considered public symbols in module.h.
: 
: For example, we want to export many things from luajit library,
: because user's dynamic modules should be able to use all Lua C API
: functions in their code. We can't just interfere into luajit with
: our custom sections and linker scripts. It would break the module
: isolation. The same can be said for all other modules not located
: right inside tarantool/tarantool repository.
: 
: What if we will ever need to export something from curl? We can't
: patch it, because Tarantool should be able to use vanilla curl, not
: only our fork. We can't change library source code in such cases.
: 
: Or what if we ever take h2o http library? We can't just go and mark
: whatever symbols we find here when we want them in FFI. We need to
: export them by tarantool/tarantool means.
: 
: The only thing we can mark for export right where it is defined is
: our own files in the main tarantool repository. Even submodules should
: not be affected by this, such as src/lib/small.
: 
: When we want to export something from independent modules and libraries,
: we need to do that in tarantool/tarantool, in dedicated places. For
: example, if I want some parts of OpenSSL exported, I should do that
: where it is needed: in src/lua/digest.c. I shouldn't patch OpenSSL.
: 
: But when I want to export symbols from src/box - I can do that right
: in places where these symbols are defined.
: 
: That magic macros EXPORT_API should be able to work even when we
: write it not right where the symbol is defined. Like in the kernel,
: from what I understand.

Now I hear you, bro!
Although it's possible to export symbol alias elsewhere, outside of 3rd party codebase, and do all the dirty symbol aliasing tricks using something similar to EXPORT* macro in kernel. But, to be honest - it's not worth all the complexities introduced. The simple linker export symbols list will be much simple and still serve our purposes.

So for curl and openssl, at least export symbols lists look like the preferred way here (and may be for small, but to less degree).

And although, _personally_, I'd still much prefer to have our own symbols annotated in the code with EXPORT--like macros, but it will be inconsistent with 3rd party, and will not provide much added value.

So looks like the simplest way here is to take Kostja advice and restore original approach from ages ago. (Well with some simplifications which we could use there to avoid unnecessary headers inclusion at the exporting function).

[It was fun to play with linker loader scripts, and learn new/old linker tricks, but apparently the simpler approach is better here in a longer run.]

Regards,
Timur 

^ permalink raw reply	[flat|nested] 76+ messages in thread

* Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols
  2020-04-16 20:30                             ` Vladislav Shpilevoy
  2020-04-17  7:48                               ` Timur Safin
@ 2020-04-17  8:29                               ` Cyrill Gorcunov
  1 sibling, 0 replies; 76+ messages in thread
From: Cyrill Gorcunov @ 2020-04-17  8:29 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On Thu, Apr 16, 2020 at 10:30:47PM +0200, Vladislav Shpilevoy wrote:
...
> 
> Seems like people keep ignoring my point about us not always
> being able to add the macros to the place, where a symbol is
> defined. I repeat:
> 
>   We  not  always  can/want  change  files  where  symbols  are
>   defined.  Timur, Sergey, Cyrill - please,  realize  that.
> 
> I said it in private chats I don't know how many times already,
> and in emails too. Every single attempt to bring that up was
> ignored.

Sorry, Vlad, I've been drown in messages and seems to miss this
point.

^ permalink raw reply	[flat|nested] 76+ messages in thread

end of thread, other threads:[~2020-04-17  8:29 UTC | newest]

Thread overview: 76+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12  0:12 [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 01/43] cmake: remove double usage of some source files Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 10/43] build: export src/lib/core/fiber.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 11/43] build: export src/lua/init.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 12/43] build: export src/lib/core/port.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 13/43] build: export src/lib/csv/csv.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 14/43] build: export src/title.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 15/43] build: export src/lua/tnt_iconv.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 16/43] build: export src/lib/core/exception.cc symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 17/43] build: export src/lib/uuid/tt_uuid.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 18/43] build: export src/lib/core/say.c symbols Vladislav Shpilevoy
2020-04-12  0:12 ` [Tarantool-patches] [PATCH 19/43] build: export src/lib/uri/uri.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 02/43] cmake: remove dynamic-list linker option Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 20/43] build: export third_party/PMurHash.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 21/43] build: export src/crc32.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 22/43] build: export src/lua/msgpack.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 23/43] build: export src/main.cc symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 24/43] build: export src/box/space.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 25/43] build: export src/box/schema.cc symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 26/43] build: export src/lib/crypto/crypto.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 27/43] build: export src/lua/buffer.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 28/43] build: export src/lib/swim/swim.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 29/43] build: export src/lib/core/fiber_cond.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 03/43] build: export src/lib/core/clock.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 30/43] build: export src/lib/core/coio.cc symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 31/43] build: export src/lua/utils.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 32/43] build: export src/box/lua/tuple.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 33/43] build: export src/lua/error.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 34/43] build: export src/box/txn.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 35/43] build: export src/box/key_def.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 36/43] build: export src/box/tuple.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 37/43] build: export src/box/index.cc symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 38/43] build: export src/box/box.cc symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 39/43] build: export src/box/error.cc symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 04/43] build: export src/scramble.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 40/43] build: export src/lib/core/diag.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 41/43] build: export src/lib/core/latch.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 42/43] build: export src/lua/string.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 43/43] build: export public Lua symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 05/43] build: export src/lua/socket.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 06/43] build: export third_party/base64.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 07/43] build: export src/lua/digest.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 08/43] build: export src/lib/salad/guava.c symbols Vladislav Shpilevoy
2020-04-12  0:13 ` [Tarantool-patches] [PATCH 09/43] build: export src/lib/core/random.c symbols Vladislav Shpilevoy
2020-04-14 18:14   ` Timur Safin
2020-04-12 11:34 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Konstantin Osipov
2020-04-12 14:05   ` Vladislav Shpilevoy
2020-04-13  9:40     ` Konstantin Osipov
2020-04-13  9:42       ` Konstantin Osipov
2020-04-13 13:53         ` Vladislav Shpilevoy
2020-04-13 14:15           ` Konstantin Osipov
2020-04-13 14:21             ` Vladislav Shpilevoy
2020-04-13 19:49           ` Sergey Ostanevich
2020-04-13 21:01             ` Vladislav Shpilevoy
2020-04-13 21:38               ` Konstantin Osipov
2020-04-14 18:01                 ` Timur Safin
2020-04-14 18:26                   ` Timur Safin
2020-04-14 20:41                   ` 'Konstantin Osipov'
2020-04-15 10:28                     ` Mons Anderson
2020-04-15 10:40                     ` Mons Anderson
2020-04-15 10:50                       ` sergos
2020-04-15 21:58                         ` Vladislav Shpilevoy
2020-04-16 12:13                           ` Cyrill Gorcunov
2020-04-16 20:30                             ` Vladislav Shpilevoy
2020-04-17  7:48                               ` Timur Safin
2020-04-17  8:29                               ` Cyrill Gorcunov
2020-04-15 11:27                       ` Konstantin Osipov
2020-04-12 14:25 ` Vladislav Shpilevoy
2020-04-12 20:18 ` Vladislav Shpilevoy
2020-04-13 14:26 ` Vladislav Shpilevoy
2020-04-13 16:44   ` Cyrill Gorcunov
2020-04-13 17:57     ` Vladislav Shpilevoy
2020-04-13 18:17       ` Cyrill Gorcunov
2020-04-14  1:15 ` Vladislav Shpilevoy
2020-04-14  1:27 ` [Tarantool-patches] [PATCH 44/43] build: export src/box/lua/console.c symbols Vladislav Shpilevoy
2020-04-15 23:15 ` [Tarantool-patches] [PATCH 00/43] Unhide symbols Vladislav Shpilevoy

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