aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2024-04-09 17:43:16 +0300
committerLasse Collin <lasse.collin@tukaani.org>2024-04-09 18:22:27 +0300
commit689ae2427342a2ea1206eb5ca08301baf410e7e0 (patch)
tree34c51083c01e2988df94adaf24e1abb1934a9171 /configure.ac
parenttests/files/README: Update the main heading. (diff)
downloadxz-689ae2427342a2ea1206eb5ca08301baf410e7e0.tar.xz
liblzma: Remove ifunc support.
This is *NOT* done for security reasons even though the backdoor relied on the ifunc code. Instead, the reason is that in this project ifunc provides little benefits but it's quite a bit of extra code to support it. The only case where ifunc *might* matter for performance is if the CRC functions are used directly by an application. In normal compression use it's completely irrelevant.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac79
1 files changed, 0 insertions, 79 deletions
diff --git a/configure.ac b/configure.ac
index fb4f3d66..b6f9f8b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -893,85 +893,6 @@ if test "x$enable_small$enable_threads$have_func_attribute_constructor" \
__attribute__((__constructor__))])
fi
-# __attribute__((__ifunc__())) can be used to choose between different
-# implementations of the same function at runtime. This is slightly more
-# efficient than using __attribute__((__constructor__)) and setting
-# a function pointer.
-AC_ARG_ENABLE([ifunc], [AS_HELP_STRING([--enable-ifunc],
- [Use __attribute__((__ifunc__())). Enabled by default on
- GNU/Linux (glibc) and FreeBSD.])],
- [], [enable_ifunc=auto])
-
-# When enable_ifunc is 'auto', allow the use of __attribute__((__ifunc__()))
-# if compiler support is detected and we are building for GNU/Linux (glibc)
-# or FreeBSD. uClibc and musl don't support ifunc in their dynamic linkers
-# but some compilers still accept the attribute when compiling for these
-# C libraries, which results in broken binaries. That's why we need to
-# check which libc is being used.
-if test "x$enable_ifunc" = xauto ; then
- OLD_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -Werror"
- AC_MSG_CHECKING([if __attribute__((__ifunc__())) can be used])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- /*
- * Force a compilation error when not using glibc on Linux
- * or if we are not using FreeBSD. uClibc will define
- * __GLIBC__ but does not support ifunc, so we must have
- * an extra check to disable with uClibc.
- */
- #if defined(__linux__)
- # include <features.h>
- # if !defined(__GLIBC__) || defined(__UCLIBC__)
- compile error
- # endif
- #elif !defined(__FreeBSD__)
- compile error
- #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")));
- /*
- * 'clang -Wall' incorrectly warns that resolve_func is
- * unused (-Wunused-function). Correct assembly output is
- * still produced. This problem exists at least in Clang
- * versions 4 to 17. The following silences the bogus warning:
- */
- void make_clang_quiet(void);
- void make_clang_quiet(void) { resolve_func()(); }
- ]])], [
- enable_ifunc=yes
- ], [
- enable_ifunc=no
- ])
-
- AC_MSG_RESULT([$enable_ifunc])
-
- CFLAGS="$OLD_CFLAGS"
-fi
-
-if test "x$enable_ifunc" = xyes ; then
- AC_DEFINE([HAVE_FUNC_ATTRIBUTE_IFUNC], [1],
- [Define to 1 if __attribute__((__ifunc__()))
- is supported for functions.])
-
- # ifunc explicitly does not work with -fsanitize=address.
- # If configured, it will result in a liblzma build that will fail
- # when liblzma is loaded at runtime (when the ifunc resolver
- # executes).
- AS_CASE([$CFLAGS], [*-fsanitize=*], [AC_MSG_ERROR([
- CFLAGS contains '-fsanitize=' which is incompatible with ifunc.
- Use --disable-ifunc when using '-fsanitize'.])])
-fi
-
###############################################################################
# Checks for library functions.