[PATCH] um: add __weak for exported functions

Randy Dunlap rdunlap at infradead.org
Sun Feb 12 13:34:38 PST 2023



On 2/12/23 11:32, Johannes Berg wrote:
> 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>
Acked-by: Randy Dunlap <rdunlap at infradead.org>
Tested-by: Randy Dunlap <rdunlap at infradead.org>

Thanks.

> ---
>  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));

-- 
~Randy



More information about the linux-um mailing list