lkml.org 
[lkml]   [2022]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 2/5] Makefile.compiler: Use KBUILD_AFLAGS for as-option
On Wed, Sep 7, 2022 at 12:12 PM Nick Desaulniers
<ndesaulniers@google.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

\
 
 \ /
  Last update: 2022-09-07 06:29    [W:0.091 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site