It can currently be difficult to diagnose a build that fails due to
the compiler, linker or other parts of the toolchain being unable to
build binaries of the type required by the kernel config. For example
using a little endian toolchain to build a big endian kernel may
produce:

as: unrecognized option '-maltivec'

This patch adds a basic compile test and error message to
arch/powerpc/Makefile so that the above error becomes:

*** Sorry, your toolchain seems to be broken or incorrect. ***
Make sure it supports your kernel configuration (ppc64).

Signed-off-by: Sam Bobroff <sam.bobr...@au1.ibm.com>
---

 arch/powerpc/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 96efd82..0041cd2 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -355,6 +355,13 @@ TOUT       := .tmp_gas_check
 # - Require gcc 4.0 or above on 64-bit
 # - gcc-4.2.0 has issues compiling modules on 64-bit
 checkbin:
+       @if test "$(call try-run,echo 'int _start(void) { return 0; }' > 
\"$$TMP\"; \
+       $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -x c -nostdlib \"$$TMP\" \
+       -o /dev/null,ok,broken)" = "broken" ; then \
+               echo "*** Sorry, your toolchain seems to be broken or 
incorrect. ***" ; \
+               echo "Make sure it supports your kernel configuration 
($(UTS_MACHINE))." ; \
+               false; \
+       fi
        @if test "$(cc-name)" != "clang" \
            && test "$(cc-version)" = "0304" ; then \
                if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) 
>/dev/null 2>&1 ; then \
-- 
2.1.0

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to