title: How to pass function address to Assembler Instructions with C Expression Operands
body: <p>With gcc/clang for ARM cortex M, is there a way to pass a function address as a constant in Assembler Instructions with C Expression Operands ? More precisely I'd like to load R12 with function address (stored in the memory):
  <code>ldr R12, =func</code>
  within a C function, foe example like this one</p>
  <pre><code>// __attribute__((naked)) 
  int loader(int fn)
  {
  __asm (&quot;ldr R12, =%0&quot;::??? (fn):&quot;r12&quot;);
  // ... then  SVC #0, and the R0 is the return value 
  }
  </code></pre>
  <p>The question is what exactly I have to put for the Input Operand?</p>
  <p>EDIT:
  Thanks for the comments!
  Actually I need to re-implement the KEIL's <code>__svc_indirect(0)</code> which loads R12 with function address and passes up to four arguments in R0..R3 (see <a href="https://www.keil.com/support/man/docs/armcc/armcc_chr1359124970017.htm" rel="nofollow noreferrer">__svc_indirect</a></p>