2009-09-16 14:01:33

by Frans Pop

[permalink] [raw]
Subject: Build error on arm in crypto/cast6.c

$ git describe master
v2.6.31-4547-g0cb583f

gcc version 4.3.2

crypto/cast6.c:372:39: error: macro "W" passed 2 arguments, but takes just 1
crypto/cast6.c:372: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
crypto/cast6.c:413:16: error: macro "W" passed 2 arguments, but takes just 1
crypto/cast6.c: In function ‘cast6_setkey’:
crypto/cast6.c:413: error: ‘W’ undeclared (first use in this function)
crypto/cast6.c:413: error: (Each undeclared identifier is reported only once
crypto/cast6.c:413: error: for each function it appears in.)
crypto/cast6.c:414:20: error: macro "W" passed 2 arguments, but takes just 1

Strange thing is that this file does not look to have changed.

Maybe it's a result of enabling the new config option CRYPTO_DEV_MV_CESA?

Cheers,
FJP


2009-09-16 14:28:31

by Frans Pop

[permalink] [raw]
Subject: Re: Build error on arm in crypto/cast6.c

On Wednesday 16 September 2009, Frans Pop wrote:
> $ git describe master
> v2.6.31-4547-g0cb583f
>
> gcc version 4.3.2
>
> crypto/cast6.c:372:39: error: macro "W" passed 2 arguments, but takes just 1
> crypto/cast6.c:372: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
> crypto/cast6.c:413:16: error: macro "W" passed 2 arguments, but takes just 1
> crypto/cast6.c: In function ‘cast6_setkey’:
> crypto/cast6.c:413: error: ‘W’ undeclared (first use in this function)
> crypto/cast6.c:413: error: (Each undeclared identifier is reported only once
> crypto/cast6.c:413: error: for each function it appears in.)
> crypto/cast6.c:414:20: error: macro "W" passed 2 arguments, but takes just 1
>
> Strange thing is that this file does not look to have changed.
>
> Maybe it's a result of enabling the new config option
> CRYPTO_DEV_MV_CESA?

Seems unrelated. Kernel compiles fine with CRYPTO_DEV_MV_CESA set and
CRYPTO_CAST6 unset. I did have CRYPTO_CAST6 set to m for .31 kernel
builds without seeing any problems.

As I'm running Debian stable there've no major changes (if any) in the
build environment.

Subject: [PATCH] arm: new W macro to WORD_ACCESS

As reported by Frans Pop the new global macro W on ARM which is included
via
|arch/arm/include/asm/uaccess.h:20
|include/linux/uaccess.h:5
|include/linux/crypto.h:26
|crypto/cast6.c:23

leads to a build error because the crypto/cast6.c defines a function
which is named W.

Reported-by: Frans Pop <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
---
* Frans Pop | 2009-09-16 16:01:34 [+0200]:

>Maybe it's a result of enabling the new config option CRYPTO_DEV_MV_CESA?
please don't blame my shiny new driver :)

Catalin: bisect leads to 8b592783a. I've renamed the macro in this
commit and everything else I found due to compile error. Hope the new
name is acceptable. I think W in global name space is a bad thing to do.
In crypto there are many one letter identifier.
Since you use this in assembly code only you might want to move it to
another header file which does get included from every .c file.

arch/arm/boot/compressed/head.S | 96 +++++++++++++++++++-------------------
arch/arm/include/asm/unified.h | 4 +-
arch/arm/kernel/entry-armv.S | 50 ++++++++++----------
arch/arm/lib/copy_from_user.S | 2 +-
arch/arm/lib/copy_template.S | 4 +-
arch/arm/lib/copy_to_user.S | 2 +-
arch/arm/lib/memcpy.S | 4 +-
arch/arm/lib/memmove.S | 28 ++++++------
8 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index fa6fbf4..6939dd0 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -612,8 +612,8 @@ call_cache_fn: adr r12, proc_types
proc_types:
.word 0x41560600 @ ARM6/610
.word 0xffffffe0
- W(b) __arm6_mmu_cache_off @ works, but slow
- W(b) __arm6_mmu_cache_off
+ WORD_ACCESS(b) __arm6_mmu_cache_off @ works, but slow
+ WORD_ACCESS(b) __arm6_mmu_cache_off
mov pc, lr
THUMB( nop )
@ b __arm6_mmu_cache_on @ untested
@@ -631,29 +631,29 @@ proc_types:

.word 0x41007000 @ ARM7/710
.word 0xfff8fe00
- W(b) __arm7_mmu_cache_off
- W(b) __arm7_mmu_cache_off
+ WORD_ACCESS(b) __arm7_mmu_cache_off
+ WORD_ACCESS(b) __arm7_mmu_cache_off
mov pc, lr
THUMB( nop )

.word 0x41807200 @ ARM720T (writethrough)
.word 0xffffff00
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
mov pc, lr
THUMB( nop )

.word 0x41007400 @ ARM74x
.word 0xff00ff00
- W(b) __armv3_mpu_cache_on
- W(b) __armv3_mpu_cache_off
- W(b) __armv3_mpu_cache_flush
+ WORD_ACCESS(b) __armv3_mpu_cache_on
+ WORD_ACCESS(b) __armv3_mpu_cache_off
+ WORD_ACCESS(b) __armv3_mpu_cache_flush

.word 0x41009400 @ ARM94x
.word 0xff00ff00
- W(b) __armv4_mpu_cache_on
- W(b) __armv4_mpu_cache_off
- W(b) __armv4_mpu_cache_flush
+ WORD_ACCESS(b) __armv4_mpu_cache_on
+ WORD_ACCESS(b) __armv4_mpu_cache_off
+ WORD_ACCESS(b) __armv4_mpu_cache_flush

.word 0x00007000 @ ARM7 IDs
.word 0x0000f000
@@ -668,39 +668,39 @@ proc_types:

.word 0x4401a100 @ sa110 / sa1100
.word 0xffffffe0
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x6901b110 @ sa1110
.word 0xfffffff0
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x56056930
.word 0xff0ffff0 @ PXA935
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x56158000 @ PXA168
.word 0xfffff000
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv5tej_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv5tej_mmu_cache_flush

.word 0x56056930
.word 0xff0ffff0 @ PXA935
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x56050000 @ Feroceon
.word 0xff0f0000
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv5tej_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv5tej_mmu_cache_flush

#ifdef CONFIG_CPU_FEROCEON_OLD_ID
/* this conflicts with the standard ARMv5TE entry */
@@ -713,41 +713,41 @@ proc_types:

.word 0x66015261 @ FA526
.word 0xff01fff1
- W(b) __fa526_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __fa526_cache_flush
+ WORD_ACCESS(b) __fa526_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __fa526_cache_flush

@ These match on the architecture ID

.word 0x00020000 @ ARMv4T
.word 0x000f0000
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x00050000 @ ARMv5TE
.word 0x000f0000
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x00060000 @ ARMv5TEJ
.word 0x000f0000
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv4_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv4_mmu_cache_flush

.word 0x0007b000 @ ARMv6
.word 0x000ff000
- W(b) __armv4_mmu_cache_on
- W(b) __armv4_mmu_cache_off
- W(b) __armv6_mmu_cache_flush
+ WORD_ACCESS(b) __armv4_mmu_cache_on
+ WORD_ACCESS(b) __armv4_mmu_cache_off
+ WORD_ACCESS(b) __armv6_mmu_cache_flush

.word 0x000f0000 @ new CPU Id
.word 0x000f0000
- W(b) __armv7_mmu_cache_on
- W(b) __armv7_mmu_cache_off
- W(b) __armv7_mmu_cache_flush
+ WORD_ACCESS(b) __armv7_mmu_cache_on
+ WORD_ACCESS(b) __armv7_mmu_cache_off
+ WORD_ACCESS(b) __armv7_mmu_cache_flush

.word 0 @ unrecognised type
.word 0
diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
index 073e85b..0dd685a 100644
--- a/arch/arm/include/asm/unified.h
+++ b/arch/arm/include/asm/unified.h
@@ -35,7 +35,7 @@

#define ARM(x...)
#define THUMB(x...) x
-#define W(instr) instr.w
+#define WORD_ACCESS(instr) instr.w
#define BSYM(sym) sym + 1

#else /* !CONFIG_THUMB2_KERNEL */
@@ -45,7 +45,7 @@

#define ARM(x...) x
#define THUMB(x...)
-#define W(instr) instr
+#define WORD_ACCESS(instr) instr
#define BSYM(sym) sym

#endif /* CONFIG_THUMB2_KERNEL */
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 3d727a8..564789a 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -606,33 +606,33 @@ call_fpe:
THUMB( add pc, r8 )
nop

- W(mov) pc, lr @ CP#0
- W(b) do_fpe @ CP#1 (FPE)
- W(b) do_fpe @ CP#2 (FPE)
- W(mov) pc, lr @ CP#3
+ WORD_ACCESS(mov) pc, lr @ CP#0
+ WORD_ACCESS(b) do_fpe @ CP#1 (FPE)
+ WORD_ACCESS(b) do_fpe @ CP#2 (FPE)
+ WORD_ACCESS(mov) pc, lr @ CP#3
#ifdef CONFIG_CRUNCH
b crunch_task_enable @ CP#4 (MaverickCrunch)
b crunch_task_enable @ CP#5 (MaverickCrunch)
b crunch_task_enable @ CP#6 (MaverickCrunch)
#else
- W(mov) pc, lr @ CP#4
- W(mov) pc, lr @ CP#5
- W(mov) pc, lr @ CP#6
+ WORD_ACCESS(mov) pc, lr @ CP#4
+ WORD_ACCESS(mov) pc, lr @ CP#5
+ WORD_ACCESS(mov) pc, lr @ CP#6
#endif
- W(mov) pc, lr @ CP#7
- W(mov) pc, lr @ CP#8
- W(mov) pc, lr @ CP#9
+ WORD_ACCESS(mov) pc, lr @ CP#7
+ WORD_ACCESS(mov) pc, lr @ CP#8
+ WORD_ACCESS(mov) pc, lr @ CP#9
#ifdef CONFIG_VFP
- W(b) do_vfp @ CP#10 (VFP)
- W(b) do_vfp @ CP#11 (VFP)
+ WORD_ACCESS(b) do_vfp @ CP#10 (VFP)
+ WORD_ACCESS(b) do_vfp @ CP#11 (VFP)
#else
- W(mov) pc, lr @ CP#10 (VFP)
- W(mov) pc, lr @ CP#11 (VFP)
+ WORD_ACCESS(mov) pc, lr @ CP#10 (VFP)
+ WORD_ACCESS(mov) pc, lr @ CP#11 (VFP)
#endif
- W(mov) pc, lr @ CP#12
- W(mov) pc, lr @ CP#13
- W(mov) pc, lr @ CP#14 (Debug)
- W(mov) pc, lr @ CP#15 (Control)
+ WORD_ACCESS(mov) pc, lr @ CP#12
+ WORD_ACCESS(mov) pc, lr @ CP#13
+ WORD_ACCESS(mov) pc, lr @ CP#14 (Debug)
+ WORD_ACCESS(mov) pc, lr @ CP#15 (Control)

#ifdef CONFIG_NEON
.align 6
@@ -1236,13 +1236,13 @@ __vectors_start:
ARM( swi SYS_ERROR0 )
THUMB( svc #0 )
THUMB( nop )
- W(b) vector_und + stubs_offset
- W(ldr) pc, .LCvswi + stubs_offset
- W(b) vector_pabt + stubs_offset
- W(b) vector_dabt + stubs_offset
- W(b) vector_addrexcptn + stubs_offset
- W(b) vector_irq + stubs_offset
- W(b) vector_fiq + stubs_offset
+ WORD_ACCESS(b) vector_und + stubs_offset
+ WORD_ACCESS(ldr) pc, .LCvswi + stubs_offset
+ WORD_ACCESS(b) vector_pabt + stubs_offset
+ WORD_ACCESS(b) vector_dabt + stubs_offset
+ WORD_ACCESS(b) vector_addrexcptn + stubs_offset
+ WORD_ACCESS(b) vector_irq + stubs_offset
+ WORD_ACCESS(b) vector_fiq + stubs_offset

.globl __vectors_end
__vectors_end:
diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S
index e4fe124..ea25eb7 100644
--- a/arch/arm/lib/copy_from_user.S
+++ b/arch/arm/lib/copy_from_user.S
@@ -61,7 +61,7 @@
.endm

.macro str1w ptr reg abort
- W(str) \reg, [\ptr], #4
+ WORD_ACCESS(str) \reg, [\ptr], #4
.endm

.macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 805e3f8..8619346 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -113,7 +113,7 @@
b 7f
6:
.rept (1 << LDR1W_SHIFT)
- W(nop)
+ WORD_ACCESS(nop)
.endr
ldr1w r1, r3, abort=20f
ldr1w r1, r4, abort=20f
@@ -131,7 +131,7 @@
add pc, pc, ip
nop
.rept (1 << STR1W_SHIFT)
- W(nop)
+ WORD_ACCESS(nop)
.endr
str1w r0, r3, abort=20f
str1w r0, r4, abort=20f
diff --git a/arch/arm/lib/copy_to_user.S b/arch/arm/lib/copy_to_user.S
index 1a71e15..8e7b756 100644
--- a/arch/arm/lib/copy_to_user.S
+++ b/arch/arm/lib/copy_to_user.S
@@ -41,7 +41,7 @@
#endif

.macro ldr1w ptr reg abort
- W(ldr) \reg, [\ptr], #4
+ WORD_ACCESS(ldr) \reg, [\ptr], #4
.endm

.macro ldr4w ptr reg1 reg2 reg3 reg4 abort
diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S
index a9b9e22..28aa074 100644
--- a/arch/arm/lib/memcpy.S
+++ b/arch/arm/lib/memcpy.S
@@ -17,7 +17,7 @@
#define STR1W_SHIFT 0

.macro ldr1w ptr reg abort
- W(ldr) \reg, [\ptr], #4
+ WORD_ACCESS(ldr) \reg, [\ptr], #4
.endm

.macro ldr4w ptr reg1 reg2 reg3 reg4 abort
@@ -33,7 +33,7 @@
.endm

.macro str1w ptr reg abort
- W(str) \reg, [\ptr], #4
+ WORD_ACCESS(str) \reg, [\ptr], #4
.endm

.macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
diff --git a/arch/arm/lib/memmove.S b/arch/arm/lib/memmove.S
index 5025c86..08a6210 100644
--- a/arch/arm/lib/memmove.S
+++ b/arch/arm/lib/memmove.S
@@ -75,24 +75,24 @@ ENTRY(memmove)
addne pc, pc, ip @ C is always clear here
b 7f
6: nop
- W(ldr) r3, [r1, #-4]!
- W(ldr) r4, [r1, #-4]!
- W(ldr) r5, [r1, #-4]!
- W(ldr) r6, [r1, #-4]!
- W(ldr) r7, [r1, #-4]!
- W(ldr) r8, [r1, #-4]!
- W(ldr) lr, [r1, #-4]!
+ WORD_ACCESS(ldr) r3, [r1, #-4]!
+ WORD_ACCESS(ldr) r4, [r1, #-4]!
+ WORD_ACCESS(ldr) r5, [r1, #-4]!
+ WORD_ACCESS(ldr) r6, [r1, #-4]!
+ WORD_ACCESS(ldr) r7, [r1, #-4]!
+ WORD_ACCESS(ldr) r8, [r1, #-4]!
+ WORD_ACCESS(ldr) lr, [r1, #-4]!

add pc, pc, ip
nop
nop
- W(str) r3, [r0, #-4]!
- W(str) r4, [r0, #-4]!
- W(str) r5, [r0, #-4]!
- W(str) r6, [r0, #-4]!
- W(str) r7, [r0, #-4]!
- W(str) r8, [r0, #-4]!
- W(str) lr, [r0, #-4]!
+ WORD_ACCESS(str) r3, [r0, #-4]!
+ WORD_ACCESS(str) r4, [r0, #-4]!
+ WORD_ACCESS(str) r5, [r0, #-4]!
+ WORD_ACCESS(str) r6, [r0, #-4]!
+ WORD_ACCESS(str) r7, [r0, #-4]!
+ WORD_ACCESS(str) r8, [r0, #-4]!
+ WORD_ACCESS(str) lr, [r0, #-4]!

CALGN( bcs 2b )

--
1.6.4.GIT


2009-09-16 18:42:31

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH] arm: new W macro to WORD_ACCESS

On Wed, Sep 16, 2009 at 07:58:12PM +0200, Sebastian Andrzej Siewior wrote:
> leads to a build error because the crypto/cast6.c defines a function
> which is named W.

W has nothing to do with the access size, so this change makes it _really_
confusing. What it's about is telling the compiler to use the ARM 32-bit
version of the instruction coding when building for Thumb2 (which
can intermix Thumb and ARM instruction sets.)

So the macro needs to be renamed... NAK on this patch as it stands.

2009-09-16 21:03:44

by Catalin Marinas

[permalink] [raw]
Subject: Re: [PATCH] arm: new W macro to WORD_ACCESS

On Wed, 2009-09-16 at 19:58 +0200, Sebastian Andrzej Siewior wrote:
> As reported by Frans Pop the new global macro W on ARM which is included
> via
> |arch/arm/include/asm/uaccess.h:20
> |include/linux/uaccess.h:5
> |include/linux/crypto.h:26
> |crypto/cast6.c:23
>
> leads to a build error because the crypto/cast6.c defines a function
> which is named W.

This was already reported by Alexey Dobriyan and I included his patch in
my Thumb-2 branch (and -next for now):

http://linux-arm.org/git?p=linux-2.6.git;a=commitdiff;h=4fb3c2e2ab3549308a1b1663296d165e45d72ba5

Since this macro is only used in ARM assembly code, the patch simply
adds some ifdefs around it.

Russell, if you are OK with Alexey's patch, I'll send you a pull request
(though for only one patch, alternatively just merge it manually).

--
Catalin