Re: [PATCH v2 0/2] libtraceevent: Fix static library to hide hidden functions

Metin Kaya <[email protected]> Wed, 12 Nov 2025 16:19:54 +0000
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
On 12/11/2025 2:45 pm, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <[email protected]>
> 
> When the static library uses the objects directly to be created, it makes
> all the hidden functions visible to applications that link to it.
> 
> To fix this, create a helper function in the Makefile (redefine_local) that
> will search for all the global functions within the shared library, and if
> they do not start with "tep_", they are renamed to start with "_tep_local_".
> This will keep these function from colliding with the namespace of
> applications that may link to the static library.
> 
> Changes since v1: https://lore.kernel.org/all/[email protected]/
> 
> - Instead of playing tricks to what to add to the static library, just
>    change the static library directly.
> 
> - Modified the meson build to have this as well.
> 
> Steven Rostedt (Google) (2):
>    libtraceevent: Have static library to hide hidden functions
>    libtraceevent: Have meson build rename hidden global functions
> 
>   Makefile.meson          |  15 +-
>   scripts/utils.mk        |   5 +
>   src/Makefile            |   8 +-
>   src/event-parse-api.c   |   6 +-
>   src/event-parse-local.h |  24 ++--
>   src/event-parse.c       | 298 ++++++++++++++++++++--------------------
>   src/event-plugin.c      |   2 +-
>   src/parse-filter.c      |  22 +--
>   8 files changed, 200 insertions(+), 180 deletions(-)
> 

Tested the changes on my Ubuntu-25.04 (6.14.0-34-generic x86_64) with 
HEAD of libtraceevent, libtracefs and trace-cmd.

Could build trace-cmd statically. Did not see any regressions in unit 
tests. Basic smoke test (e.g., trace-cmd record/report) looks fine.

You can have my:

Tested-by: Metin Kaya <[email protected]>
Reviewed-by: Metin Kaya <[email protected]>

Thanks,