linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3
@ 2022-02-08 15:21 Paul Menzel
  2022-02-08 15:21 ` [PATCH v2 2/2] lib/raid6: Include <asm/ppc-opcode.h> for `VPERMXOR` Paul Menzel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Menzel @ 2022-02-08 15:21 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh
  Cc: Paul Menzel, linux-kernel, Matt Brown, linux-raid, Song Liu,
	netdev, bpf, linuxppc-dev

Buidling `raid6test` on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the
errors below:

    $ cd lib/raid6/test/
    $ make
    <stdin>:1:1: error: stray ‘\’ in program
    <stdin>:1:2: error: stray ‘#’ in program
    <stdin>:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
    cp -f ../int.uc int.uc
    awk -f ../unroll.awk -vN=1 < int.uc > int1.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int1.o int1.c
    awk -f ../unroll.awk -vN=2 < int.uc > int2.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int2.o int2.c
    awk -f ../unroll.awk -vN=4 < int.uc > int4.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int4.o int4.c
    awk -f ../unroll.awk -vN=8 < int.uc > int8.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int8.o int8.c
    awk -f ../unroll.awk -vN=16 < int.uc > int16.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int16.o int16.c
    awk -f ../unroll.awk -vN=32 < int.uc > int32.c
    gcc -I.. -I ../../../include -g -O2                      -c -o int32.o int32.c
    rm -f raid6.a
    ar cq raid6.a int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o
    ranlib raid6.a
    gcc -I.. -I ../../../include -g -O2                      -o raid6test test.c raid6.a
    /usr/bin/ld: raid6.a(algos.o):/dev/shm/linux/lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; /scratch/local/ccIJjN8s.o:/dev/shm/linux/lib/raid6/test/test.c:22: first defined here
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:72: raid6test] Error 1

The errors come from the `HAS_ALTIVEC` test, which fails, and the POWER
optimized versions are not built. That’s also reason nobody noticed on the
other architectures.

GNU Make 4.3 does not remove the backslash anymore. From the 4.3 release
announcment:

> * WARNING: Backward-incompatibility!
>   Number signs (#) appearing inside a macro reference or function invocation
>   no longer introduce comments and should not be escaped with backslashes:
>   thus a call such as:
>     foo := $(shell echo '#')
>   is legal.  Previously the number sign needed to be escaped, for example:
>     foo := $(shell echo '\#')
>   Now this latter will resolve to "\#".  If you want to write makefiles
>   portable to both versions, assign the number sign to a variable:
>     H := \#
>     foo := $(shell echo '$H')
>   This was claimed to be fixed in 3.81, but wasn't, for some reason.
>   To detect this change search for 'nocomment' in the .FEATURES variable.

So, do the same as commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd
files for future Make") and commit 929bef467771 ("bpf: Use $(pound) instead
of \# in Makefiles") and define and use a `$(pound)` variable.

Reference for the change in make:
https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57

Cc: Matt Brown <matthew.brown.dev@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
v2: Fix checkpatch.pl errors by adding missing quotes around git commit
message summary/title.

 lib/raid6/test/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/raid6/test/Makefile b/lib/raid6/test/Makefile
index a4c7cd74cff5..4fb7700a741b 100644
--- a/lib/raid6/test/Makefile
+++ b/lib/raid6/test/Makefile
@@ -4,6 +4,8 @@
 # from userspace.
 #
 
+pound := \#
+
 CC	 = gcc
 OPTFLAGS = -O2			# Adjust as desired
 CFLAGS	 = -I.. -I ../../../include -g $(OPTFLAGS)
@@ -42,7 +44,7 @@ else ifeq ($(HAS_NEON),yes)
         OBJS   += neon.o neon1.o neon2.o neon4.o neon8.o recov_neon.o recov_neon_inner.o
         CFLAGS += -DCONFIG_KERNEL_MODE_NEON=1
 else
-        HAS_ALTIVEC := $(shell printf '\#include <altivec.h>\nvector int a;\n' |\
+        HAS_ALTIVEC := $(shell printf '$(pound)include <altivec.h>\nvector int a;\n' |\
                          gcc -c -x c - >/dev/null && rm ./-.o && echo yes)
         ifeq ($(HAS_ALTIVEC),yes)
                 CFLAGS += -I../../../arch/powerpc/include
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] lib/raid6: Include <asm/ppc-opcode.h> for `VPERMXOR`
  2022-02-08 15:21 [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Paul Menzel
@ 2022-02-08 15:21 ` Paul Menzel
  2022-02-08 17:58 ` [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Song Liu
  2022-02-08 22:12 ` Wols Lists
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Menzel @ 2022-02-08 15:21 UTC (permalink / raw)
  Cc: Paul Menzel, linux-kernel, Matt Brown, linux-raid, Song Liu,
	linuxppc-dev

On Ubuntu 21.10 (ppc64le) building `raid6test` with gcc (Ubuntu
11.2.0-7ubuntu2) 11.2.0 fails with the error below.

    gcc -I.. -I ../../../include -g -O2                      -I../../../arch/powerpc/include -DCONFIG_ALTIVEC -c -o vpermxor1.o vpermxor1.c
    vpermxor1.c: In function ‘raid6_vpermxor1_gen_syndrome_real’:
    vpermxor1.c:64:29: error: expected string literal before ‘VPERMXOR’
       64 |                         asm(VPERMXOR(%0,%1,%2,%3):"=v"(wq0):"v"(gf_high), "v"(gf_low), "v"(wq0));
          |                             ^~~~~~~~
    make: *** [Makefile:58: vpermxor1.o] Error 1

So, include the header `asm/ppc-opcode.h` defining this macro also when
not building the Linux kernel but only this too.

Cc: Matt Brown <matthew.brown.dev@gmail.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
v2: Resend

 lib/raid6/vpermxor.uc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/raid6/vpermxor.uc b/lib/raid6/vpermxor.uc
index 10475dc423c1..1bfb127fbfe8 100644
--- a/lib/raid6/vpermxor.uc
+++ b/lib/raid6/vpermxor.uc
@@ -24,9 +24,9 @@
 #ifdef CONFIG_ALTIVEC
 
 #include <altivec.h>
+#include <asm/ppc-opcode.h>
 #ifdef __KERNEL__
 #include <asm/cputable.h>
-#include <asm/ppc-opcode.h>
 #include <asm/switch_to.h>
 #endif
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3
  2022-02-08 15:21 [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Paul Menzel
  2022-02-08 15:21 ` [PATCH v2 2/2] lib/raid6: Include <asm/ppc-opcode.h> for `VPERMXOR` Paul Menzel
@ 2022-02-08 17:58 ` Song Liu
  2022-02-08 22:12 ` Wols Lists
  2 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2022-02-08 17:58 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Song Liu, Daniel Borkmann, John Fastabend, Alexei Starovoitov,
	Andrii Nakryiko, linux-raid, Networking, KP Singh, Yonghong Song,
	bpf, Matt Brown, linuxppc-dev, Martin KaFai Lau, open list

On Tue, Feb 8, 2022 at 7:22 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Buidling `raid6test` on Ubuntu 21.10 (ppc64le) with GNU Make 4.3 shows the
> errors below:
>
>     $ cd lib/raid6/test/
>     $ make
>     <stdin>:1:1: error: stray ‘\’ in program
>     <stdin>:1:2: error: stray ‘#’ in program
>     <stdin>:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
>     cp -f ../int.uc int.uc
>     awk -f ../unroll.awk -vN=1 < int.uc > int1.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int1.o int1.c
>     awk -f ../unroll.awk -vN=2 < int.uc > int2.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int2.o int2.c
>     awk -f ../unroll.awk -vN=4 < int.uc > int4.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int4.o int4.c
>     awk -f ../unroll.awk -vN=8 < int.uc > int8.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int8.o int8.c
>     awk -f ../unroll.awk -vN=16 < int.uc > int16.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int16.o int16.c
>     awk -f ../unroll.awk -vN=32 < int.uc > int32.c
>     gcc -I.. -I ../../../include -g -O2                      -c -o int32.o int32.c
>     rm -f raid6.a
>     ar cq raid6.a int1.o int2.o int4.o int8.o int16.o int32.o recov.o algos.o tables.o
>     ranlib raid6.a
>     gcc -I.. -I ../../../include -g -O2                      -o raid6test test.c raid6.a
>     /usr/bin/ld: raid6.a(algos.o):/dev/shm/linux/lib/raid6/test/algos.c:28: multiple definition of `raid6_call'; /scratch/local/ccIJjN8s.o:/dev/shm/linux/lib/raid6/test/test.c:22: first defined here
>     collect2: error: ld returned 1 exit status
>     make: *** [Makefile:72: raid6test] Error 1
>
> The errors come from the `HAS_ALTIVEC` test, which fails, and the POWER
> optimized versions are not built. That’s also reason nobody noticed on the
> other architectures.
>
> GNU Make 4.3 does not remove the backslash anymore. From the 4.3 release
> announcment:
>
> > * WARNING: Backward-incompatibility!
> >   Number signs (#) appearing inside a macro reference or function invocation
> >   no longer introduce comments and should not be escaped with backslashes:
> >   thus a call such as:
> >     foo := $(shell echo '#')
> >   is legal.  Previously the number sign needed to be escaped, for example:
> >     foo := $(shell echo '\#')
> >   Now this latter will resolve to "\#".  If you want to write makefiles
> >   portable to both versions, assign the number sign to a variable:
> >     H := \#
> >     foo := $(shell echo '$H')
> >   This was claimed to be fixed in 3.81, but wasn't, for some reason.
> >   To detect this change search for 'nocomment' in the .FEATURES variable.
>
> So, do the same as commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd
> files for future Make") and commit 929bef467771 ("bpf: Use $(pound) instead
> of \# in Makefiles") and define and use a `$(pound)` variable.
>
> Reference for the change in make:
> https://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57
>
> Cc: Matt Brown <matthew.brown.dev@gmail.com>
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>

I removed all the "`", fixed some unwrapped commit log, shortened some lines
and applied the set to md-next. Please review that version and let me know if
anything need to change.

Thanks,
Song

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3
  2022-02-08 15:21 [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Paul Menzel
  2022-02-08 15:21 ` [PATCH v2 2/2] lib/raid6: Include <asm/ppc-opcode.h> for `VPERMXOR` Paul Menzel
  2022-02-08 17:58 ` [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Song Liu
@ 2022-02-08 22:12 ` Wols Lists
  2022-02-09 13:41   ` David T-G
  2 siblings, 1 reply; 6+ messages in thread
From: Wols Lists @ 2022-02-08 22:12 UTC (permalink / raw)
  To: Paul Menzel, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh
  Cc: linux-kernel, Matt Brown, linux-raid, Song Liu, netdev, bpf,
	linuxppc-dev

On 08/02/2022 15:21, Paul Menzel wrote:
> So, do the same as commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd
> files for future Make") and commit 929bef467771 ("bpf: Use $(pound) instead
> of \# in Makefiles") and define and use a `$(pound)` variable.

As commented elsewhere, for the sake of us ENGLISH speakers, *PLEASE* 
make that $(hash). A pound sign is £.

Cheers,
Wol

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3
  2022-02-08 22:12 ` Wols Lists
@ 2022-02-09 13:41   ` David T-G
  2022-02-09 14:45     ` David Laight
  0 siblings, 1 reply; 6+ messages in thread
From: David T-G @ 2022-02-09 13:41 UTC (permalink / raw)
  To: linux-raid; +Cc: netdev, bpf, linuxppc-dev, linux-kernel

Paul, et al --

...and then Wols Lists said...
% 
% On 08/02/2022 15:21, Paul Menzel wrote:
...
% 
% As commented elsewhere, for the sake of us ENGLISH speakers,
% *PLEASE* make that $(hash). A pound sign is £.

Or, even better, $(octothorpe) since that's merely a symbol rather than a
food product or a result of an algorithm on data.  You might even hope
that we hash this out eventually ...


Have a great day!

:-D
-- 
David T-G
See http://justpickone.org/davidtg/email/
See http://justpickone.org/davidtg/tofu.txt


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3
  2022-02-09 13:41   ` David T-G
@ 2022-02-09 14:45     ` David Laight
  0 siblings, 0 replies; 6+ messages in thread
From: David Laight @ 2022-02-09 14:45 UTC (permalink / raw)
  To: 'David T-G', linux-raid@vger.kernel.org
  Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org

From: David T-G
> Sent: 09 February 2022 13:42
> 
> ...and then Wols Lists said...
> %
> % On 08/02/2022 15:21, Paul Menzel wrote:
> ...
> %
> % As commented elsewhere, for the sake of us ENGLISH speakers,
> % *PLEASE* make that $(hash). A pound sign is £.
> 
> Or, even better, $(octothorpe) since that's merely a symbol rather than a
> food product or a result of an algorithm on data.  You might even hope
> that we hash this out eventually ...

I was more worried that people might think we should smoke the hash.

The # symbol called 'hash' in the UK. Can't remember why - but it is used
to mean 'number'.

'octothorpe' is some brain-damaged name and should be shot^Werased on sight.

The whole UK v US confusion about what a 'pound' sign looks like almost
certainly led to UK ascii using the £ glyph for 0x23.
I can imaging a phone call where a US person said '0x23 is the pound sign'.

I remember problems with ascii peripherals on a ebcdic mainframe where
£ $ # and \ had to get squeezed into the three available codes.
Not only was in semi-random what a line printer might print,
we had 'page mode' terminals where the input and output translation
tables didn't always match.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-09 14:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-08 15:21 [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Paul Menzel
2022-02-08 15:21 ` [PATCH v2 2/2] lib/raid6: Include <asm/ppc-opcode.h> for `VPERMXOR` Paul Menzel
2022-02-08 17:58 ` [PATCH v2 1/2] lib/raid6/test/Makefile: Use `$(pound)` instead of `\#` for Make 4.3 Song Liu
2022-02-08 22:12 ` Wols Lists
2022-02-09 13:41   ` David T-G
2022-02-09 14:45     ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).