All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <mmarek@suse.com>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Behan Webster <behanw@converseincode.com>,
	Grant Grundler <grundler@chromium.org>,
	Greg Hackmann <ghackmann@google.com>,
	Michael Davidson <md@google.com>,
	Peter Foley <pefoley2@pefoley.com>
Subject: Re: [PATCH v2] kbuild: Add better clang cross build support
Date: Fri, 21 Apr 2017 10:27:52 -0700	[thread overview]
Message-ID: <20170421172752.GK128305@google.com> (raw)
In-Reply-To: <CAK7LNASiT1u218kOAXuc9Ai4oeFZBzxrdhBNUYHnYWF_eFTB6w@mail.gmail.com>

Hi Masahiro,

Thanks for your comments.

El Fri, Apr 21, 2017 at 05:24:31PM +0900 Masahiro Yamada ha dit:

> 2017-04-11 6:09 GMT+09:00 Matthias Kaehlcke <mka@chromium.org>:
> 
> 
> > COMPILER is previously set to "clang" if CC=clang was set from the
> > make command line.  So -target and -gcc-toolchain can be added to CC,
> > since we already know that it is set.
> 
> Can you reword or delete this paragraph?
> I think this is confusing because COMPILER was replaced with cc-name
> by commit 5631d9c4.

Ok, I think not much is lost by deleting it.

<snip>

> > -KBUILD_CPPFLAGS := -D__KERNEL__
> > +KBUILD_CPPFLAGS := -D__KERNEL__ $(CLANG_FLAGS)
> >
> >  KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
> >                    -fno-strict-aliasing -fno-common \
> >                    -Werror-implicit-function-declaration \
> >                    -Wno-format-security \
> > -                  -std=gnu89 $(call cc-option,-fno-PIE)
> > -
> > +                  -std=gnu89 $(call cc-option,-fno-PIE) \
> > +                  $(CLANG_FLAGS)
> >
> >  KBUILD_AFLAGS_KERNEL :=
> >  KBUILD_CFLAGS_KERNEL :=
> > -KBUILD_AFLAGS   := -D__ASSEMBLY__ $(call cc-option,-fno-PIE)
> > +KBUILD_AFLAGS   := -D__ASSEMBLY__ $(call cc-option,-fno-PIE) $(CLANG_FLAGS)
> 
> 
> This adds multiple -gcc-toolchain because both KBUILD_CPPFLAGS and KBUILD_CFLAGS
> are added to c_flags.   See scripts/Makefile.lib
> 
> orig_c_flags   = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(KBUILD_SUBDIR_CCFLAGS) \
>                  $(ccflags-y) $(CFLAGS_$(basetarget).o)
> 
> 
> Pre-processing is related to the front-end part,
> so -target and -gcc-toolchain are not necessary for KBUILD_CPPFLAGS?
> 
> Maybe, adding it to KBUILD_CFLAGS and KBUILD_AFLAGS could be enough?

Indeed it seems it is not needed in KBUILD_CPPFLAGS, at least I
encountered no issues in a x86 and arm64 build.

> Is it possible to move these to around line 700?
> 
> ifeq ($(cc-name),clang)
>    < add here ? >
> KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
> KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
> 
> I do not want to sprinkle ugly ifeq ($(cc-name,clang).

I agree, better concentrate clang specific stuff when possible.

I'll rework the patch and send out an update shortly.

Cheers

Matthias

  reply	other threads:[~2017-04-21 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 21:09 [PATCH v2] kbuild: Add better clang cross build support Matthias Kaehlcke
2017-04-21  8:24 ` Masahiro Yamada
2017-04-21 17:27   ` Matthias Kaehlcke [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-21 18:20 Matthias Kaehlcke
2017-04-23 14:26 ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170421172752.GK128305@google.com \
    --to=mka@chromium.org \
    --cc=behanw@converseincode.com \
    --cc=ghackmann@google.com \
    --cc=grundler@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=md@google.com \
    --cc=mmarek@suse.com \
    --cc=pefoley2@pefoley.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.