]> git.karo-electronics.de Git - karo-tx-linux.git/commit
powerpc/Makefile: Fix ld version check with 64-bit LE-only toolchain
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 26 Jul 2017 05:00:42 +0000 (15:00 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 26 Jul 2017 06:41:54 +0000 (16:41 +1000)
commitb40b2386bce982ad97f3683b2b34e589c3be5c5a
tree1dbbef7f893b6468a06ed398d6205182877abfd3
parent4fd1bd443e80b12f0a01a45fb9a793206b41cb72
powerpc/Makefile: Fix ld version check with 64-bit LE-only toolchain

In commit efe0160cfd40 ("powerpc/64: Linker on-demand sfpr functions
for modules"), we added an ld version check early in the powerpc
top-level Makefile.

Because the Makefile runs before the kernel config is setup, the
checks for CONFIG_CPU_LITTLE_ENDIAN etc. all take the default case. So
we end up configuring ld for 32-bit big endian.

That would be OK, except that for historical (or perhaps no) reason,
we use 'override LD' to add the endian flags to the LD variable
itself, rather than the normal approach of adding them to LDFLAGS.

The end result is that when we check the ld version we run it as:

  $(CROSS_COMPILE)ld -EB -m elf32ppc --version

This often works, unless you are using a 64-bit only and/or little
endian only, toolchain. In which case you see something like:

  $ make defconfig
  powerpc64le-linux-ld: unrecognised emulation mode: elf32ppc
  Supported emulations: elf64lppc elf32lppc elf32lppclinux elf32lppcsim
  /bin/sh: 1: [: -ge: unexpected operator

The proper fix is to stop using 'override LD', but that will require a
fair bit of testing. Instead we can fix it for now just by reordering
the Makefile to do the version check earlier.

Fixes: efe0160cfd40 ("powerpc/64: Linker on-demand sfpr functions for modules")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/Makefile