[llvm-bugs] [Bug 42912] New: riscv inline assembly compilation failure

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 7 04:14:25 PDT 2019


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

            Bug ID: 42912
           Summary: riscv inline assembly compilation failure
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ronen.haen at wdc.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

riscv inline assembly input operand failure for the following code:


#define M_SET_ENTRY(func) asm volatile ("la x31, %0" : : "i"(func) : );

void my_func(void)
{
   /* 
    * some code here 
    */
}

void some_func(void)
{
   /* 
    * some code here 
    */

   M_SET_ENTRY(my_func);
}

The failure I get: 

./clang -o test.o -c -Os -ffunction-sections -fdata-sections -Wall -c
-fno-builtin-printf -include sys/cdefs.h -mabi=ilp32 -g3 -gdwarf-2
-march=rv32imac --gcc-toolchain=/home/work/bld-rv-linux-32/
--sysroot=/home/work/bld-rv-linux-32/riscv32-unknown-elf/ test.c
test.c:105:4: error: invalid operand in inline asm: 'la x31, $0'
   M_SET_ENTRY(my_func);
   ^
test.c:91:41: note: expanded from macro 'M_SET_ENTRY'
#define M_SET_ENTRY(func) asm volatile ("la x31, %0" : : "i"(func) : );
                                        ^
test.c:105:4: error: unknown operand
test.c:91:41: note: expanded from macro 'M_SET_ENTRY'
#define M_SET_ENTRY(func) asm volatile ("la x31, %0" : : "i"(func) : );
                                        ^
<inline asm>:1:10: note: instantiated into assembly here
        la x31, 
                ^
2 errors generated.

-- 
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/20190807/3bb8a5e9/attachment.html>


More information about the llvm-bugs mailing list