mirror of
https://git.tukaani.org/xz.git
synced 2024-04-04 12:36:23 +02:00
Build: Require attribute no_profile_instrument_function for ifunc usage.
Using __attribute__((__no_profile_instrument_function__)) on the ifunc resolver works around a bug in GCC -fprofile-generate: it adds profiling code even to ifunc resolvers which can make the ifunc resolver crash at program startup. This attribute was not introduced until GCC 7 and Clang 13, so ifunc won't be used with prior versions of these compilers. This bug was brought to our attention by: https://bugs.gentoo.org/925415 And was reported to upstream GCC by: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11411
This commit is contained in:
parent
7eeadd279a
commit
e5faaebbcf
2 changed files with 14 additions and 0 deletions
|
@ -1082,6 +1082,13 @@ if(USE_ATTR_IFUNC STREQUAL "auto")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void func(void) { return; }
|
static void func(void) { return; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The attribute __no_profile_instrument_function__ is
|
||||||
|
* needed with GCC to prevent improper instrumentation in
|
||||||
|
* the ifunc resolver.
|
||||||
|
*/
|
||||||
|
__attribute__((__no_profile_instrument_function__))
|
||||||
static void (*resolve_func(void)) (void) { return func; }
|
static void (*resolve_func(void)) (void) { return func; }
|
||||||
void func_ifunc(void)
|
void func_ifunc(void)
|
||||||
__attribute__((__ifunc__(\"resolve_func\")));
|
__attribute__((__ifunc__(\"resolve_func\")));
|
||||||
|
|
|
@ -915,6 +915,13 @@ if test "x$enable_ifunc" = xauto ; then
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void func(void) { return; }
|
static void func(void) { return; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The attribute __no_profile_instrument_function__ is
|
||||||
|
* needed with GCC to prevent improper instrumentation in
|
||||||
|
* the ifunc resolver.
|
||||||
|
*/
|
||||||
|
__attribute__((__no_profile_instrument_function__))
|
||||||
static void (*resolve_func (void)) (void) { return func; }
|
static void (*resolve_func (void)) (void) { return func; }
|
||||||
void func_ifunc (void)
|
void func_ifunc (void)
|
||||||
__attribute__((__ifunc__("resolve_func")));
|
__attribute__((__ifunc__("resolve_func")));
|
||||||
|
|
Loading…
Reference in a new issue