Re: [PATCH v2 2/5] powerpc/boot: Fix crt0.S syntax for clang

2018-09-18 Thread Michael Ellerman
Joel Stanley  writes:

> On Tue, 18 Sep 2018 at 06:11, Nick Desaulniers  
> wrote:
>>
>> On Fri, Sep 14, 2018 at 2:08 PM Segher Boessenkool
>>  wrote:
>> >
>> > On Fri, Sep 14, 2018 at 10:47:08AM -0700, Nick Desaulniers wrote:
>> > > On Thu, Sep 13, 2018 at 9:07 PM Joel Stanley  wrote:
>> > > >  10:addis   r12,r12,(-RELACOUNT)@ha
>> > > > -   cmpdi   r12,RELACOUNT@l
>> > > > +   cmpdi   r12,(RELACOUNT)@l
>> > >
>> > > Yep, as we can see above, when RELACOUNT is negated, it's wrapped in
>> > > parens.
>>
>> Looks like this was just fixed in Clang-8:
>> https://bugs.llvm.org/show_bug.cgi?id=38945
>> https://reviews.llvm.org/D52188
>
> Nice!
>
> mpe, given we need the local references to labels fix which is also in
> clang-8 I suggest we drop this patch.

OK, no worries.

cheers


Re: [PATCH v2 2/5] powerpc/boot: Fix crt0.S syntax for clang

2018-09-17 Thread Joel Stanley
On Tue, 18 Sep 2018 at 06:11, Nick Desaulniers  wrote:
>
> On Fri, Sep 14, 2018 at 2:08 PM Segher Boessenkool
>  wrote:
> >
> > On Fri, Sep 14, 2018 at 10:47:08AM -0700, Nick Desaulniers wrote:
> > > On Thu, Sep 13, 2018 at 9:07 PM Joel Stanley  wrote:
> > > >  10:addis   r12,r12,(-RELACOUNT)@ha
> > > > -   cmpdi   r12,RELACOUNT@l
> > > > +   cmpdi   r12,(RELACOUNT)@l
> > >
> > > Yep, as we can see above, when RELACOUNT is negated, it's wrapped in
> > > parens.
>
> Looks like this was just fixed in Clang-8:
> https://bugs.llvm.org/show_bug.cgi?id=38945
> https://reviews.llvm.org/D52188

Nice!

mpe, given we need the local references to labels fix which is also in
clang-8 I suggest we drop this patch.

Cheers,

Joel


Re: [PATCH v2 2/5] powerpc/boot: Fix crt0.S syntax for clang

2018-09-14 Thread Segher Boessenkool
On Fri, Sep 14, 2018 at 10:47:08AM -0700, Nick Desaulniers wrote:
> On Thu, Sep 13, 2018 at 9:07 PM Joel Stanley  wrote:
> >  10:addis   r12,r12,(-RELACOUNT)@ha
> > -   cmpdi   r12,RELACOUNT@l
> > +   cmpdi   r12,(RELACOUNT)@l
> 
> Yep, as we can see above, when RELACOUNT is negated, it's wrapped in
> parens.

The only thing that does is make it easier for humans to read; it means
exactly the same thing.


Segher


[PATCH v2 2/5] powerpc/boot: Fix crt0.S syntax for clang

2018-09-13 Thread Joel Stanley
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).

Reported to clang as https://bugs.llvm.org/show_bug.cgi?id=38945

Signed-off-by: Joel Stanley 
---
v2: Fix for !powerpc64 too, add bug link to commit message
---
 arch/powerpc/boot/crt0.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index dcf2f15e6797..e453e011d7e7 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -80,7 +80,7 @@ p_base:   mflrr10 /* r10 now points to 
runtime addr of p_base */
lwz r9,4(r12)   /* get RELA pointer in r9 */
b   12f
 11:addis   r8,r8,(-RELACOUNT)@ha
-   cmpwi   r8,RELACOUNT@l
+   cmpwi   r8,(RELACOUNT)@l
bne 12f
lwz r0,4(r12)   /* get RELACOUNT value in r0 */
 12:addir12,r12,8
@@ -165,7 +165,7 @@ p_base: mflrr10 /* 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:addir11,r11,16
-- 
2.17.1