diff mbox series

MIPS: VDSO: Conditionally export __vdso_gettimeofday()

Message ID 20230816-mips-vdso-cond-export-__vdso_gettimeofday-v1-1-fe725254c782@kernel.org (mailing list archive)
State Accepted
Commit 971fe5095f78b6475c88270aa4b6ee77a791cf25
Headers show
Series MIPS: VDSO: Conditionally export __vdso_gettimeofday() | expand

Commit Message

Nathan Chancellor Aug. 16, 2023, 9:59 p.m. UTC
ld.lld 16.0.0 and newer defaults to '--no-undefined-version', which
causes the following error when CONFIG_MIPS_CLOCK_VSYSCALL is not set:

  ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_gettimeofday' failed: symbol not defined

Only export __vdso_gettimeofday() when it will be present in the final
object file, which clears up the error.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308170532.zxFFv25c-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/mips/vdso/vdso.lds.S | 2 ++
 1 file changed, 2 insertions(+)


---
base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
change-id: 20230816-mips-vdso-cond-export-__vdso_gettimeofday-30ab92c716d4

Best regards,

Comments

Fangrui Song Aug. 16, 2023, 10:14 p.m. UTC | #1
On Wed, Aug 16, 2023 at 2:59 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> ld.lld 16.0.0 and newer defaults to '--no-undefined-version', which
> causes the following error when CONFIG_MIPS_CLOCK_VSYSCALL is not set:
>
>   ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_gettimeofday' failed: symbol not defined
>
> Only export __vdso_gettimeofday() when it will be present in the final
> object file, which clears up the error.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202308170532.zxFFv25c-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  arch/mips/vdso/vdso.lds.S | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S
> index d90b65724d78..836465e3bcb8 100644
> --- a/arch/mips/vdso/vdso.lds.S
> +++ b/arch/mips/vdso/vdso.lds.S
> @@ -94,7 +94,9 @@ VERSION
>  #ifndef CONFIG_MIPS_DISABLE_VDSO
>         global:
>                 __vdso_clock_gettime;
> +#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
>                 __vdso_gettimeofday;
> +#endif
>                 __vdso_clock_getres;
>  #if _MIPS_SIM != _MIPS_SIM_ABI64
>                 __vdso_clock_gettime64;
>
> ---
> base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
> change-id: 20230816-mips-vdso-cond-export-__vdso_gettimeofday-30ab92c716d4
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
>

LGTM as a maintainer of lld/ELF who has fixed some user-space packages
(https://github.com/gentoo/gentoo/pull/29097#issuecomment-1383304538).

Reviewed-by: Fangrui Song <maskray@google.com>
Nick Desaulniers Aug. 16, 2023, 10:41 p.m. UTC | #2
On Wed, Aug 16, 2023 at 2:59 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> ld.lld 16.0.0 and newer defaults to '--no-undefined-version', which
> causes the following error when CONFIG_MIPS_CLOCK_VSYSCALL is not set:
>
>   ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_gettimeofday' failed: symbol not defined
>
> Only export __vdso_gettimeofday() when it will be present in the final
> object file, which clears up the error.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202308170532.zxFFv25c-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  arch/mips/vdso/vdso.lds.S | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S
> index d90b65724d78..836465e3bcb8 100644
> --- a/arch/mips/vdso/vdso.lds.S
> +++ b/arch/mips/vdso/vdso.lds.S
> @@ -94,7 +94,9 @@ VERSION
>  #ifndef CONFIG_MIPS_DISABLE_VDSO
>         global:
>                 __vdso_clock_gettime;
> +#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
>                 __vdso_gettimeofday;
> +#endif
>                 __vdso_clock_getres;
>  #if _MIPS_SIM != _MIPS_SIM_ABI64
>                 __vdso_clock_gettime64;
>
> ---
> base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
> change-id: 20230816-mips-vdso-cond-export-__vdso_gettimeofday-30ab92c716d4
>
> Best regards,
> --
> Nathan Chancellor <nathan@kernel.org>
>
>
Philippe Mathieu-Daudé Aug. 17, 2023, 7:29 a.m. UTC | #3
Hi Nathan,

On 16/8/23 23:59, Nathan Chancellor wrote:
> ld.lld 16.0.0 and newer defaults to '--no-undefined-version', which
> causes the following error when CONFIG_MIPS_CLOCK_VSYSCALL is not set:
> 
>    ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_gettimeofday' failed: symbol not defined
> 
> Only export __vdso_gettimeofday() when it will be present in the final
> object file, which clears up the error.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202308170532.zxFFv25c-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>   arch/mips/vdso/vdso.lds.S | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S
> index d90b65724d78..836465e3bcb8 100644
> --- a/arch/mips/vdso/vdso.lds.S
> +++ b/arch/mips/vdso/vdso.lds.S
> @@ -94,7 +94,9 @@ VERSION
>   #ifndef CONFIG_MIPS_DISABLE_VDSO
>   	global:
>   		__vdso_clock_gettime;
> +#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
>   		__vdso_gettimeofday;
> +#endif

Possibly:
Fixes: 7d2aa4bb90f5 ("mips: Fix gettimeofday() in the vdso library")

Otherwise,
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Thanks,

Phil.
Thomas Bogendoerfer Aug. 23, 2023, 7:22 a.m. UTC | #4
On Wed, Aug 16, 2023 at 02:59:23PM -0700, Nathan Chancellor wrote:
> ld.lld 16.0.0 and newer defaults to '--no-undefined-version', which
> causes the following error when CONFIG_MIPS_CLOCK_VSYSCALL is not set:
> 
>   ld.lld: error: version script assignment of 'LINUX_2.6' to symbol '__vdso_gettimeofday' failed: symbol not defined
> 
> Only export __vdso_gettimeofday() when it will be present in the final
> object file, which clears up the error.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202308170532.zxFFv25c-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  arch/mips/vdso/vdso.lds.S | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S
> index d90b65724d78..836465e3bcb8 100644
> --- a/arch/mips/vdso/vdso.lds.S
> +++ b/arch/mips/vdso/vdso.lds.S
> @@ -94,7 +94,9 @@ VERSION
>  #ifndef CONFIG_MIPS_DISABLE_VDSO
>  	global:
>  		__vdso_clock_gettime;
> +#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
>  		__vdso_gettimeofday;
> +#endif
>  		__vdso_clock_getres;
>  #if _MIPS_SIM != _MIPS_SIM_ABI64
>  		__vdso_clock_gettime64;
> 
> ---
> base-commit: 2ccdd1b13c591d306f0401d98dedc4bdcd02b421
> change-id: 20230816-mips-vdso-cond-export-__vdso_gettimeofday-30ab92c716d4
> 
> Best regards,
> -- 
> Nathan Chancellor <nathan@kernel.org>
> 

applied to mips-next.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/vdso/vdso.lds.S b/arch/mips/vdso/vdso.lds.S
index d90b65724d78..836465e3bcb8 100644
--- a/arch/mips/vdso/vdso.lds.S
+++ b/arch/mips/vdso/vdso.lds.S
@@ -94,7 +94,9 @@  VERSION
 #ifndef CONFIG_MIPS_DISABLE_VDSO
 	global:
 		__vdso_clock_gettime;
+#ifdef CONFIG_MIPS_CLOCK_VSYSCALL
 		__vdso_gettimeofday;
+#endif
 		__vdso_clock_getres;
 #if _MIPS_SIM != _MIPS_SIM_ABI64
 		__vdso_clock_gettime64;