From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f66.google.com ([209.85.218.66]:33564 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932976AbdCaIsz (ORCPT ); Fri, 31 Mar 2017 04:48:55 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170314213410.3762842-1-arnd@arndb.de> <20170314213724.3836900-1-arnd@arndb.de> From: Arnd Bergmann Date: Fri, 31 Mar 2017 10:48:53 +0200 Message-ID: Subject: Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Masahiro Yamada Cc: Michal Marek , Nicholas Piggin , Namhyung Kim , Linux Kbuild mailing list , Linux Kernel Mailing List , Mark Charlebois On Thu, Mar 30, 2017 at 5:42 PM, Masahiro Yamada wrote: > 2017-03-29 18:30 GMT+09:00 Arnd Bergmann : >> On Wed, Mar 29, 2017 at 4:07 AM, Masahiro Yamada >> wrote: >>> 2017-03-15 6:37 GMT+09:00 Arnd Bergmann : >>> [2] >>> This question is more technical. >>> >>> The cause of the problem seems that GCC warns it cannot support the >>> two at the same time, >>> but it does handle it as an error. So, cc-option assumes this >>> combination is OK. >>> >>> Is it a good idea to add -Werror to cc-option checking? >> >> Hmm, I've actually been running with that change as a side-effect >> of having the llvmlinux patches applied, which contain this one: >> >> commit 03497934e211325fc2913476897daf7a5ddb008a >> Author: Mark Charlebois >> Date: Mon Sep 22 14:33:05 2014 -0700 >> >> kbuild, LLVMLinux: Add -Werror to cc-option to support clang >> >> Clang will warn about unknown warnings but will not return false >> unless -Werror is set. GCC will return false if an unknown >> warning is passed. >> >> Adding -Werror make both compiler behave the same. >> >> Signed-off-by: Mark Charlebois >> Signed-off-by: Behan Webster >> Reviewed-by: Jan-Simon M=C3=B6ller >> >> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include >> index 285acc57c0a4..3629bd9c7e79 100644 >> --- a/scripts/Kbuild.include >> +++ b/scripts/Kbuild.include >> @@ -116,12 +116,12 @@ CC_OPTION_CFLAGS =3D $(filter-out >> $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) >> # Usage: cflags-y +=3D $(call cc-option,-march=3Dwinchip-c6,-march=3Di5= 86) >> >> cc-option =3D $(call try-run,\ >> - $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c >> /dev/null -o "$$TMP",$(1),$(2)) >> + $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c >> -x c /dev/null -o "$$TMP",$(1),$(2)) >> >> # cc-option-yn >> # Usage: flag :=3D $(call cc-option-yn,-march=3Dwinchip-c6) >> cc-option-yn =3D $(call try-run,\ >> - $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c >> /dev/null -o "$$TMP",y,n) >> + $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c >> -x c /dev/null -o "$$TMP",y,n) >> >> # cc-option-align >> # Prefix align with either -falign or -malign >> @@ -131,7 +131,7 @@ cc-option-align =3D $(subst -functions=3D0,,\ >> # cc-disable-warning >> # Usage: cflags-y +=3D $(call cc-disable-warning,unused-but-set-variabl= e) >> cc-disable-warning =3D $(call try-run,\ >> - $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) >> -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) >> + $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip >> $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) >> >> # cc-name >> # Expands to either gcc or clang >> >> This is identical to your version, except it applies the same >> thing to cc-disable-warning. > > Ah, I see. > > I'm also moving > KBUILD_CFLAGS +=3D $(call cc-option,-ffunction-sections,) > below > CC_FLAGS_FTRACE :=3D -pg > to fix the warning. > > > > >> I think this is good to get merged, >> and there are probably a couple of other patches in that series >> that we may want to look at again. > > > I agree. > > > At least, 03497934e21 looks good to be merged. > (I need to get access to Mark, and ask him to send this patch.) > > Then, swap the -ffunction-sections and -pg order. > > I hope this will make you and clang guys happy. I may have a number of clang related patches in the future, and can also forward this patch. I suspect that Mark (added to Cc) is currently not able to send a tested patch for the latest kernel, he worked on it in 2014, but I don't think he's following llvmlinux at the moment. Arnd