]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
Add symbol redirection support
authorGuillem Jover <guillem@hadrons.org>
Tue, 22 May 2018 13:43:48 +0000 (15:43 +0200)
committerGuillem Jover <guillem@hadrons.org>
Tue, 22 May 2018 13:45:37 +0000 (15:45 +0200)
We need this to be able to select different version symbols at
compile-time.

include/bsd/sys/cdefs.h

index 98333d19b1882ee67b5676e173eb80e0eb342307..b5c8dad18633f47736332c1269eb4f82e99a1035 100644 (file)
@@ -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
 #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__))