On Wed, Sep 25, 2024 at 01:30:55PM +0200, Jakub Jelinek wrote: > On Wed, Sep 25, 2024 at 12:18:07PM +0100, Jonathan Wakely wrote: > > > > And whether similarly we couldn't use > > > > __attribute__((__visibility__ ("hidden"))) on the static block scope > > > > vars for C++ (again, if compiler supports that), so that the changes > > > > don't affect ABI of C++ libraries. > > > > > > That sounds good too. > > > > Can you use visibility attributes on a local static? I get a warning > > that it's ignored. > > Indeed :( > > And #pragma GCC visibility push(hidden)/#pragma GCC visibility pop around > just the static block scope var definition does nothing. > If it is around the whole inline function though, then it seems to work. > Though, unsure if we want that around the whole header; wonder what it would > do with the weakrefs. > > Jakub >
Thanks for the thoughts. WRT visibility, it looks like the main gthr.h surrounds the whole function in a #ifndef HIDE_EXPORTS #pragma GCC visibility push(default) #endif block, though I can't quite work out what the purpose of that is here (since everything is currently internal linkage to start with). But it sounds like doing something like #ifdef __has_attribute # if __has_attribute(__always_inline__) # define __GTHREAD_ALWAYS_INLINE __attribute__((__always_inline__)) # endif #endif #ifndef __GTHREAD_ALWAYS_INLINE # define __GTHREAD_ALWAYS_INLINE #endif #ifdef __cplusplus # define __GTHREAD_INLINE inline __GTHREAD_ALWAYS_INLINE #else # define __GTHREAD_INLINE static inline #endif and then marking maybe even just the new inline functions with visibility hidden should be OK? Nathaniel