4 //This should be in sync with the declaration in our lib/libtcc1.c
5 /* GCC compatible definition of va_list. */
7 unsigned int gp_offset
;
8 unsigned int fp_offset
;
10 unsigned int overflow_offset
;
11 char *overflow_arg_area
;
14 } __builtin_va_list
[1];
16 void *__va_arg(__builtin_va_list ap
, int arg_type
, int size
, int align
);
18 #define __builtin_va_start(ap, last) \
19 (*(ap) = *(__builtin_va_list)((char*)__builtin_frame_address(0) - 24))
20 #define __builtin_va_arg(ap, t) \
21 (*(t *)(__va_arg(ap, __builtin_va_arg_types(t), sizeof(t), __alignof__(t))))
22 #define __builtin_va_copy(dest, src) (*(dest) = *(src))
25 typedef char *__builtin_va_list
;
26 #define __builtin_va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \
27 ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8))
31 typedef char *__builtin_va_list
;
32 #define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x)
33 #define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \
34 & ~(_tcc_alignof(type) - 1))
35 #define __builtin_va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
36 #define __builtin_va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \
37 &~3), *(type *)(ap - ((sizeof(type)+3)&~3)))
39 #elif defined(__aarch64__)
49 typedef char *__builtin_va_list
;
50 #define __va_reg_size (__riscv_xlen >> 3)
51 #define _tcc_align(addr,type) (((unsigned long)addr + __alignof__(type) - 1) \
52 & -(__alignof__(type)))
53 #define __builtin_va_arg(ap,type) (*(sizeof(type) > (2*__va_reg_size) ? *(type **)((ap += __va_reg_size) - __va_reg_size) : (ap = (va_list)(_tcc_align(ap,type) + (sizeof(type)+__va_reg_size - 1)& -__va_reg_size), (type *)(ap - ((sizeof(type)+ __va_reg_size - 1)& -__va_reg_size)))))
56 typedef char *__builtin_va_list
;
57 #define __builtin_va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)
58 #define __builtin_va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3)))
61 #ifndef __builtin_va_copy
62 #define __builtin_va_copy(dest, src) (dest) = (src)
64 #define __builtin_va_end(ap) (void)(ap)