Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp328508imu; Mon, 5 Nov 2018 01:22:19 -0800 (PST) X-Google-Smtp-Source: AJdET5eQpcvZr+u27LEYpZ2A2iDlP9WCOr1juGqJTl1h9aKs+mto3kRbLhvgml7POlGdsDKLzX/K X-Received: by 2002:a65:45c9:: with SMTP id m9-v6mr19163968pgr.212.1541409739259; Mon, 05 Nov 2018 01:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541409739; cv=none; d=google.com; s=arc-20160816; b=v5G5jguRnxK8biR6mzW8i8oEJK309un8dVzuDNLgekQxym9h5atBFOp0WoaQIKz0zR NsiU+5hsBX6POQAXrPQjpGh8A4P/2l7pRAtIUXkya1Ix1R8I0oHPu5+oTPIBW+Vr0QeC Caf3/WNST4So9VMmqAvEAfslVZqNo180uHBEoVlM4egbfhULtCGIynz1WuMc8uLIMYP6 XtX0HMxZG0SWktDM2xIJQ32MShOusEFVGiYyKOL1GzdWxN66l+WC20ndngmNnwPF06vq mG55dlkjU8F5tHhFJk2G47yFI6DIPEtXPaXsw6LfDxVZNX02zAQ/nRFxgEPA0UDbkNsV Owyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=5953TNGqFYaSYDubC/1Efna8xhOdcudA9Ev/Z2VUABQ=; b=tCESmxAoCJKd6tTdqc6Kr+DhZtDXg4p3aivPiMg8IpgYaovTikCtxFcTgvSMgzUPv8 2JmVrVYeyTTNW70uTYUmSuvoyDKYfawXxPYajUMJq5pxc+ZszP+t4kwsi6ELcctFZ3mG IT1fmJ96vKI/7KLzzuGXRjdSn6uqi1SpUT4D8TzY0RqiaUqbiXX9hSC8amkpL8vk7ftx HJ6uCxhz1YiuxlvoiD1BcU3fbT619WgTZZXdMdyWXY0gesswboxS5AvhfBE5+Bo7oLz6 Pr1/89K5oAnyFmr0kx/F5/Ob/HovyFbSXpiKoYighMVNGAiGxWAgZwcUwXo+7js05Dum T28Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=cVt79Hka; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si41175581pgo.299.2018.11.05.01.22.04; Mon, 05 Nov 2018 01:22:19 -0800 (PST) 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 header.s=dec2015msa header.b=cVt79Hka; 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 S1729040AbeKESiF (ORCPT + 99 others); Mon, 5 Nov 2018 13:38:05 -0500 Received: from conssluserg-01.nifty.com ([210.131.2.80]:48465 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726086AbeKESiE (ORCPT ); Mon, 5 Nov 2018 13:38:04 -0500 Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) (authenticated) by conssluserg-01.nifty.com with ESMTP id wA59J1vP001679; Mon, 5 Nov 2018 18:19:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com wA59J1vP001679 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1541409542; bh=5953TNGqFYaSYDubC/1Efna8xhOdcudA9Ev/Z2VUABQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cVt79HkaEH50XWPku/v1vwNWVL5b/a8365HujavCmNg7nVOizi2OmA4RiKUtVWC6g i+7zmy823a2CVeXRd212eksXvXh7mL77wr7q9WaTwO7LaxCh2J5l5An7wyjIF8bV6u m64XyvYdagWi6FWRY5tvWDoJiHr7Zw0QTdP9ZbVgJu+CLncaX4PS6c5LLPMibCaCzl vEaZrgn1ilvvZALJ8ais6ELsS1NFZG/s/xALjiEmbGGGu+IMPrGlUXpIUND7v5G2PT Utlv6lnWTcnzsdk0rYQXUfvcDokb+di5+65J+k8WxTXwOKrIH/HbyEFpVbN2Y3znVB P3A8Mvu7LEZFA== X-Nifty-SrcIP: [209.85.221.170] Received: by mail-vk1-f170.google.com with SMTP id y14so1551588vky.9; Mon, 05 Nov 2018 01:19:02 -0800 (PST) X-Gm-Message-State: AGRZ1gIEHkPUHxB4H8TchyWu9zzgmYZeHV0s6uRtq71mW47lC8j25aJR geeANiQCpjtHAIZ8ArNnPTAZVk6eKX69DOyQvRw= X-Received: by 2002:a1f:fcc3:: with SMTP id a186mr4045096vki.0.1541409541175; Mon, 05 Nov 2018 01:19:01 -0800 (PST) MIME-Version: 1.0 References: <1541386099-13118-1-git-send-email-yamada.masahiro@socionext.com> In-Reply-To: From: Masahiro Yamada Date: Mon, 5 Nov 2018 18:18:25 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: consolidate Clang compiler flags To: Stefan Agner Cc: Linux Kbuild mailing list , Kees Cook , Nick Desaulniers , Matthias Kaehlcke , Chris Fries , Joel Stanley , dja@axtens.net, Michal Marek , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 5, 2018 at 6:10 PM Stefan Agner wrote: > > On 05.11.2018 03:48, Masahiro Yamada wrote: > > Add basic options for Clang such as --target, --prefix, --gcc-toolchain, > > -no-integrated-as to a single variable CLANG_FLAGS. > > > > Signed-off-by: Masahiro Yamada > > --- > > > > Makefile | 13 ++++++------- > > 1 file changed, 6 insertions(+), 7 deletions(-) > > > > diff --git a/Makefile b/Makefile > > index 93315eb..58c838a 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -487,18 +487,17 @@ endif > > > > ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) > > ifneq ($(CROSS_COMPILE),) > > -CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) > > +CLANG_FLAGS = --target=$(notdir $(CROSS_COMPILE:%-=%)) > > GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) > > -CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) > > +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) > > So this will expand later now, is this ok? > > -- > Stefan > > > GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) > > endif > > ifneq ($(GCC_TOOLCHAIN),) > > -CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) > > +CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) > > endif > > -KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) > > -KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) > > -KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) > > -KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) > > +CLANG_FLAGS += $(call cc-option, -no-integrated-as) > > +KBUILD_CFLAGS += $(CLANG_FLAGS) > > +KBUILD_AFLAGS += $(CLANG_FLAGS) CLANG_FLAGS is expanded here because KBUILD_CFLAGS and KBUILD_AFLAGS are defined by using := So, it should be OK, but turning CLANG_FLAGS into a simple variable will be a little more efficient since $(call cc-option, -no-integrated-as) is evaluated just once. (Or, this cc-option may not be necessary any longer.) Will send v2. Thanks. > > endif > > > > RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern > > -mindirect-branch-register -- Best Regards Masahiro Yamada