From patchwork Wed Mar 29 09:30:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9651083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 861EE602BE for ; Wed, 29 Mar 2017 09:31:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 709812845B for ; Wed, 29 Mar 2017 09:31:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6553F28469; Wed, 29 Mar 2017 09:31:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E49052845B for ; Wed, 29 Mar 2017 09:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755780AbdC2JbO (ORCPT ); Wed, 29 Mar 2017 05:31:14 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:35791 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755666AbdC2Ja7 (ORCPT ); Wed, 29 Mar 2017 05:30:59 -0400 Received: by mail-oi0-f66.google.com with SMTP id t7so717303oig.2; Wed, 29 Mar 2017 02:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=vE88UNPeKPgGs1HhU9esBJ+LPXtOoiHHJLStxdprD70=; b=Mx2gfSZ2DSIPAmUctBqxhm985dy15HWm9SvMKVf/z/pj2hOsCk7z737HW+ni6yNpdf 2MRk3pW/VioRGRxeUrc3HcFbV6Ro2y94K9wmf0Hqd7vaJKdHJkxAJLV+iHzwDg1WHlgH +MZXYIpEpmIizi94kCCOjoVIW2/sccE6ManfTpdhxY8fQoAYZaOeEQIecf4XSxwFlXFK uGssYFresdlJ7de+upF8BTmTVnp4D3fxhqB38pBKPG6mOx+bq4BukLBAS+XVGxnfHXEj dHrsuGHLRHklZLHENEhccRbf7Y3Kvkihn6sZmeCFKcf9eMx5QJBBEttK/3G7SKuEiZUw xoKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=vE88UNPeKPgGs1HhU9esBJ+LPXtOoiHHJLStxdprD70=; b=E2BYtZhtDZl1prN+QJCK63ESKZpvvhJhLSynuz6qqmz9CyIiONk17Fy2tnH96w4uYO Qpc2sFgo0MVEHZD91fAEHlUy6yTFg/K9Pmx9IoE8scftgYwZs63Pxe6S01gOWfrBr2SH zN5DsmMzpsqopk7Mi856ST+um3ZzrfH7kgVMrV9aJHke6MMHJdFam/leqS7WC9ovwRyc zIhj6agf5h6riCEOji3BOPp9LeEtTs0XPIsicpit6pWaljDneGzETrbdYsLKF2WUBMGU XxJLuAitF/8ts2YULN9FnBkWqGwlrnLGTw8woNUdNzGyDf/j/k75vWbHluYVgREJlTFy nyXA== X-Gm-Message-State: AFeK/H3e11qqMhaJx2/NGQUJISjA/RqfCfPpkArjQERf3Onqs5LgeU5FMRhmk/ak05dIa8LmwU+O32WHzt0+Gw== X-Received: by 10.202.228.17 with SMTP id b17mr17698145oih.212.1490779858173; Wed, 29 Mar 2017 02:30:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.20.210 with HTTP; Wed, 29 Mar 2017 02:30:57 -0700 (PDT) In-Reply-To: References: <20170314213410.3762842-1-arnd@arndb.de> <20170314213724.3836900-1-arnd@arndb.de> From: Arnd Bergmann Date: Wed, 29 Mar 2017 11:30:57 +0200 X-Google-Sender-Auth: N8pH5WWX5SeO79gpXyFSxnRFy8U Message-ID: Subject: Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace To: Masahiro Yamada Cc: Michal Marek , Nicholas Piggin , Namhyung Kim , Linux Kbuild mailing list , Linux Kernel Mailing List , masahiroy@kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Mar 29, 2017 at 4:07 AM, Masahiro Yamada wrote: > Hi Arnd, > > > 2017-03-15 6:37 GMT+09:00 Arnd Bergmann : >> When ftrace is enabled and we build with gcc-4.7 or older, we >> get a warning for each file on architectures that select >> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION: >> >> warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default] >> >> This turns off function sections in that specific case, leaving >> it enabled for all other configurations. >> >> Fixes: b67067f1176d ("kbuild: allow archs to select link dead code/data elimination") >> Signed-off-by: Arnd Bergmann >> Cc: Namhyung Kim >> --- >> v2: accidentally resend the same patch as before >> v3: send the exact same patch once more, without doing the change I wanted >> v4: actually fixed version number in check as pointed out by Namhyung Kim (I hope) >> --- >> Makefile | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/Makefile b/Makefile >> index 6e7e644a0b84..3a964fa3a787 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -662,7 +662,11 @@ KBUILD_CFLAGS += -Wextra >> KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) >> >> ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION >> +ifdef CONFIG_FUNCTION_TRACER >> +KBUILD_CFLAGS += $(call cc-ifversion, -ge,0408,$(call cc-option,-ffunction-sections,)) >> +else >> KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) >> +endif >> KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) >> endif >> > > > I have two questions. > > [1] > How did you produce this warning? > I do not see any architecture that selects this option at this point of time. I saw it on ARM randconfig builds > Did you edit Kconfig locally to select LD_DEAD_CODE_DATA_ELIMINATION? > If so, is this patch not so urgent as the "Fixes" tag claims? Good point, I forgot that I had enabled this manually on ARM in an earlier patch in my randconfig-fixup series. I thought this was selected on powerpc, but that part of Nick's series apparently didn't make it in yet. I don't see the 'Fixes' tag as claiming the patch to be urgent, just documenting what patch introduced the problem, but you could argue here that it only gets introduced by a future patch that actually selects the symbol. > [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öller -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 = $(subst -functions=0,,\ # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(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. 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. Arnd --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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 = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(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 := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(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