diff mbox series

[2/2] MIPS: VDSO: Do not disable VDSO when linking with ld.lld

Message ID 20200419180445.26722-2-natechancellor@gmail.com
State New, archived
Headers show
Series [1/2] kbuild: add CONFIG_LD_IS_LLD | expand

Commit Message

Nathan Chancellor April 19, 2020, 6:04 p.m. UTC
Currently, when linking with ld.lld, this warning pops up:

    arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25

ld-ifversion calls ld-version, which calls scripts/ld-version.sh, which
is specific to GNU ld. ld.lld has a completely different versioning
scheme (as it follows LLVM's versioning) and it does not have the issue
mentioned in the comment above this block so it should not be subjected
to this check.

With this patch, the VDSO successfully links and shows P_MIPS_PC32 in
vgettimeofday.o.

$ llvm-objdump -Dr arch/mips/vdso/vgettimeofday.o | grep R_MIPS_PC32
			00000024:  R_MIPS_PC32	_start
			000000b0:  R_MIPS_PC32	_start
			000002bc:  R_MIPS_PC32	_start
			0000036c:  R_MIPS_PC32	_start
			00000468:  R_MIPS_PC32	_start

Link: https://github.com/ClangBuiltLinux/linux/issues/785
Link: https://github.com/llvm/llvm-project/commit/e364e2e9ce50c12eb2bf093560e1a1a8544d455a
Reported-by: Dmitry Golovin <dima@golovin.in>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 arch/mips/vdso/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Nathan Chancellor April 19, 2020, 6:17 p.m. UTC | #1
On Sun, Apr 19, 2020 at 11:04:45AM -0700, Nathan Chancellor wrote:
> Currently, when linking with ld.lld, this warning pops up:
> 
>     arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25
> 
> ld-ifversion calls ld-version, which calls scripts/ld-version.sh, which
> is specific to GNU ld. ld.lld has a completely different versioning
> scheme (as it follows LLVM's versioning) and it does not have the issue
> mentioned in the comment above this block so it should not be subjected
> to this check.
> 
> With this patch, the VDSO successfully links and shows P_MIPS_PC32 in
> vgettimeofday.o.
> 
> $ llvm-objdump -Dr arch/mips/vdso/vgettimeofday.o | grep R_MIPS_PC32
> 			00000024:  R_MIPS_PC32	_start
> 			000000b0:  R_MIPS_PC32	_start
> 			000002bc:  R_MIPS_PC32	_start
> 			0000036c:  R_MIPS_PC32	_start
> 			00000468:  R_MIPS_PC32	_start
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/785
> Link: https://github.com/llvm/llvm-project/commit/e364e2e9ce50c12eb2bf093560e1a1a8544d455a
> Reported-by: Dmitry Golovin <dima@golovin.in>
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  arch/mips/vdso/Makefile | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
> index d7fe8408603e..f99e583d14a1 100644
> --- a/arch/mips/vdso/Makefile
> +++ b/arch/mips/vdso/Makefile
> @@ -65,9 +65,11 @@ DISABLE_VDSO := n
>  # the comments on that file.
>  #
>  ifndef CONFIG_CPU_MIPSR6
> -  ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
> -    $(warning MIPS VDSO requires binutils >= 2.25)
> -    DISABLE_VDSO := y
> +  ifndef CONFIG_LD_IS_LLD
> +    ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
> +      $(warning MIPS VDSO requires binutils >= 2.25)
> +      DISABLE_VDSO := y
> +    endif
>    endif
>  endif
>  
> -- 
> 2.26.1
> 

Hmmm, I still see this warning when first runing make <config>... I
assume because this Makefile gets parsed before Kconfig runs.

Perhaps it would be better to check if ld-version is 0 (since that means
we are not using GNU ld):

ifneq ($(call ld-ifversion, -eq, 0, y),y)

I am open to suggestions though.

Cheers,
Nathan
Masahiro Yamada April 19, 2020, 7:32 p.m. UTC | #2
On Mon, Apr 20, 2020 at 3:17 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Sun, Apr 19, 2020 at 11:04:45AM -0700, Nathan Chancellor wrote:
> > Currently, when linking with ld.lld, this warning pops up:
> >
> >     arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25
> >
> > ld-ifversion calls ld-version, which calls scripts/ld-version.sh, which
> > is specific to GNU ld. ld.lld has a completely different versioning
> > scheme (as it follows LLVM's versioning) and it does not have the issue
> > mentioned in the comment above this block so it should not be subjected
> > to this check.
> >
> > With this patch, the VDSO successfully links and shows P_MIPS_PC32 in
> > vgettimeofday.o.
> >
> > $ llvm-objdump -Dr arch/mips/vdso/vgettimeofday.o | grep R_MIPS_PC32
> >                       00000024:  R_MIPS_PC32  _start
> >                       000000b0:  R_MIPS_PC32  _start
> >                       000002bc:  R_MIPS_PC32  _start
> >                       0000036c:  R_MIPS_PC32  _start
> >                       00000468:  R_MIPS_PC32  _start
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/785
> > Link: https://github.com/llvm/llvm-project/commit/e364e2e9ce50c12eb2bf093560e1a1a8544d455a
> > Reported-by: Dmitry Golovin <dima@golovin.in>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  arch/mips/vdso/Makefile | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
> > index d7fe8408603e..f99e583d14a1 100644
> > --- a/arch/mips/vdso/Makefile
> > +++ b/arch/mips/vdso/Makefile
> > @@ -65,9 +65,11 @@ DISABLE_VDSO := n
> >  # the comments on that file.
> >  #
> >  ifndef CONFIG_CPU_MIPSR6
> > -  ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
> > -    $(warning MIPS VDSO requires binutils >= 2.25)
> > -    DISABLE_VDSO := y
> > +  ifndef CONFIG_LD_IS_LLD
> > +    ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
> > +      $(warning MIPS VDSO requires binutils >= 2.25)
> > +      DISABLE_VDSO := y
> > +    endif
> >    endif
> >  endif
> >
> > --
> > 2.26.1
> >
>
> Hmmm, I still see this warning when first runing make <config>... I
> assume because this Makefile gets parsed before Kconfig runs.


I do not see the warning for 'make <config>'.

Could you tell me how to reproduce it?


For cleaning, indeed, i see the warning.


$ make ARCH=mips  LLVM=1 clean
arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25








>
> Perhaps it would be better to check if ld-version is 0 (since that means
> we are not using GNU ld):
>
> ifneq ($(call ld-ifversion, -eq, 0, y),y)
>
> I am open to suggestions though.
>
> Cheers,
> Nathan
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200419181715.GA36234%40ubuntu-s3-xlarge-x86.
Nathan Chancellor April 19, 2020, 8:05 p.m. UTC | #3
Hi Masahiro,

On Mon, Apr 20, 2020 at 04:32:20AM +0900, Masahiro Yamada wrote:
> On Mon, Apr 20, 2020 at 3:17 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Sun, Apr 19, 2020 at 11:04:45AM -0700, Nathan Chancellor wrote:
> > > Currently, when linking with ld.lld, this warning pops up:
> > >
> > >     arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25
> > >
> > > ld-ifversion calls ld-version, which calls scripts/ld-version.sh, which
> > > is specific to GNU ld. ld.lld has a completely different versioning
> > > scheme (as it follows LLVM's versioning) and it does not have the issue
> > > mentioned in the comment above this block so it should not be subjected
> > > to this check.
> > >
> > > With this patch, the VDSO successfully links and shows P_MIPS_PC32 in
> > > vgettimeofday.o.
> > >
> > > $ llvm-objdump -Dr arch/mips/vdso/vgettimeofday.o | grep R_MIPS_PC32
> > >                       00000024:  R_MIPS_PC32  _start
> > >                       000000b0:  R_MIPS_PC32  _start
> > >                       000002bc:  R_MIPS_PC32  _start
> > >                       0000036c:  R_MIPS_PC32  _start
> > >                       00000468:  R_MIPS_PC32  _start
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/785
> > > Link: https://github.com/llvm/llvm-project/commit/e364e2e9ce50c12eb2bf093560e1a1a8544d455a
> > > Reported-by: Dmitry Golovin <dima@golovin.in>
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > >  arch/mips/vdso/Makefile | 8 +++++---
> > >  1 file changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
> > > index d7fe8408603e..f99e583d14a1 100644
> > > --- a/arch/mips/vdso/Makefile
> > > +++ b/arch/mips/vdso/Makefile
> > > @@ -65,9 +65,11 @@ DISABLE_VDSO := n
> > >  # the comments on that file.
> > >  #
> > >  ifndef CONFIG_CPU_MIPSR6
> > > -  ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
> > > -    $(warning MIPS VDSO requires binutils >= 2.25)
> > > -    DISABLE_VDSO := y
> > > +  ifndef CONFIG_LD_IS_LLD
> > > +    ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
> > > +      $(warning MIPS VDSO requires binutils >= 2.25)
> > > +      DISABLE_VDSO := y
> > > +    endif
> > >    endif
> > >  endif
> > >
> > > --
> > > 2.26.1
> > >
> >
> > Hmmm, I still see this warning when first runing make <config>... I
> > assume because this Makefile gets parsed before Kconfig runs.
> 
> 
> I do not see the warning for 'make <config>'.
> 
> Could you tell me how to reproduce it?
> 
> 
> For cleaning, indeed, i see the warning.
> 
> 
> $ make ARCH=mips  LLVM=1 clean
> arch/mips/vdso/Makefile:70: MIPS VDSO requires binutils >= 2.25

This is enough. I think I figured out how to avoid it, I'll be sending
out v2 shortly, I'd appreciate any comments that you have.

> >
> > Perhaps it would be better to check if ld-version is 0 (since that means
> > we are not using GNU ld):
> >
> > ifneq ($(call ld-ifversion, -eq, 0, y),y)
> >
> > I am open to suggestions though.
> >
> > Cheers,
> > Nathan
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200419181715.GA36234%40ubuntu-s3-xlarge-x86.
> 
> 
> 
> -- 
> Best Regards
> Masahiro Yamada
> 

Cheers,
Nathan
diff mbox series

Patch

diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index d7fe8408603e..f99e583d14a1 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -65,9 +65,11 @@  DISABLE_VDSO := n
 # the comments on that file.
 #
 ifndef CONFIG_CPU_MIPSR6
-  ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
-    $(warning MIPS VDSO requires binutils >= 2.25)
-    DISABLE_VDSO := y
+  ifndef CONFIG_LD_IS_LLD
+    ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
+      $(warning MIPS VDSO requires binutils >= 2.25)
+      DISABLE_VDSO := y
+    endif
   endif
 endif