Re: [PATCH] x86/vdso: include generic __lshrdi3 in 32-bit vDSO

From: Masahiro Yamada
Date: Wed Mar 20 2019 - 09:55:53 EST


On Sat, Mar 16, 2019 at 4:55 AM Matthias Kaehlcke <mka@xxxxxxxxxxxx> wrote:
>
> Building the 32-bit vDSO with a recent clang version fails due
> to undefined symbols:
>
> arch/x86/entry/vdso/vdso32.so.dbg: undefined symbols found
>
> The undefined symbol in this case is __lshrdi3, which is part of
> the compiler runtime library, however the vDSO isn't linked against
> this library.
>
> Include the kernel version of __lshrdi3 in the 32-bit vDSO build.
>
> Signed-off-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
> ---
> diff --git a/lib/lshrdi3.c b/lib/lshrdi3.c
> index 99cfa5721f2d..8a4fc6bcf3a4 100644
> --- a/lib/lshrdi3.c
> +++ b/lib/lshrdi3.c
> @@ -16,7 +16,7 @@
> * to the Free Software Foundation, Inc.
> */
>
> -#include <linux/module.h>
> +#include <linux/export.h>
> #include <linux/libgcc.h>
>
> long long notrace __lshrdi3(long long u, word_type b)
> @@ -42,4 +42,6 @@ long long notrace __lshrdi3(long long u, word_type b)
>
> return w.ll;
> }
> +#ifndef BUILD_VDSO
> EXPORT_SYMBOL(__lshrdi3);
> +#endif


I picked up
https://patchwork.kernel.org/patch/10858565/



I do not know if this patch is still needed.

FYI, just a tip to turn EXPORT_SYMBOL into no-op cleanly.

You can use __DISABLE_EXPORTS
as drivers/firmware/efi/libstub/Makefile does.

See commit f922c4abdf76.


--
Best Regards
Masahiro Yamada