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: unassignedclangb...@nondot.org
          Reporter: ronen.h...@wdc.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to