linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] powerpc: Detect broken or mismatched toolchains
@ 2016-02-22  5:13 Sam Bobroff
  2016-02-23  2:05 ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Bobroff @ 2016-02-22  5:13 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: michaele

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.bobroff@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

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

* Re: [PATCH 1/1] powerpc: Detect broken or mismatched toolchains
  2016-02-22  5:13 [PATCH 1/1] powerpc: Detect broken or mismatched toolchains Sam Bobroff
@ 2016-02-23  2:05 ` Scott Wood
  2016-02-23  4:59   ` Sam Bobroff
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2016-02-23  2:05 UTC (permalink / raw)
  To: Sam Bobroff, linuxppc-dev; +Cc: michaele

On Mon, 2016-02-22 at 16:13 +1100, Sam Bobroff wrote:
> 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.bobroff@au1.ibm.com>
> ---

How is this more useful than getting to actually see the way in which the
toolchain (or the CFLAGS) is broken?

-Scott

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

* Re: [PATCH 1/1] powerpc: Detect broken or mismatched toolchains
  2016-02-23  2:05 ` Scott Wood
@ 2016-02-23  4:59   ` Sam Bobroff
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Bobroff @ 2016-02-23  4:59 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, michaele

On Mon, Feb 22, 2016 at 08:05:01PM -0600, Scott Wood wrote:
> On Mon, 2016-02-22 at 16:13 +1100, Sam Bobroff wrote:
> > 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.bobroff@au1.ibm.com>
> > ---
> 
> How is this more useful than getting to actually see the way in which the
> toolchain (or the CFLAGS) is broken?

My reasoning was that it would be better because it happens at the start of the
build, rather than (possibly) a long way into it, and it indicates that the
problem is the toolchain setup (or config) itself rather than the file it's
trying to compile or link.

But I agree completely with what you're saying. I'll try re-working it in a way
that shows the command that fails and it's output.

Cheers,
Sam.

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

end of thread, other threads:[~2016-02-23  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22  5:13 [PATCH 1/1] powerpc: Detect broken or mismatched toolchains Sam Bobroff
2016-02-23  2:05 ` Scott Wood
2016-02-23  4:59   ` Sam Bobroff

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).