[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQg=E4DGzfFpvnzNQsYrAhgs4SzQVYxqk-6ZeRvT3+2rw@mail.gmail.com>
Date: Wed, 7 Sep 2022 13:27:28 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Nathan Chancellor <nathan@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
Tom Rix <trix@...hat.com>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
clang-built-linux <llvm@...ts.linux.dev>,
X86 ML <x86@...nel.org>,
Dmitrii Bundin <dmitrii.bundin.a@...il.com>,
Fangrui Song <maskray@...gle.com>,
Alexey Alexandrov <aalexand@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Greg Thelen <gthelen@...gle.com>
Subject: Re: [PATCH v2 2/5] Makefile.compiler: Use KBUILD_AFLAGS for as-option
On Wed, Sep 7, 2022 at 12:12 PM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
> >
> >
> >
> >
> > I also believe '-x assembler' should be changed to
> > '-x assembler-with-cpp'.
> >
> >
> > As I mentioned somewhere before, our assembly code (*.S) is always
> > preprocessed. There is no *.s file in the kernel source tree.
> >
> >
> > So, '-x assembler-with-cpp' matches the real situation.
>
> Should I do this for as-instr then as well? In the same patch?
Probably we should fix as-instr in the same way.
You can do it in the same patch, or in a separate one.
It is up to you.
> >
> >
> > One interesting thing is, clang does not warn
> > [-Wunused-command-line-argument] for *.S files.
> >
> >
> >
> >
> > $ clang -fomit-frame-pointer -c -x assembler /dev/null -o /dev/null
> > clang: warning: argument unused during compilation:
> > '-fomit-frame-pointer' [-Wunused-command-line-argument]
> >
> > $ clang -fomit-frame-pointer -c -x assembler-with-cpp /dev/null -o /dev/null
> >
> >
> >
> > The root cause is we are using '-x assembler', which
> > never happens in the kernel tree.
> >
> >
> >
> >
> > To sum up, the code I think correct is:
> >
> >
> > as-option = $(call try-run,\
> > $(CC) -Werror $(KBUILD_AFLAGS) $(1) -c -x assembler-with-cpp
> > /dev/null -o "$$TMP",$(1),$(2))
>
> Does your recent patch affect this?
> https://lore.kernel.org/linux-kbuild/20220905083619.672091-1-masahiroy@kernel.org/
No, I do not think so.
> If so, then I should not add -Werror as you suggest above?
I think we should always add -Werror to as-option.
as-option checks the command line options with /dev/null
as the source input (that is, source input is always valid).
If as-option results in a warning, that option will sprinkle
the same warning for all *.S files in the source tree.
So, any warning in as-option should be considered as an error.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists