aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2024-03-05 00:27:31 +0800
committerJia Tan <jiat0218@gmail.com>2024-03-05 01:54:30 +0800
commite5faaebbcf02ea880cfc56edc702d4f7298788ad (patch)
tree4285935df3677af7b3d60bb34db5aef5266cecf0 /configure.ac
parentliblzma: Fix a comment in the RISC-V filter. (diff)
downloadxz-e5faaebbcf02ea880cfc56edc702d4f7298788ad.tar.xz
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
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 446e26e2..176bb9ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -915,6 +915,13 @@ if test "x$enable_ifunc" = xauto ; then
#endif
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; }
void func_ifunc (void)
__attribute__((__ifunc__("resolve_func")));