[llvm-bugs] [Bug 45154] New: ppc64le MC assembler does not recognize symbols in certain instructions

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 9 08:49:05 PDT 2020


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

            Bug ID: 45154
           Summary: ppc64le MC assembler does not recognize symbols in
                    certain instructions
           Product: clang
           Version: 9.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: code.optimizer at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Given the following pruned down assembly source generated from XLC:
[dparks at gsn1 tmp]$ cat t.s
.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4
.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4
.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22
.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3

        .file   "t.c"
        .globl  f
        .type   f, at function
        .size   f,40
        .localentry     f,8
        .extern .TOC.

        .section        ".text","ax"
        .align  5
.LC.The_Code:
f:
        addis      RTOC,r12,.TOC.-$@ha
        addi       RTOC,RTOC,.TOC.-$+4 at l
        addis      r3,RTOC,.LC.toc at toc@ha
        ld         r3,.LC.toc at toc@l(r3)
        lfd        fp1,0(r3)
        bclr       BO_ALWAYS,CR0_LT

        .section        ".toc","wa"
        .align  3
.LC.toc:
        .tc d[TC],d

        .ident  "Mon Mar  9 08:34:47 2020 .IBM XL C/C++ for Linux, Version
16.1.1.3."

        .comm   d,8,8
[dparks at gsn1 tmp]$

The source assembles correctly with both xlc and gcc:
[dparks at gsn1 tmp]$ xlc --version
IBM XL C/C++ for Linux, V16.1.1 (Community Edition)
<snip>
[dparks at gsn1 tmp]$ xlc -c t.s
[dparks at gsn1 tmp]$ gcc --version
gcc (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[dparks at gsn1 tmp]$ gcc -c t.s
[dparks at gsn1 tmp]$ 


But fails with the following errors when assembled with clang:
[dparks at gsn1 tmp]$ /home/sw/thirdparty/llvm/linuxpower/9.0-openmp/bin/clang
--version
clang version 9.0.0 (/home/<DELETED>/git/official/llvm/tools/clang
45898f3be1d37727502cd6342b14c19e7c94bfae) (/home/<DELETED>/git/official/llvm
5364ee5faec778f1ddf86b6b4b8452df7db191c5)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/sw/thirdparty/llvm/linuxpower/9.0-openmp/bin
[dparks at gsn1 tmp]$ 

[dparks at gsn1 tmp]$ /home/sw/thirdparty/llvm/linuxpower/9.0-openmp/bin/clang -c
t.s
t.s:22:30: error: invalid memory operand
        ld         r3,.LC.toc at toc@l(r3)
                                    ^
t.s:23:19: error: invalid memory operand
        lfd        fp1,0(r3)
                         ^
[dparks at gsn1 tmp]$


I've also run in to the same problem with store instructions.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200309/ec9372d1/attachment-0001.html>


More information about the llvm-bugs mailing list