Commit 500b3080a2fd27dcd14113235e05ca003ce23190

Guillem Jover 2021-11-28T22:34:59

build: Add new libbsd_symver_weak() macro We will use it for the reworked md5 deprecation logic.

diff --git a/src/local-link.h b/src/local-link.h
index ebc197f..6782d9a 100644
--- a/src/local-link.h
+++ b/src/local-link.h
@@ -42,18 +42,29 @@
 #define libbsd_symver_variant(alias, symbol, version) \
 	extern __typeof__(symbol) symbol \
 		__attribute__((__symver__(#alias "@" #version)))
+
+#define libbsd_symver_weak(alias, symbol, version) \
+	extern __typeof__(symbol) symbol \
+		__attribute__((__symver__(#alias "@" #version), __weak__))
 #  else
 #define libbsd_symver_default(alias, symbol, version) \
 	__asm__(".symver " #symbol "," #alias "@@" #version)
 
 #define libbsd_symver_variant(alias, symbol, version) \
 	__asm__(".symver " #symbol "," #alias "@" #version)
+
+#define libbsd_symver_weak(alias, symbol, version) \
+	libbsd_symver_variant(alias, symbol, version); \
+	extern __typeof__(symbol) alias \
+		__attribute__((__weak__))
 #  endif
 #else
 #define libbsd_symver_default(alias, symbol, version) \
 	extern __typeof__(symbol) alias __attribute__((__alias__(#symbol)))
 
 #define libbsd_symver_variant(alias, symbol, version)
+
+#define libbsd_symver_weak(alias, symbol, version)
 #endif
 
 #endif