Skip to content

Commit

Permalink
cmake: remove dynamic-list linker option
Browse files Browse the repository at this point in the history
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_syms()' declared, which takes a
pointer at 'test()' and seemingly does something with it (or
actually does - it does not matter):

    void
    export_syms()
    {
        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 with 0 dependencies in the export file.

Closes #2971
  • Loading branch information
Gerold103 committed May 18, 2020
1 parent 5517189 commit 03790ac
Show file tree
Hide file tree
Showing 10 changed files with 560 additions and 482 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -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
Expand Down

0 comments on commit 03790ac

Please sign in to comment.