* src/or1k/ffi.c: fix prototype of ffi_call_SYSV()
The current code base of libffi on OpenRISC (or1k) fails to build with
GCC 14.x with the following error:
../src/or1k/ffi.c: In function 'ffi_call':
../src/or1k/ffi.c:167:34: error: passing argument 3 of 'ffi_call_SYSV' from incompatible pointer type [-Wincompatible-pointer-types]
167 | ffi_call_SYSV(size, &ecif, ffi_prep_args, rvalue, fn, cif->flags);
| ^~~~~~~~~~~~~
| |
| void * (*)(char *, extended_cif *)
../src/or1k/ffi.c:113:27: note: expected 'void * (*)(int *, extended_cif *)' but argument is of type 'void * (*)(char *, extended_cif *)'
113 | void *(*)(int *, extended_cif *),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is due to the fact that ffi_prep_args() is in fact defined as:
void* ffi_prep_args(char *stack, extended_cif *ecif)
so, let's fix the prototype of the function pointer, which anyway gets
passed to assembly code, so the typing gets lost.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
* src/or1k/ffi.c: fix incompatible pointer type
The current code base of libffi on OpenRISC (or1k) fails to build with
GCC 14.x with the following error:
../src/or1k/ffi.c: In function 'ffi_closure_SYSV':
../src/or1k/ffi.c:183:22: error: initialization of 'char *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
183 | char *stack_args = sp;
| ^~
Indeed:
register int *sp __asm__ ("r17");
[..]
char *stack_args = sp;
Adopt the same logic used for:
char *ptr = (char *) register_args;
which consists in casting to the desired pointer type. Indeed, later
in the code stack_args is assigned to ptr (so they need to be the same
pointer type), and some arithmetic is done on ptr, so changing its
pointer type would change the behavior.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---------
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
extern void ffi_call_SYSV(unsigned,
extended_cif *,
- void *(*)(int *, extended_cif *),
+ void *(*)(char *, extended_cif *),
unsigned *,
void (*fn)(void),
unsigned);
register int *r13 __asm__ ("r13");
ffi_closure* closure = (ffi_closure*) r13;
- char *stack_args = sp;
+ char *stack_args = (char*) sp;
/* Lay the register arguments down in a continuous chunk of memory. */
unsigned register_args[6] =