liblttng-ctl: use export list to define exported symbols
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 21 Sep 2021 13:40:37 +0000 (09:40 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 14 Oct 2021 19:43:01 +0000 (15:43 -0400)
Symbols are currently exported by default by liblttng-ctl.so (usable by
other shared libraries / programs using liblttng-ctl.so), so we must use
LTTNG_HIDDEN on all symbols that are meant to be internal to
liblttng-ctl.so.  Of course, this is easy to forget, so over the years
many symbols that were not meant to be exported were exported, and must
now stay exported to avoid breaking the ABI.

As explained here [1], a better method is to make symbols hidden by
default, and mark those we want to be exported as such.  I have tried to
use this, but when subsequently converting the code to C++, I have
noticed that some symbols related to the STL were exported anyway, which
is bad.

The other alternative, implemented in this patch, is to use an explicit
symbol export list [2], using libtool's -export-symbols (which uses the
linker's -version-script option).  Only the symbols listed here are
exported.

So, in practice, this patch:

 - Adds an liblttng-ctl.sym file with the list of exported symbols and
   adjusts the Makefile to use the -export-symbol option
 - Removes LTTNG_HIDDEN and all its uses

abidiff shows no changes for liblttng-ctl.so between before and after
this patch.

[1] https://gcc.gnu.org/wiki/Visibility
[2] https://www.gnu.org/software/libtool/manual/libtool.html#Link-mode

Change-Id: I5d8c558303894b0ad8113c6e52f79a053bb580e1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>

No differences found
This page took 0.02694 seconds and 4 git commands to generate.