aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 458ad49d..fb5d2582 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -763,6 +763,25 @@ check_c_source_compiles("
cmake_pop_check_state()
tuklib_add_definition_if(liblzma HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR)
+# Check for __attribute__((__ifunc__())) support.
+option(CHECK_ATTR_IFUNC "Use __attribute__((__ifunc__())) if supported by \
+the system" ON)
+
+if (CHECK_ATTR_IFUNC)
+ cmake_push_check_state()
+ set(CMAKE_REQUIRED_FLAGS "-Werror")
+ check_c_source_compiles("
+ static void func(void) { return; }
+ static void (*resolve_func (void)) (void) { return func; }
+ void func_ifunc (void)
+ __attribute__ ((__ifunc__ (\"resolve_func\")));
+ int main(void) { return 0; }
+ "
+ HAVE_FUNC_ATTRIBUTE_IFUNC)
+ cmake_pop_check_state()
+ tuklib_add_definition_if(liblzma HAVE_FUNC_ATTRIBUTE_IFUNC)
+endif()
+
# cpuid.h
check_include_file(cpuid.h HAVE_CPUID_H)
tuklib_add_definition_if(liblzma HAVE_CPUID_H)