]> git.lttng.org Git - lttng-tools.git/commit
common: Use C ABI for exported lexer functions
authorKienan Stewart <kstewart@efficios.com>
Fri, 13 Dec 2024 16:51:21 +0000 (11:51 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 16 Jan 2025 19:20:31 +0000 (19:20 +0000)
commitfadceb83e99bdd6b6c4c9293e302f0397e6243d5
tree2c6658fec433a17bfa844be882e2763d14b5fe3c
parent8b8c88ac9256dc80f596bccd5ca1061f2a345af4
common: Use C ABI for exported lexer functions

Observed issue
==============

When examining the ABI changes between liblttng-ctl.so in lttng-tools 2.13 and
liblttng-ctl.so in lttng-tools 2.14, a large number of functions were
flagged as removed and added.

To produce the diff:

```
abidw stable-2.13/src/lib/lttng-ctl/.libs/liblttng-ctl.so.0.0.0 \
    > liblttng-ctl-stable-2.13.xml
abidw master/src/lib/lttng-ctl/.libs/liblttng-ctl.so.0.0.0 > liblttng-ctl-master.xml
abidiff \
    liblttng-ctl-stable-2.13.xml \
    liblttng-ctl-master.xml
```

Example of the removed and added functions (cut before brevity):

```
31 Removed functions:
...
  [D] 'function void lttng_yyset_in(FILE*, yyscan_t)'    {lttng_yyset_in}
  [D] 'function void lttng_yyset_lineno(int, yyscan_t)'    {lttng_yyset_lineno}
  [D] 'function void lttng_yyset_lval(yyscan_t)'    {lttng_yyset_lval}
  [D] 'function void lttng_yyset_out(FILE*, yyscan_t)'
  {lttng_yyset_out}

42 Added functions:
...
  [A] 'function void lttng_yyset_in(FILE*, yyscan_t)'    {_Z14lttng_yyset_inP8_IO_FILEPv}
  [A] 'function void lttng_yyset_lineno(int, yyscan_t)'    {_Z18lttng_yyset_linenoiPv}
  [A] 'function void lttng_yyset_lval(yyscan_t)'    {_Z16lttng_yyset_lvalP7YYSTYPEPv}
  [A] 'function void lttng_yyset_out(FILE*, yyscan_t)'    {_Z15lttng_yyset_outP8_IO_FILEPv}
  [A] 'method void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char co
nst*>(const char*, const char*, std::forward_iterator_tag)'    {_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_
M_constructIPKcEEvT_S8_St20forward_iterator_tag}
  [A] 'method void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(
char*, char*, std::forward_iterator_tag)'    {_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT
_S7_St20forward_iterator_tag}
  [A] 'method void std::vector<int, std::allocator<int> >::_M_realloc_append<int const&>()'    {_ZNSt6vectorIiSaIiEE17_M
_realloc_appendIJRKiEEEvDpOT_}
  [A] 'method void std::vector<int, std::allocator<int> >::reserve(std::__new_allocator<int>::size_type)'    {_ZNSt6vect
orIiSaIiEE7reserveEm}
```

Cause
=====

The lexer is now compiled with C++; however, the exported functions
that are explicitly marked for exportation (and end up globally visible in
liblttng-ctl), are not marked to use the C ABI.

Solution
========

Mark the exports with `extern "C" {...}` when compiling C++.

Known drawbacks
===============

None

Change-Id: I33caf05bc09315d4286682e222ee8648857e510b
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/filter/filter-lexer.lpp
This page took 0.029962 seconds and 4 git commands to generate.