Re: [PATCH v2 2/5] powerpc/boot: Fix crt0.S syntax for clang
From: Nick Desaulniers <ndesaulniers@google.com>
Date: 2018-09-14 17:47:22
On Thu, Sep 13, 2018 at 9:07 PM Joel Stanley [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <joel@jms.id.au> --- 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: mflr r10 /* 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: addi r12,r12,8@@ -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
Yep, as we can see above, when RELACOUNT is negated, it's wrapped in parens. It's important for Clang's assembler to match GAS eventually, but for now, this change simply cononicalizes all of the the references to RELACOUNT in this source file. Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
bne 11f
ld r8,8(r11) /* get RELACOUNT value in r8 */
11: addi r11,r11,16
--
2.17.1-- Thanks, ~Nick Desaulniers