arm: prevent inlining in arxescsi.c causing build failures
Subsystems (2)
PATCH 1/1 arm: prevent inlining in arxescsi.c causing build failures
The following failure is seen in routine coverage builds:
CC [M] drivers/scsi/arm/arxescsi.o/tmp/cccEyiO7.s: Assembler messages:/tmp/cccEyiO7.s:334: Error: symbol .loop_1' is already defined /tmp/cccEyiO7.s:337: Error: symbol .loop_2' is already defined /tmp/cccEyiO7.s:343: Error: symbol .loop_3' is already defined /tmp/cccEyiO7.s:365: Error: symbol .loop_1' is already defined /tmp/cccEyiO7.s:368: Error: symbol .loop_2' is already defined /tmp/cccEyiO7.s:374: Error: symbol .loop_3' is already defined make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1
It is caused by multiple inline of arxescsi_pseudo_dma_write() which is responsible for the above labels. Marking the fcn as non-inline fixes the issue.
drivers/scsi/arm/arxescsi.c +2 -1
@@ -72,7 +72,8 @@ arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,return fasdma_pseudo; } -static void arxescsi_pseudo_dma_write (unsigned char *addr,void __iomem *base) +static noinline void +arxescsi_pseudo_dma_write (unsigned char *addr,void __iomem *base) { __asm__ __volatile__( " stmdb sp!, {r0-r12}\n"
Signature · 1 line
1.7.7.2
Quoted 12 lines · Paul Gortmaker
The following failure is seen in routine coverage builds:
CC [M]
drivers/scsi/arm/arxescsi.o/tmp/cccEyiO7.s: Assembler messages:/tmp/cccEyiO7.s:334: Error: symbol.loop_1' is already defined /tmp/cccEyiO7.s:337: Error: symbol.loop_2' is already defined/tmp/cccEyiO7.s:343: Error: symbol.loop_3' is already defined /tmp/cccEyiO7.s:365: Error: symbol.loop_1' is already defined/tmp/cccEyiO7.s:368: Error: symbol.loop_2' is already defined /tmp/cccEyiO7.s:374: Error: symbol.loop_3' is already defined make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1
Quoted 5 lines
It is caused by multiple inline of
arxescsi_pseudo_dma_write()which is responsible for the above labels. Marking the fcn as non-inline fixes the issue.Signed-off-by Paul Gortmaker <[email protected]>
Is that a compiler or a code issue? If it's the compiler please fix that. If it's the code, then please document why you added the noinline.
Having said that, "my" compiler compiles drivers/scsi/arm/arxescsi.o just fine (using rpc_defconfig on v3.2-rc2).
drivers/scsi/arm/arxescsi.c arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp, · line 76
Quoted 11 lines
drivers/scsi/arm/arxescsi.c +2
-1@@ -72,7 +72,8 @@ arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,return fasdma_pseudo; } -static void arxescsi_pseudo_dma_write (unsigned char *addr,void __iomem *base) +static noinline void +arxescsi_pseudo_dma_write (unsigned char *addr,void __iomem *base)
Shouldn't this line get some indention?
drivers/scsi/arm/arxescsi.c arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp, · line 79
Quoted 3 lines
drivers/scsi/arm/arxescsi.c +0
-0{ __asm__ __volatile__( " stmdb sp!, {r0-r12}\n"
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Hello.
Quoted 32 lines · Uwe Kleine-K?nig
Quoted 12 lines
The following failure is seen in routine coverage builds:
CC [M]
drivers/scsi/arm/arxescsi.o/tmp/cccEyiO7.s: Assembler messages:/tmp/cccEyiO7.s:334: Error: symbol.loop_1' is already defined /tmp/cccEyiO7.s:337: Error: symbol.loop_2' is already defined/tmp/cccEyiO7.s:343: Error: symbol.loop_3' is already defined /tmp/cccEyiO7.s:365: Error: symbol.loop_1' is already defined/tmp/cccEyiO7.s:368: Error: symbol.loop_2' is already defined /tmp/cccEyiO7.s:374: Error: symbol.loop_3' is already defined make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1Quoted 5 lines
It is caused by multiple inline of
arxescsi_pseudo_dma_write()which is responsible for the above labels. Marking the fcn as non-inline fixes the issue.Signed-off-by Paul Gortmaker<[email protected]>Is that a compiler or a code issue? If it's the compiler please fix that. If it's the code, then please document why you added the noinline.
Having said that, "my" compiler compiles
drivers/scsi/arm/arxescsi.ojust fine (usingrpc_defconfigon v3.2-rc2).Quoted 8 lines
drivers/scsi/arm/arxescsi.c +0
-0@@ -72,7 +72,8 @@ arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp,return fasdma_pseudo; }
Quoted 5 lines
drivers/scsi/arm/arxescsi.c arxescsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp, · line 76
Quoted 3 lines
drivers/scsi/arm/arxescsi.c +2
-1-static void arxescsi_pseudo_dma_write (unsigned char *addr,void __iomem *base) +static noinline void +arxescsi_pseudo_dma_write (unsigned char *addr,void __iomem *base)Shouldn't this line get some indention?
No, usually such lines don't get indented.
WBR, Sergei
Quoted 13 lines · Uwe Kleine-K?nig
Quoted 12 lines · Paul Gortmaker
The following failure is seen in routine coverage builds:
CC [M]
drivers/scsi/arm/arxescsi.o/tmp/cccEyiO7.s: Assembler messages:/tmp/cccEyiO7.s:334: Error: symbol.loop_1' is already defined /tmp/cccEyiO7.s:337: Error: symbol.loop_2' is already defined/tmp/cccEyiO7.s:343: Error: symbol.loop_3' is already defined /tmp/cccEyiO7.s:365: Error: symbol.loop_1' is already defined/tmp/cccEyiO7.s:368: Error: symbol.loop_2' is already defined /tmp/cccEyiO7.s:374: Error: symbol.loop_3' is already defined make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1
Quoted 7 lines
Quoted 5 lines
It is caused by multiple inline of
arxescsi_pseudo_dma_write()which is responsible for the above labels. Marking the fcn as non-inline fixes the issue.Signed-off-by Paul Gortmaker <[email protected]>Is that a compiler or a code issue? If it's the compiler please fix that. If it's the code, then please document why you added the noinline.
The problem is mostly in the code: The symbols are defined in an inline assembly that is not meant to be instantiated multiple times. gcc may decide to unroll the loop in which this is done, which causes the error above. Unrolling the loop is a rather silly thing to do here, because the code is rather large and does not at all benefit from unrolling. You can use the patch below to fix the code to still work if the loop is unrolled, but I also think that marking the function as uninline is a good idea, in particular because I don't trust the old assembly to still do the right thing otherwise:
It manually saves and restores the registers on the stack, where you nowadays would specify specific clobbers for the registers it uses, and let the compiler take care of it. It also doesn't contain a memory clobber for the buffer, so keeping the function out-of-line is probably the safe choice.
Quoted 2 lines
Having said that, "my" compiler compiles
drivers/scsi/arm/arxescsi.ojust fine (usingrpc_defconfigon v3.2-rc2).
You should be able to reproduce it by adding -funroll-all-loops to the CFLAGS. That made the difference for me on gcc-4.6 from Ubuntu.
Arnd
8<-----
PATCH: scsi/arxcescsi: use local assembler symbols
Quoted 8 lines
Quoted 8 lines
/tmp/cccEyiO7.s: Assembler messages:/tmp/cccEyiO7.s:334: Error: symbol.loop_1' is already defined /tmp/cccEyiO7.s:337: Error: symbol.loop_2' is already defined/tmp/cccEyiO7.s:343: Error: symbol.loop_3' is already defined /tmp/cccEyiO7.s:365: Error: symbol.loop_1' is already defined/tmp/cccEyiO7.s:368: Error: symbol.loop_2' is already defined /tmp/cccEyiO7.s:374: Error: symbol.loop_3' is already defined make[4]: *** [drivers/scsi/arm/arxescsi.o] Error 1
drivers/scsi/arm/arxescsi.c +6 -6
@@ -80,21 +80,21 @@ static void arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)" mov r1, %1\n" " add r2, r1, #512\n" " mov r4, #256\n" -".loop_1: ldmia r3!, {r6, r8, r10, r12}\n" +"1: ldmia r3!, {r6, r8, r10, r12}\n" " mov r5, r6, lsl #16\n" " mov r7, r8, lsl #16\n" -".loop_2: ldrb r0, [r1, #1536]\n" +"2: ldrb r0, [r1, #1536]\n" " tst r0, #1\n" -" beq .loop_2\n" +" beq 2b\n" " stmia r2, {r5-r8}\n\t" " mov r9, r10, lsl #16\n" " mov r11, r12, lsl #16\n" -".loop_3: ldrb r0, [r1, #1536]\n" +"3: ldrb r0, [r1, #1536]\n" " tst r0, #1\n" -" beq .loop_3\n" +" beq 3b\n" " stmia r2, {r9-r12}\n" " subs r4, r4, #16\n" -" bne .loop_1\n" +" bne 1b\n" " ldmia sp!, {r0-r12}\n" : : "r" (addr), "r" (base));