linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Makefile: Fix unrecognized cross-compiler command line options
@ 2014-05-27  7:54 Geert Uytterhoeven
  2014-06-09 21:36 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2014-05-27  7:54 UTC (permalink / raw)
  To: Linus Torvalds, Michal Marek
  Cc: Arnd Bergmann, Behan Webster, linux-kbuild, linux-kernel,
	Geert Uytterhoeven

On architectures that setup CROSS_COMPILE in their arch/*/Makefile
(arc, blackfin, m68k, mips, parisc, score, sh, tile, unicore32, xtensa),
cc-option and cc-disable-warning may check against the wrong compiler,
causing errors like

    cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"

if the host gcc supports a compiler option, while the cross compiler
doesn't support that option.

Move all logic using cc-option or cc-disable-warning below the inclusion
of the arch's Makefile to fix this.

Introduced by
  - commit e74fc973b6e531fef1fce8b101ffff05ecfb774c ("Turn off
    -Wmaybe-uninitialized when building with -Os"),
  - commit 61163efae02040f66a95c8ed17f4407951ba58fa ("kbuild: LLVMLinux:
    Add Kbuild support for building kernel with Clang").

As -Wno-maybe-uninitialized requires a quite recent gcc (gcc 4.6.3 on
Ubuntu 12.04 LTS doesn't support it), this only showed up recently (gcc
4.8.2 on Ubuntu 14.04 LTS does support it).

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Perhaps all KBUILD_* definitions can be moved below the inclusion of the
arch's Makefile, to make it less likely to happen again?
But that's definitely post-3.15 material.

 Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index cf3412d78ff1..da910e09fc9a 100644
--- a/Makefile
+++ b/Makefile
@@ -395,8 +395,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -fno-common \
 		   -Werror-implicit-function-declaration \
-		   -Wno-format-security \
-		   $(call cc-option,-fno-delete-null-pointer-checks,)
+		   -Wno-format-security
+
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
 KBUILD_AFLAGS   := -D__ASSEMBLY__
@@ -594,14 +594,16 @@ endif # $(dot-config)
 # Defaults to vmlinux, but the arch makefile usually adds further targets
 all: vmlinux
 
+include $(srctree)/arch/$(SRCARCH)/Makefile
+
+KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
+
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
 KBUILD_CFLAGS	+= -O2
 endif
 
-include $(srctree)/arch/$(SRCARCH)/Makefile
-
 ifdef CONFIG_READABLE_ASM
 # Disable optimizations that make assembler listings hard to read.
 # reorder blocks reorders the control in the function
-- 
1.9.1


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

* Re: [PATCH] Makefile: Fix unrecognized cross-compiler command line options
  2014-05-27  7:54 [PATCH] Makefile: Fix unrecognized cross-compiler command line options Geert Uytterhoeven
@ 2014-06-09 21:36 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2014-06-09 21:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Torvalds, Arnd Bergmann, Behan Webster, linux-kbuild,
	linux-kernel

Dne 27.5.2014 09:54, Geert Uytterhoeven napsal(a):
> On architectures that setup CROSS_COMPILE in their arch/*/Makefile
> (arc, blackfin, m68k, mips, parisc, score, sh, tile, unicore32, xtensa),
> cc-option and cc-disable-warning may check against the wrong compiler,
> causing errors like
> 
>     cc1: error: unrecognized command line option "-Wno-maybe-uninitialized"
> 
> if the host gcc supports a compiler option, while the cross compiler
> doesn't support that option.
> 
> Move all logic using cc-option or cc-disable-warning below the inclusion
> of the arch's Makefile to fix this.
> 
> Introduced by
>   - commit e74fc973b6e531fef1fce8b101ffff05ecfb774c ("Turn off
>     -Wmaybe-uninitialized when building with -Os"),
>   - commit 61163efae02040f66a95c8ed17f4407951ba58fa ("kbuild: LLVMLinux:
>     Add Kbuild support for building kernel with Clang").
> 
> As -Wno-maybe-uninitialized requires a quite recent gcc (gcc 4.6.3 on
> Ubuntu 12.04 LTS doesn't support it), this only showed up recently (gcc
> 4.8.2 on Ubuntu 14.04 LTS does support it).
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Applied to kbuild.git#kbuild, thanks.

Michal


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

end of thread, other threads:[~2014-06-09 21:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-27  7:54 [PATCH] Makefile: Fix unrecognized cross-compiler command line options Geert Uytterhoeven
2014-06-09 21:36 ` Michal Marek

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