From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (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 9DA7F4696C3 for ; Thu, 16 Apr 2020 00:58:09 +0300 (MSK) References: <20200412113423.GA28681@atlas> <84069240-b5a4-9e61-09f4-a347fe53d54c@tarantool.org> <20200413094004.GB16266@atlas> <20200413094230.GC16266@atlas> <533bd68c-4bbb-446a-6265-da4f47d451f1@tarantool.org> <20200413194931.GB1734@tarantool.org> <8b7bcee8-b2db-8f2c-d241-687f6b6d6f4b@tarantool.org> <20200413213801.GB12552@atlas> <13d501d61286$af32d4b0$0d987e10$@tarantool.org> <20200414204127.GA32171@atlas> <2207FBB1-CFB8-4F68-BDED-8A2F4509B652@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Wed, 15 Apr 2020 23:58:06 +0200 MIME-Version: 1.0 In-Reply-To: <2207FBB1-CFB8-4F68-BDED-8A2F4509B652@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 00/43] Unhide symbols List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "sergos@tarantool.org" , Mons Anderson Cc: tarantool-patches@dev.tarantool.org >> On 15 Apr 2020, at 13:40, Mons Anderson wrote: >> >> On Tue, Apr 14, 2020 at 11:41 PM Konstantin Osipov >> wrote: >>> >>> * Timur Safin [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).