Add symbol redirection support We need this to be able to select different version symbols at compile-time.
diff --git a/include/bsd/sys/cdefs.h b/include/bsd/sys/cdefs.h
index 98333d1..b5c8dad 100644
--- a/include/bsd/sys/cdefs.h
+++ b/include/bsd/sys/cdefs.h
@@ -76,6 +76,9 @@
#define _SYS_CDEFS_H
#endif
+#define LIBBSD_CONCAT(x, y) x ## y
+#define LIBBSD_STRING(x) #x
+
#ifdef __GNUC__
#define LIBBSD_GCC_VERSION (__GNUC__ << 8 | __GNUC_MINOR__)
#else
@@ -90,6 +93,12 @@
#define LIBBSD_DEPRECATED(x)
#endif
+#if LIBBSD_GCC_VERSION >= 0x0200
+#define LIBBSD_REDIRECT(name, proto, alias) name proto __asm__(LIBBSD_ASMNAME(#alias))
+#endif
+#define LIBBSD_ASMNAME(cname) LIBBSD_ASMNAME_PREFIX(__USER_LABEL_PREFIX__, cname)
+#define LIBBSD_ASMNAME_PREFIX(prefix, cname) LIBBSD_STRING(prefix) cname
+
#ifndef __dead2
# if LIBBSD_GCC_VERSION >= 0x0207
# define __dead2 __attribute__((__noreturn__))