summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-11-21 10:43:26 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-11-21 10:43:26 -0500
commita201b3e237e1994e0ee3668b25287fc9fdd574f9 (patch)
tree4321c20a17185c1bb717c81033c32da690a997e8 /src
parent8b24de3882ff5a3e33b82ab20bb4eadf134cf559 (diff)
downloadbfs-a201b3e237e1994e0ee3668b25287fc9fdd574f9.tar.xz
config: Support target_clones on more platforms
Diffstat (limited to 'src')
-rw-r--r--src/config.h7
-rw-r--r--src/trie.c2
2 files changed, 8 insertions, 1 deletions
diff --git a/src/config.h b/src/config.h
index 5bd49de..0822e3c 100644
--- a/src/config.h
+++ b/src/config.h
@@ -186,4 +186,11 @@
# define BFS_FORMATTER(fmt, args)
#endif
+/**
+ * Check if function multiversioning via GNU indirect functions (ifunc) is supported.
+ */
+#if !defined(BFS_TARGET_CLONES) && __has_attribute(target_clones) && (__GLIBC__ || __FreeBSD__ || __NetBSD__)
+# define BFS_TARGET_CLONES true
+#endif
+
#endif // BFS_CONFIG_H
diff --git a/src/trie.c b/src/trie.c
index 1434356..caa38a7 100644
--- a/src/trie.c
+++ b/src/trie.c
@@ -107,7 +107,7 @@
# error "This trie implementation assumes 8-bit bytes."
#endif
-#if __GLIBC__ && __has_attribute(target_clones) && (__i386__ || __x86_64__)
+#if BFS_TARGET_CLONES && (__i386__ || __x86_64__)
# define TARGET_CLONES_POPCNT __attribute__((target_clones("popcnt", "default")))
#else
# define TARGET_CLONES_POPCNT