From patchwork Fri Apr 14 06:17:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 97425 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp160644qgf; Thu, 13 Apr 2017 23:18:38 -0700 (PDT) X-Received: by 10.98.214.6 with SMTP id r6mr5213552pfg.181.1492150718547; Thu, 13 Apr 2017 23:18:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r18si888831pfe.201.2017.04.13.23.18.38; Thu, 13 Apr 2017 23:18:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752996AbdDNGSS (ORCPT + 14 others); Fri, 14 Apr 2017 02:18:18 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:65474 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751286AbdDNGSR (ORCPT ); Fri, 14 Apr 2017 02:18:17 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v3E6HbaF029119; Fri, 14 Apr 2017 15:17:38 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v3E6HbaF029119 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1492150658; bh=GD/Liq144Yf1nncFgIgw2r8yEJ21rQ23IINIHxKFQ7Y=; h=From:To:Cc:Subject:Date:From; b=M7tTsofzFEaAfeYNv/96vFN+uTp+7LvhnZ56XIsBKiIsxZ+QdwFZhEc5jXoPi+NfQ lS1geExqZqV+tF0KZ5/ykU/BDYXYJ61zNMfYYOmySEJdpS1nu01lSJd7hNwePfgWMV GUliJxsl+aFokrxHLgOMRYL/O7VYHoZ5PUhtT/K6ngznbhzsR8sQ4bS2CeBf4e72M5 k25bMvLsiw58oayflS+d3zJ/FhF+POmi/qaMobMLwEgxAgWoONIMWZ+Ji/Hfp0sPXb CZvlX8z97/kbjgibm5UV1PJx2GQGtlFH5hlU4Tf+h0Mvi2ioHCNwn+giqJeit3mxq/ zB+/db4Dt0fZA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Arnd Bergmann , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: avoid conflict between -ffunction-sections and -pg on gcc-4.7 Date: Fri, 14 Apr 2017 15:17:26 +0900 Message-Id: <1492150646-20848-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann reported: "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] " Since commit c3f0d0bc5b01 ("kbuild, LLVMLinux: Add -Werror to cc-option to support clang"), warnings are treated as errors in cc-option checks. CC_FLAGS_FTRACE is blindly added to KBUILD_CFLAGS, so $(call cc-option,-ffunction-sections,) should be moved below it in order to detect the conflict between the two options. Reported-by: Arnd Bergmann Signed-off-by: Masahiro Yamada --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index efa267a..753e450 100644 --- a/Makefile +++ b/Makefile @@ -632,11 +632,6 @@ include arch/$(SRCARCH)/Makefile KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) -ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION -KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) -KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) -endif - ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,) else @@ -773,6 +768,11 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once) endif +ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION +KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) +KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) +endif + # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS)