On Wed, 09 Aug 2023 11:54:15 +0000 bugzilla-daemon@xxxxxxxxxx wrote: https://bugzilla.kernel.org/show_bug.cgi?id=217768 --- Comment #1 from Douglas RAILLARD (douglas.raillard@xxxxxxx) --- > So since there is no way to get a visibility-based namespace in C that works > for libs with more than one ELF file in it (i.e. static lib with more than one > .o), the options are: Hi Douglas, Thanks for looking into this and debugging it. Yeah, I figured that __hidden was going to bite me sooner or later. :-/ > > 1. Change the name of one of the definitions. > 2. Move that function to a 3rd library and make the other 2 depend on it. > 3. pre-link all the object files in libtracefs.a into a single .o > > > This patch implements 3. for libtracefs and fixes static build of trace-cmd. A > similar patch would be needed for libtraceevent and libtracecmd even though > there is currently no symbol conflict (by chance): Actually, I prefer #1. #2 is out of the question. But trace-cmd actually depends on hidden functions being accessible during linking. That is, the trace-cmd binary uses __hidden functions in libtracecmd. The __hidden() just means that they should not be relied on. Perhaps we need to make all __hidden functions have a prefix. Hmm, perhaps just add: "_tracecmd_" or "_tracefs_" to the front of it? That is, for strstrip() in trace-cmd, rename it to: _tracecmd_strstrip() and for libtracefs: _libtracefs_strstrip() by convention, anything that starts with "tracecmd_" or "tracefs_" should be exposed and considered API. We can have that anything with "_tracecmd_" or "_tracefs_" is to be hidden and not part of the API. -- Steve