From patchwork Thu May 10 05:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 10391151 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 029426028E for ; Thu, 10 May 2018 05:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E65D728866 for ; Thu, 10 May 2018 05:17:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB60F28870; Thu, 10 May 2018 05:17:21 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 7087528866 for ; Thu, 10 May 2018 05:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756505AbeEJFRV (ORCPT ); Thu, 10 May 2018 01:17:21 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:37032 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756501AbeEJFRU (ORCPT ); Thu, 10 May 2018 01:17:20 -0400 Received: by mail-pl0-f67.google.com with SMTP id f7-v6so609674plr.4 for ; Wed, 09 May 2018 22:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RIQQvYP+/ekuvFOVRvHyYn8PMPLpPtOL/oDc628N6Ao=; b=fkXHljKNPGS8lwEsQ9A08qx9XLnE9qh1zvT6EfR+nWFGLQlOhmluSOsItNcrVD5oj4 K9k4L4g2vfKwkMchS6sLkz0Dn8XiWViNFAxkx4AiSU6a83zxD1Cet+6bAdX/yFlCFOXS p1E8Y3SZiltkEDxlGAK5+hNYuBfUqaWi2z1bs2ezI1tfR+XC39yongxyL2zwOFgAagtO hG+JEIRlEWrh7rv3aXoU0xKTz8aVXqNNDHAFUDAwgCCT+KFE7jSsmRKq0fuwtm36m3/x +1AvYltg+ROFPkMebAGBmjunjibk3RbrHdyiHpQl+3JOI1loxAj8RujHMLF8ZFcYiN9c B8fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RIQQvYP+/ekuvFOVRvHyYn8PMPLpPtOL/oDc628N6Ao=; b=QXRjx6KLv03dKB2DsBi7KPMJ1s/lVjpCzgNC8o5VQjH5MnX7K3qOXzJnDM5XNh/6bO P+jx9LlieojmaZ/mh5l5H6ZAfzlhiZjGmM4XUTTc4/yFIS6R8EArKTP66sNDvqBRTZ5g Vsr2td1EecSmUGBtqM3AcbBOgme+hiVhTD2qKMhMv2+juLTVw6NFYcZMQzcdLBWNzJ8Q 7Th8U3PYbaFWaZEc2TTFh4zR8ARwaOD8XMZCzalrJImcNZZfBYdUmurUD6K5nH2iL8RN iS7dIss0StwbmcM28MTkb86jDvtRYDbyKGp6j6ln/v511uDhTt4OXnNK2NYLI3lTQ2KR ktWg== X-Gm-Message-State: ALQs6tDH5kqlE2zrxOEh3hXGxG8168ox0tHpkx0Y1GnraQpkNfQMATyf q0O+h5l5v6QqKoKu2EK650S0BQ== X-Google-Smtp-Source: AB8JxZrNkD0GeCYur2ITuOWTLR2LV60lIW9MhaCpVdBq/y2m8VsqdOveK1EZDcbqzX+xZY52aSSEKw== X-Received: by 2002:a17:902:2ac3:: with SMTP id j61-v6mr47124511plb.224.1525929439704; Wed, 09 May 2018 22:17:19 -0700 (PDT) Received: from roar.au.ibm.com (59-102-70-78.tpgi.com.au. [59.102.70.78]) by smtp.gmail.com with ESMTPSA id a7-v6sm8922265pgc.68.2018.05.09.22.17.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 22:17:18 -0700 (PDT) From: Nicholas Piggin To: linux-kbuild@vger.kernel.org Cc: Nicholas Piggin , Masahiro Yamada , linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 3/5] kbuild: call cc-option with the current set of KBUILD_CFLAGS Date: Thu, 10 May 2018 15:16:57 +1000 Message-Id: <20180510051659.15356-4-npiggin@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180510051659.15356-1-npiggin@gmail.com> References: <20180510051659.15356-1-npiggin@gmail.com> 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 In some cases, the options that gcc will accept depend on options it has already been given. For example -m32 / -m64 and -mbig-endian / -mlittle-endian can have this affect. Passing in KBUILD_CFLAGS to cc-option allows an architecture to set such basic machine types at the beginning, rather than override CC itself. Signed-off-by: Nicholas Piggin --- scripts/Kbuild.include | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 9f7eb10079cc..66869bb815d2 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -121,7 +121,7 @@ CC_OPTION_CFLAGS = $(filter-out $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS)) # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) cc-option = $(call __cc-option, $(CC),\ - $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) + $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS),$(1),$(2)) # hostcc-option # Usage: cflags-y += $(call hostcc-option,-march=winchip-c6,-march=i586) @@ -131,12 +131,12 @@ hostcc-option = $(call __cc-option, $(HOSTCC),\ # cc-option-yn # Usage: flag := $(call cc-option-yn,-march=winchip-c6) cc-option-yn = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) + $(CC) -Werror $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP",y,n) # cc-disable-warning # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable) cc-disable-warning = $(call try-run,\ - $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) + $(CC) -Werror $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) # cc-name # Expands to either gcc or clang @@ -160,7 +160,7 @@ cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo # cc-ldoption # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) cc-ldoption = $(call try-run,\ - $(CC) $(1) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + $(CC) $(1) $(KBUILD_CFLAGS) $(CC_OPTION_CFLAGS) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) # ld-option # Usage: LDFLAGS += $(call ld-option, -X)