diff --git a/src/ifunc.h b/src/ifunc.h index 4a2e379..d3c2ab6 100644 --- a/src/ifunc.h +++ b/src/ifunc.h @@ -2,10 +2,14 @@ #define _IT_IFUNC_H //! ifunc helpers -#if !IFUNC_PREFIX +#if !defined(IFUNC_PREFIX) #define IFUNC_PREFIX _ifun__ #endif +#if !defined(IFUNC_IMPL_PREFIX) +#define IFUNC_IMPL_PREFIX _impl__ +#endif + #define _IFUNC_STR_(X) #X #define _IFUNC_STR(X) _IFUNC_STR_(X) @@ -16,10 +20,11 @@ #define _IFUNC_PREFIX(X) _IFUNC_PASTE(IFUNC_PREFIX, X) -#define IFUNC_NAME(name, ver) _impl__ ## name ## __ ## ver +#define IFUNC_NAME(name, ver) _IFUNC_PASTE(_IFUNC_PASTE(_IFUNC_PASTE(IFUNC_IMPL_PREFIX, name), __), ver) #define IFUNC_IMPL(name, ver) __attribute__((copy(name))) IFUNC_NAME(name, ver) #define IFUNC_RESOLVER_A(attr, name) __attribute__((returns_nonnull)) (* __attribute__(attr) _IFUNC_PREFIX(name) /*_ifun__ ## name*/ (void)) // When the ifunc resolver wants to return a function pointer that has attributes on it, the attribute inner list (e.g. `(returns_nonnull, const, nonnull)') can be provided as the first argument #define IFUNC_RESOLVER(name) IFUNC_RESOLVER_A((copy(name)), name) -#define IFUNC_DEF(name, params) name params __attribute__((__ifunc__(_IFUNC_PREFIX_S #name))) +//TODO: Find out if changing visibility of IFUNC resolver is sound. If it is, set to hidden or internal. +#define IFUNC_DEF(name, params) name params __attribute__((/*__visibility__("internal"),*/ __ifunc__(_IFUNC_PREFIX_S #name))) #endif /* _IT_IFUNC_H */ diff --git a/src/memfd_secret.c b/src/memfd_secret.c index 4119795..93f8b92 100644 --- a/src/memfd_secret.c +++ b/src/memfd_secret.c @@ -5,6 +5,8 @@ #include +#define IFUNC_PREFIX _$ifun__ +#define IFUNC_IMPL_PREFIX _$impl__ #include "ifunc.h" #include