diff mbox series

[1/2] powerpc/boot: Fix crt0.S syntax for clang

Message ID 20180910085714.4834-2-joel@jms.id.au (mailing list archive)
State Superseded, archived
Headers show
Series powerpc: Clang build fixes | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied
snowpatch_ozlabs/checkpatch success Test checkpatch on branch next

Commit Message

Joel Stanley Sept. 10, 2018, 8:57 a.m. UTC
Clang's assembler does not like the syntax of the cmpdi:

 arch/powerpc/boot/crt0.S:168:22: error: unexpected modifier on variable reference
         cmpdi   12,RELACOUNT@l
                              ^
 arch/powerpc/boot/crt0.S:168:11: error: unknown operand
         cmpdi   12,RELACOUNT@l
                   ^
Enclosing RELACOUNT in () makes it is happy. Tested with GCC 8 and Clang
8 (trunk).

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 arch/powerpc/boot/crt0.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Segher Boessenkool Sept. 11, 2018, 11:32 a.m. UTC | #1
On Mon, Sep 10, 2018 at 06:57:13PM +1000, Joel Stanley wrote:
> Clang's assembler does not like the syntax of the cmpdi:
> 
>  arch/powerpc/boot/crt0.S:168:22: error: unexpected modifier on variable reference
>          cmpdi   12,RELACOUNT@l
>                               ^
>  arch/powerpc/boot/crt0.S:168:11: error: unknown operand
>          cmpdi   12,RELACOUNT@l
>                    ^
> Enclosing RELACOUNT in () makes it is happy. Tested with GCC 8 and Clang
> 8 (trunk).

Is clang going to fix this?  You also might want to add a comment that
this is a workaround for that broken assembler.


Segher
Joel Stanley Sept. 14, 2018, 2:55 a.m. UTC | #2
On Tue, 11 Sep 2018 at 21:02, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Mon, Sep 10, 2018 at 06:57:13PM +1000, Joel Stanley wrote:
> > Clang's assembler does not like the syntax of the cmpdi:
> >
> >  arch/powerpc/boot/crt0.S:168:22: error: unexpected modifier on variable reference
> >          cmpdi   12,RELACOUNT@l
> >                               ^
> >  arch/powerpc/boot/crt0.S:168:11: error: unknown operand
> >          cmpdi   12,RELACOUNT@l
> >                    ^
> > Enclosing RELACOUNT in () makes it is happy. Tested with GCC 8 and Clang
> > 8 (trunk).
>
> Is clang going to fix this?  You also might want to add a comment that
> this is a workaround for that broken assembler.

I am not sure that we need a comment, it doesn't look too out of place
compared to the other uses of wrapping symbols in ().

I did open a bug against clang though in the hope that they can fix
the behaviour:

 https://bugs.llvm.org/show_bug.cgi?id=38945

Cheers,

Joel
diff mbox series

Patch

diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index dcf2f15e6797..ace3f3c64620 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -165,7 +165,7 @@  p_base:	mflr	r10		/* r10 now points to runtime addr of p_base */
 	ld	r13,8(r11)       /* get RELA pointer in r13 */
 	b	11f
 10:	addis	r12,r12,(-RELACOUNT)@ha
-	cmpdi	r12,RELACOUNT@l
+	cmpdi	r12,(RELACOUNT)@l
 	bne	11f
 	ld	r8,8(r11)       /* get RELACOUNT value in r8 */
 11:	addi	r11,r11,16