linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* VDSO build failure: collect2: fatal error: cannot find 'ld'
@ 2015-07-06  6:54 Baruch Siach
  2015-07-06 13:41 ` Nathan Lynch
  0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2015-07-06  6:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Nathan,

In commit log d2b30cd4b722 (ARM: 8384/1: VDSO: force use of BFD linker, 
2015-06-03) you said:

    Note: one limitation of this is that if the toolchain is configured
    to use gold by default, and the bfd linker is not in $PATH, the VDSO
    build will fail:
    
      VDSO    arch/arm/vdso/vdso.so.raw
    collect2: fatal error: cannot find 'ld'
    
    This will happen if CROSS_COMPILE begins with a path such as
    /opt/bin/arm-linux-gnu- but /opt/bin is not in $PATH.  This is
    considered an acceptable corner-case limitation and is easily worked
    around.

I see this build failure here with Sourcery CodeBench Lite 2014.05 even 
though:

	1. This toolchain doesn't include the gold linker at all

	2. I have the arm-2014.05/bin/ directory in my $PATH

	3. My CROSS_COMPILE is set to 'arm-none-linux-gnueabi-'

Reverting d2b30cd4b722 on v4.2-rc1 fixes the build failure.

The Sourcery CodeBench Lite 2014.05 (gcc: 4.8.3, binutils: 2.24.51) is 
available at 
http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

Any hint?

Thanks,
baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 3+ messages in thread

* VDSO build failure: collect2: fatal error: cannot find 'ld'
  2015-07-06  6:54 VDSO build failure: collect2: fatal error: cannot find 'ld' Baruch Siach
@ 2015-07-06 13:41 ` Nathan Lynch
  2015-07-06 18:19   ` Baruch Siach
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Lynch @ 2015-07-06 13:41 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/06/2015 01:54 AM, Baruch Siach wrote:
> In commit log d2b30cd4b722 (ARM: 8384/1: VDSO: force use of BFD linker, 
> 2015-06-03) you said:
> 
>     Note: one limitation of this is that if the toolchain is configured
>     to use gold by default, and the bfd linker is not in $PATH, the VDSO
>     build will fail:
>     
>       VDSO    arch/arm/vdso/vdso.so.raw
>     collect2: fatal error: cannot find 'ld'
>     
>     This will happen if CROSS_COMPILE begins with a path such as
>     /opt/bin/arm-linux-gnu- but /opt/bin is not in $PATH.  This is
>     considered an acceptable corner-case limitation and is easily worked
>     around.
> 
> I see this build failure here with Sourcery CodeBench Lite 2014.05 even 
> though:
> 
> 	1. This toolchain doesn't include the gold linker at all
> 
> 	2. I have the arm-2014.05/bin/ directory in my $PATH
> 
> 	3. My CROSS_COMPILE is set to 'arm-none-linux-gnueabi-'
> 
> Reverting d2b30cd4b722 on v4.2-rc1 fixes the build failure.


Thanks for the detailed report; I have been able to recreate this.

This seems to be happening because the compiler supports -fuse-ld=bfd,
but the toolchain does not contain a "arm-none-linux-gnueabi-ld.bfd"
executable: creating a symlink arm-none-linux-gnueabi-ld.bfd =>
arm-none-linux-gnueabi-ld in arm-2014.05/bin/ allows the build to succeed.

I'm not sure whether this is a toolchain bug or incorrect expectations
on my part, but I'm not eager to break a toolchain that used to work.  I
think the least bad resolution is to use cc-ldoption for detecting
whether -fuse-ld=bfd will work.  The tradeoff is that if the vdso link
is attempted with gold we'll get a marginally less user-friendly error
message.

Baruch, can you confirm the patch below fixes it for you?

diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 9d259d94e429..1160434eece0 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -14,7 +14,7 @@ VDSO_LDFLAGS += -Wl,-z,max-page-size=4096
-Wl,-z,common-page-size=4096
 VDSO_LDFLAGS += -nostdlib -shared
 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
 VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
-VDSO_LDFLAGS += $(call cc-option, -fuse-ld=bfd)
+VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)

 obj-$(CONFIG_VDSO) += vdso.o
 extra-$(CONFIG_VDSO) += vdso.lds

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* VDSO build failure: collect2: fatal error: cannot find 'ld'
  2015-07-06 13:41 ` Nathan Lynch
@ 2015-07-06 18:19   ` Baruch Siach
  0 siblings, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2015-07-06 18:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Nathan,

On Mon, Jul 06, 2015 at 08:41:04AM -0500, Nathan Lynch wrote:
> On 07/06/2015 01:54 AM, Baruch Siach wrote:
> > Reverting d2b30cd4b722 on v4.2-rc1 fixes the build failure.
> 
> Baruch, can you confirm the patch below fixes it for you?
> 
> diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
> index 9d259d94e429..1160434eece0 100644
> --- a/arch/arm/vdso/Makefile
> +++ b/arch/arm/vdso/Makefile
> @@ -14,7 +14,7 @@ VDSO_LDFLAGS += -Wl,-z,max-page-size=4096
> -Wl,-z,common-page-size=4096
>  VDSO_LDFLAGS += -nostdlib -shared
>  VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
>  VDSO_LDFLAGS += $(call cc-ldoption, -Wl$(comma)--build-id)
> -VDSO_LDFLAGS += $(call cc-option, -fuse-ld=bfd)
> +VDSO_LDFLAGS += $(call cc-ldoption, -fuse-ld=bfd)
> 
>  obj-$(CONFIG_VDSO) += vdso.o
>  extra-$(CONFIG_VDSO) += vdso.lds

With this patch applied kernel build using the Sourcery CodeBench Lite 2014.05 
toolchain succeeds.

Tested-by: Baruch Siach <baruch@tkos.co.il>

Thanks for your prompt response.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-06 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-06  6:54 VDSO build failure: collect2: fatal error: cannot find 'ld' Baruch Siach
2015-07-06 13:41 ` Nathan Lynch
2015-07-06 18:19   ` Baruch Siach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).