Skip to contentSkip to conversation

FAILED: patch "[PATCH] ARM: 8405/1: VDSO: fix regression with toolchains lacking" failed to apply to 4.1-stable tree

PATCH [email protected] 1 participant 1 message Aug 19, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 3473f26592c1c365d376aee29433d7db75f14d1e Mon Sep 17 00:00:00 2001

From: Nathan Lynch <[email protected]>
Date: Fri, 17 Jul 2015 21:40:28 +0100
Subject: [PATCH] ARM: 8405/1: VDSO: fix regression with toolchains lacking
ld.bfd executable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The Sourcery CodeBench Lite 2014.05 toolchain (gcc 4.8.3, binutils 2.24.51) has a GCC which implements -fuse-ld, and it doesn't include the gold linker, but it lacks an ld.bfd executable in its installation. This means that passing -fuse-ld=bfd fails with:

VDSO arch/arm/vdso/vdso.so.raw
collect2: fatal error: cannot find 'ld'

Arguably this is a deficiency in the toolchain, but I suspect it's commonly used enough that it's worth accommodating: just use

cc-ldoption (to cause a link attempt) instead of cc-option to test whether we can use -fuse-ld. So -fuse-ld=bfd won't be used with this toolchain, but the build will rightly succeed, just as it does for toolchains which don't implement -fuse-ld (and don't use gold as the default linker).

Note: this will change the failure mode for a corner case I was trying to handle in d2b30cd4b722, where the toolchain defaults to the gold linker and the BFD linker is not found in PATH, from:

VDSO arch/arm/vdso/vdso.so.raw
collect2: fatal error: cannot find 'ld'

i.e. the BFD linker is not found, to:

OBJCOPY arch/arm/vdso/vdso.so
BFD: arch/arm/vdso/vdso.so: Not enough room for program headers, try linking with -N

that is, we fail to prevent gold from being used as the linker, and it produces an object that objcopy can't digest.

Fixes d2b30cd4b722 ("ARM: 8384/1: VDSO: force use of BFD linker")
arch/arm/vdso/Makefile +1 -1
index 9d259d94e429..1160434eece0 100644
@@ -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