[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 01/23] include/uk: introduce __weak_alias macro



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 include/uk/essentials.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/uk/essentials.h b/include/uk/essentials.h
index 3c16e308..47e04f7c 100644
--- a/include/uk/essentials.h
+++ b/include/uk/essentials.h
@@ -76,6 +76,16 @@ extern "C" {
 #ifndef __align
 #define __align(bytes)         __attribute__((aligned(bytes)))
 #endif
+/* NOTE: weak aliasing does not work well with link-time optimization
+ * currently. Hopefully this will be fixed in gcc 9. The problem is,
+ * if a weak symbol is referenced in the library, gcc resolves calls
+ * to that weak symbol during the first round of linking. Even if a
+ * strong symbol is provided in the other library.
+ */
+#ifndef __weak_alias
+#define __weak_alias(old, new) \
+       extern __typeof(old) new __attribute__((weak, alias(#old)))
+#endif
 
 /**
   * Mark a function as constructor
-- 
2.19.2


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.