lib: Make stdarg work for GCC on RISC-V64.
* include/stdarg.h: GCC on RISC-V always passes arguments in registers. Implementing these macros without the use of built-ins would be very involved. So use those for now to make printf etc work.
This commit is contained in:
parent
9d7360cca6
commit
c8dfa47e10
|
@ -1,6 +1,7 @@
|
||||||
/* -*-comment-start: "//";comment-end:""-*-
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
* GNU Mes --- Maxwell Equations of Software
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
* Copyright © 2021 W. J. van der Laan <laanwj@protonmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of GNU Mes.
|
* This file is part of GNU Mes.
|
||||||
*
|
*
|
||||||
|
@ -26,7 +27,19 @@
|
||||||
|
|
||||||
#define va_arg8(ap, type) va_arg(ap, type)
|
#define va_arg8(ap, type) va_arg(ap, type)
|
||||||
|
|
||||||
#else // ! SYSTEM_LIBC
|
#elif __GNUC__ && __riscv
|
||||||
|
|
||||||
|
// GCC on RISC-V always passes arguments in registers. Implementing
|
||||||
|
// these macros without the use of built-ins would be very involved.
|
||||||
|
typedef __builtin_va_list va_list;
|
||||||
|
|
||||||
|
#define va_start(v, l) __builtin_va_start (v, l)
|
||||||
|
#define va_end(v) __builtin_va_end (v)
|
||||||
|
#define va_arg(v, l) __builtin_va_arg (v, l)
|
||||||
|
#define va_arg8(ap, type) va_arg (ap, type)
|
||||||
|
#define va_copy(d, s) __builtin_va_copy (d, s)
|
||||||
|
|
||||||
|
#else // ! SYSTEM_LIBC && ! __riscv
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue