1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdarg.h>

void test_va(const char *fmt, ...)
{
    va_list ap;
    asm volatile("mov r0, r0 \n"); /* first marker */
    va_start(ap, fmt);
    asm volatile("mov r1, r1 \n"); /* second marker */
    va_end(ap);
    asm volatile("mov r2, r2 \n"); /* third marker */
}

void main(void)
{
    asm volatile("mov r0, r0 \n"); /* first marker */
    test_va("abc", 1, 2, 3);
    asm volatile("mov r1, r1 \n"); /* second marker */
}

test.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <test_va>:
   0:  e92d000f   push  {r0, r1, r2, r3}
   4:  e52db004   push  {fp}    ; (str fp, [sp, #-4]!)
   8:  e28db000   add  fp, sp, #0
   c:  e24dd00c   sub  sp, sp, #12
  10:  e1a00000   nop      ; (mov r0, r0)
  14:  e28b3008   add  r3, fp, #8
  18:  e50b3008   str  r3, [fp, #-8]
  1c:  e1a01001   mov  r1, r1
  20:  e1a02002   mov  r2, r2
  24:  e28bd000   add  sp, fp, #0
  28:  e8bd0800   pop  {fp}
  2c:  e28dd010   add  sp, sp, #16
  30:  e12fff1e   bx  lr

00000034 <main>:
  34:  e92d4800   push  {fp, lr}
  38:  e28db004   add  fp, sp, #4
  3c:  e1a00000   nop      ; (mov r0, r0)
  40:  e59f001c   ldr  r0, [pc, #28]  ; 64 <main+0x30>
  44:  e3a01001   mov  r1, #1
  48:  e3a02002   mov  r2, #2
  4c:  e3a03003   mov  r3, #3
  50:  ebfffffe   bl  0 <test_va>
  54:  e1a01001   mov  r1, r1
  58:  e24bd004   sub  sp, fp, #4
  5c:  e8bd4800   pop  {fp, lr}
  60:  e12fff1e   bx  lr
  64:  00000000   .word  0x00000000