[PATCH] um: add __weak for exported functions

Johannes Berg johannes at sipsolutions.net
Sun Feb 12 11:32:04 PST 2023


From: Johannes Berg <johannes.berg at intel.com>

If the exported glibc functions don't exist, we get link
failures. Avoid that by adding __weak so they're allowed
to not exist.

Reported-by: Randy Dunlap <rdunlap at infradead.org>
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 arch/um/os-Linux/user_syms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index fd575ecbcaec..54722c7f884f 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -39,7 +39,7 @@ EXPORT_SYMBOL(printf);
  * good; so the versions of these symbols will always match
  */
 #define EXPORT_SYMBOL_PROTO(sym)       \
-	int sym(void);                  \
+	int sym(void) __weak; \
 	EXPORT_SYMBOL(sym);
 
 extern void readdir64(void) __attribute__((weak));
-- 
2.39.1




More information about the linux-um mailing list