From: Segher Boessenkool <segher@kernel.crashing.org> To: Alexey Kardashevskiy <aik@ozlabs.ru> Cc: linuxppc-dev@lists.ozlabs.org, Michal Marek <michal.lkml@markovi.net>, linux-kbuild@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, linux-kernel@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>, clang-built-linux@googlegroups.com, Nicholas Piggin <npiggin@gmail.com> Subject: Re: [PATCH kernel v2] powerpc/makefile: Do not redefine $(CPP) for preprocessor Date: Tue, 11 May 2021 06:20:19 -0500 [thread overview] Message-ID: <20210511112019.GK10366@gate.crashing.org> (raw) In-Reply-To: <20210511044812.267965-1-aik@ozlabs.ru> Hi! On Tue, May 11, 2021 at 02:48:12PM +1000, Alexey Kardashevskiy wrote: > --- a/arch/powerpc/kernel/vdso32/Makefile > +++ b/arch/powerpc/kernel/vdso32/Makefile > @@ -44,7 +44,7 @@ asflags-y := -D__VDSO32__ -s > > obj-y += vdso32_wrapper.o > targets += vdso32.lds > -CPPFLAGS_vdso32.lds += -P -C -Upowerpc > +CPPFLAGS_vdso32.lds += -C > > # link rule for the .so file, .lds has to be first > $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE > --- a/arch/powerpc/kernel/vdso64/Makefile > +++ b/arch/powerpc/kernel/vdso64/Makefile > @@ -30,7 +30,7 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ > asflags-y := -D__VDSO64__ -s > > targets += vdso64.lds > -CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) > +CPPFLAGS_vdso64.lds += -C > > # link rule for the .so file, .lds has to be first > $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE Why are you removing -P and -Upowerpc here? "powerpc" is a predefined macro on powerpc-linux (no underscores or anything, just the bareword). This is historical, like "unix" and "linux". If you use the C preprocessor for things that are not C code (like the kernel does here) you need to undefine these macros, if anything in the files you run through the preprocessor contains those words, or funny / strange / bad things will happen. Presumably at some time in the past it did contain "powerpc" somewhere. -P is to inhibit line number output. Whatever consumes the preprocessor output will have to handle line directives if you remove this flag. Did you check if this will work for everything that uses $(CPP)? In any case, please mention the reasoning (and the fact that you are removing these flags!) in the commit message. Thanks! Segher
WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org> To: Alexey Kardashevskiy <aik@ozlabs.ru> Cc: Michal Marek <michal.lkml@markovi.net>, linux-kbuild@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, linux-kernel@vger.kernel.org, Nicholas Piggin <npiggin@gmail.com>, Nathan Chancellor <nathan@kernel.org>, clang-built-linux@googlegroups.com, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH kernel v2] powerpc/makefile: Do not redefine $(CPP) for preprocessor Date: Tue, 11 May 2021 06:20:19 -0500 [thread overview] Message-ID: <20210511112019.GK10366@gate.crashing.org> (raw) In-Reply-To: <20210511044812.267965-1-aik@ozlabs.ru> Hi! On Tue, May 11, 2021 at 02:48:12PM +1000, Alexey Kardashevskiy wrote: > --- a/arch/powerpc/kernel/vdso32/Makefile > +++ b/arch/powerpc/kernel/vdso32/Makefile > @@ -44,7 +44,7 @@ asflags-y := -D__VDSO32__ -s > > obj-y += vdso32_wrapper.o > targets += vdso32.lds > -CPPFLAGS_vdso32.lds += -P -C -Upowerpc > +CPPFLAGS_vdso32.lds += -C > > # link rule for the .so file, .lds has to be first > $(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday.o FORCE > --- a/arch/powerpc/kernel/vdso64/Makefile > +++ b/arch/powerpc/kernel/vdso64/Makefile > @@ -30,7 +30,7 @@ ccflags-y := -shared -fno-common -fno-builtin -nostdlib \ > asflags-y := -D__VDSO64__ -s > > targets += vdso64.lds > -CPPFLAGS_vdso64.lds += -P -C -U$(ARCH) > +CPPFLAGS_vdso64.lds += -C > > # link rule for the .so file, .lds has to be first > $(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday.o FORCE Why are you removing -P and -Upowerpc here? "powerpc" is a predefined macro on powerpc-linux (no underscores or anything, just the bareword). This is historical, like "unix" and "linux". If you use the C preprocessor for things that are not C code (like the kernel does here) you need to undefine these macros, if anything in the files you run through the preprocessor contains those words, or funny / strange / bad things will happen. Presumably at some time in the past it did contain "powerpc" somewhere. -P is to inhibit line number output. Whatever consumes the preprocessor output will have to handle line directives if you remove this flag. Did you check if this will work for everything that uses $(CPP)? In any case, please mention the reasoning (and the fact that you are removing these flags!) in the commit message. Thanks! Segher
next prev parent reply other threads:[~2021-05-11 11:27 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-11 4:48 [PATCH kernel v2] powerpc/makefile: Do not redefine $(CPP) for preprocessor Alexey Kardashevskiy 2021-05-11 4:48 ` Alexey Kardashevskiy 2021-05-11 11:20 ` Segher Boessenkool [this message] 2021-05-11 11:20 ` Segher Boessenkool 2021-05-11 13:30 ` Alexey Kardashevskiy 2021-05-11 23:16 ` Segher Boessenkool 2021-05-12 3:48 ` Alexey Kardashevskiy 2021-05-12 10:26 ` Segher Boessenkool 2021-05-14 3:10 ` Masahiro Yamada 2021-05-14 3:10 ` Masahiro Yamada 2021-05-11 19:18 ` Nathan Chancellor 2021-05-11 19:18 ` Nathan Chancellor 2021-05-12 3:52 ` Alexey Kardashevskiy 2021-05-12 3:52 ` Alexey Kardashevskiy
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=20210511112019.GK10366@gate.crashing.org \ --to=segher@kernel.crashing.org \ --cc=aik@ozlabs.ru \ --cc=clang-built-linux@googlegroups.com \ --cc=linux-kbuild@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=masahiroy@kernel.org \ --cc=michal.lkml@markovi.net \ --cc=nathan@kernel.org \ --cc=ndesaulniers@google.com \ --cc=npiggin@gmail.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: linkBe 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.