From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CF765442BB2 for ; Sun, 12 Apr 2020 03:16:05 +0300 (MSK) Received: by smtp50.i.mail.ru with esmtpa (envelope-from ) id 1jNQI9-0005lJ-9m for tarantool-patches@dev.tarantool.org; Sun, 12 Apr 2020 03:16:05 +0300 From: Vladislav Shpilevoy Date: Sun, 12 Apr 2020 02:13:26 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 43/43] build: export public Lua symbols List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org 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)