<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - riscv inline assembly compilation failure"
   href="https://bugs.llvm.org/show_bug.cgi?id=42912">42912</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>riscv inline assembly compilation failure
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ronen.haen@wdc.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>