ffi 1.17.1 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -1
- data/Rakefile +1 -1
- data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +48 -60
- data/ext/ffi_c/libffi/Makefile.am +4 -3
- data/ext/ffi_c/libffi/Makefile.in +5 -25
- data/ext/ffi_c/libffi/README.md +19 -2
- data/ext/ffi_c/libffi/acinclude.m4 +6 -0
- data/ext/ffi_c/libffi/config.guess +80 -22
- data/ext/ffi_c/libffi/config.sub +161 -80
- data/ext/ffi_c/libffi/configure +968 -1266
- data/ext/ffi_c/libffi/configure.ac +9 -8
- data/ext/ffi_c/libffi/configure.host +0 -5
- data/ext/ffi_c/libffi/doc/Makefile.in +1 -0
- data/ext/ffi_c/libffi/doc/libffi.texi +3 -3
- data/ext/ffi_c/libffi/doc/version.texi +4 -4
- data/ext/ffi_c/libffi/fficonfig.h.in +9 -9
- data/ext/ffi_c/libffi/include/Makefile.in +1 -0
- data/ext/ffi_c/libffi/include/ffi_cfi.h +2 -0
- data/ext/ffi_c/libffi/include/ffi_common.h +17 -0
- data/ext/ffi_c/libffi/man/Makefile.in +1 -0
- data/ext/ffi_c/libffi/src/aarch64/ffi.c +7 -4
- data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +2 -2
- data/ext/ffi_c/libffi/src/aarch64/internal.h +63 -17
- data/ext/ffi_c/libffi/src/aarch64/sysv.S +16 -12
- data/ext/ffi_c/libffi/src/arc/arcompact.S +2 -2
- data/ext/ffi_c/libffi/src/arc/ffi.c +6 -2
- data/ext/ffi_c/libffi/src/closures.c +3 -3
- data/ext/ffi_c/libffi/src/dlmalloc.c +1 -0
- data/ext/ffi_c/libffi/src/mips/ffitarget.h +2 -4
- data/ext/ffi_c/libffi/src/mips/n32.S +4 -0
- data/ext/ffi_c/libffi/src/mips/o32.S +4 -0
- data/ext/ffi_c/libffi/src/or1k/ffi.c +2 -2
- data/ext/ffi_c/libffi/src/powerpc/ffi.c +13 -0
- data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +26 -19
- data/ext/ffi_c/libffi/src/powerpc/ffi_sysv.c +26 -16
- data/ext/ffi_c/libffi/src/powerpc/internal.h +10 -0
- data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +47 -0
- data/ext/ffi_c/libffi/src/powerpc/ppc_closure.S +24 -0
- data/ext/ffi_c/libffi/src/prep_cif.c +1 -4
- data/ext/ffi_c/libffi/src/s390/ffi.c +28 -1
- data/ext/ffi_c/libffi/src/s390/internal.h +11 -0
- data/ext/ffi_c/libffi/src/s390/sysv.S +38 -0
- data/ext/ffi_c/libffi/src/sparc/ffi.c +16 -0
- data/ext/ffi_c/libffi/src/wasm32/ffi.c +10 -262
- data/ext/ffi_c/libffi/src/x86/ffi.c +4 -1
- data/ext/ffi_c/libffi/src/x86/ffi64.c +4 -1
- data/ext/ffi_c/libffi/testsuite/Makefile.am +4 -3
- data/ext/ffi_c/libffi/testsuite/Makefile.in +5 -3
- data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +4 -24
- data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +8 -25
- data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +3 -28
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback2.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback3.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/callback4.c +2 -2
- data/ext/ffi_c/libffi/testsuite/libffi.call/overread.c +54 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/struct_int_float.c +88 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +1 -0
- data/ext/ffi_c/libffi/testsuite/libffi.call/x32.c +31 -0
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +1 -1
- data/ext/ffi_c/libffi/testsuite/libffi.complex/complex_int.c +1 -1
- data/lib/ffi/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +0 -0
- data/ext/ffi_c/libffi/.circleci/config.yml +0 -156
- data/ext/ffi_c/libffi/src/nios2/ffi.c +0 -304
- data/ext/ffi_c/libffi/src/nios2/ffitarget.h +0 -52
- data/ext/ffi_c/libffi/src/nios2/sysv.S +0 -136
@@ -29,6 +29,7 @@
|
|
29
29
|
----------------------------------------------------------------------- */
|
30
30
|
|
31
31
|
#include "ffi.h"
|
32
|
+
#include <tramp.h>
|
32
33
|
|
33
34
|
#ifdef POWERPC64
|
34
35
|
#include "ffi_common.h"
|
@@ -820,32 +821,38 @@ ffi_prep_closure_loc_linux64 (ffi_closure *closure,
|
|
820
821
|
void *user_data,
|
821
822
|
void *codeloc)
|
822
823
|
{
|
823
|
-
#if _CALL_ELF == 2
|
824
|
-
unsigned int *tramp = (unsigned int *) &closure->tramp[0];
|
825
|
-
|
826
824
|
if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI)
|
827
825
|
return FFI_BAD_ABI;
|
828
826
|
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
827
|
+
#ifdef FFI_EXEC_STATIC_TRAMP
|
828
|
+
if (ffi_tramp_is_present(closure))
|
829
|
+
{
|
830
|
+
/* Initialize the static trampoline's parameters. */
|
831
|
+
void (*dest)(void) = ffi_closure_LINUX64;
|
832
|
+
ffi_tramp_set_parms (closure->ftramp, dest, closure);
|
833
|
+
}
|
834
|
+
else
|
835
|
+
#endif
|
836
|
+
{
|
837
|
+
#if _CALL_ELF == 2
|
838
|
+
unsigned int *tramp = (unsigned int *) &closure->tramp[0];
|
839
|
+
tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */
|
840
|
+
tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */
|
841
|
+
tramp[2] = 0x7d8903a6; /* mtctr 12 */
|
842
|
+
tramp[3] = 0x4e800420; /* bctr */
|
833
843
|
/* 1: .quad function_addr */
|
834
844
|
/* 2: .quad context */
|
835
|
-
|
836
|
-
|
837
|
-
|
845
|
+
*(void **) &tramp[4] = (void *) ffi_closure_LINUX64;
|
846
|
+
*(void **) &tramp[6] = codeloc;
|
847
|
+
flush_icache ((char *) tramp, (char *) codeloc, 4 * 4);
|
838
848
|
#else
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
/* Copy function address and TOC from ffi_closure_LINUX64 OPD. */
|
845
|
-
memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *));
|
846
|
-
tramp[1] = codeloc;
|
847
|
-
memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *));
|
849
|
+
/* Copy function address and TOC from ffi_closure_LINUX64 OPD. */
|
850
|
+
void **tramp = (void **) &closure->tramp[0];
|
851
|
+
memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *));
|
852
|
+
tramp[1] = codeloc;
|
853
|
+
memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *));
|
848
854
|
#endif
|
855
|
+
}
|
849
856
|
|
850
857
|
closure->cif = cif;
|
851
858
|
closure->fun = fun;
|
@@ -29,6 +29,7 @@
|
|
29
29
|
----------------------------------------------------------------------- */
|
30
30
|
|
31
31
|
#include "ffi.h"
|
32
|
+
#include <tramp.h>
|
32
33
|
|
33
34
|
#ifndef POWERPC64
|
34
35
|
#include "ffi_common.h"
|
@@ -636,25 +637,34 @@ ffi_prep_closure_loc_sysv (ffi_closure *closure,
|
|
636
637
|
void *user_data,
|
637
638
|
void *codeloc)
|
638
639
|
{
|
639
|
-
unsigned int *tramp;
|
640
|
-
|
641
640
|
if (cif->abi < FFI_SYSV || cif->abi >= FFI_LAST_ABI)
|
642
641
|
return FFI_BAD_ABI;
|
643
642
|
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
/*
|
657
|
-
|
643
|
+
#ifdef FFI_EXEC_STATIC_TRAMP
|
644
|
+
if (ffi_tramp_is_present(closure))
|
645
|
+
{
|
646
|
+
/* Initialize the static trampoline's parameters. */
|
647
|
+
void (*dest)(void) = ffi_closure_SYSV;
|
648
|
+
ffi_tramp_set_parms (closure->ftramp, dest, closure);
|
649
|
+
}
|
650
|
+
else
|
651
|
+
#endif
|
652
|
+
{
|
653
|
+
unsigned int *tramp = (unsigned int *) &closure->tramp[0];
|
654
|
+
tramp[0] = 0x7c0802a6; /* mflr r0 */
|
655
|
+
tramp[1] = 0x429f0005; /* bcl 20,31,.+4 */
|
656
|
+
tramp[2] = 0x7d6802a6; /* mflr r11 */
|
657
|
+
tramp[3] = 0x7c0803a6; /* mtlr r0 */
|
658
|
+
tramp[4] = 0x800b0018; /* lwz r0,24(r11) */
|
659
|
+
tramp[5] = 0x816b001c; /* lwz r11,28(r11) */
|
660
|
+
tramp[6] = 0x7c0903a6; /* mtctr r0 */
|
661
|
+
tramp[7] = 0x4e800420; /* bctr */
|
662
|
+
*(void **) &tramp[8] = (void *) ffi_closure_SYSV; /* function */
|
663
|
+
*(void **) &tramp[9] = codeloc; /* context */
|
664
|
+
|
665
|
+
/* Flush the icache. */
|
666
|
+
flush_icache ((char *)tramp, (char *)codeloc, 8 * 4);
|
667
|
+
}
|
658
668
|
|
659
669
|
closure->cif = cif;
|
660
670
|
closure->fun = fun;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#ifdef FFI_EXEC_STATIC_TRAMP
|
2
|
+
/* For the trampoline code table mapping, a mapping size of 64K is chosen. */
|
3
|
+
#define PPC_TRAMP_MAP_SHIFT 16
|
4
|
+
#define PPC_TRAMP_MAP_SIZE (1 << PPC_TRAMP_MAP_SHIFT)
|
5
|
+
# ifdef __PCREL__
|
6
|
+
# define PPC_TRAMP_SIZE 24
|
7
|
+
# else
|
8
|
+
# define PPC_TRAMP_SIZE 40
|
9
|
+
# endif /* __PCREL__ */
|
10
|
+
#endif /* FFI_EXEC_STATIC_TRAMP */
|
@@ -27,6 +27,7 @@
|
|
27
27
|
#define LIBFFI_ASM
|
28
28
|
#include <fficonfig.h>
|
29
29
|
#include <ffi.h>
|
30
|
+
#include "internal.h"
|
30
31
|
|
31
32
|
.file "linux64_closure.S"
|
32
33
|
|
@@ -559,7 +560,53 @@ ffi_go_closure_linux64:
|
|
559
560
|
.size .ffi_go_closure_linux64,.-.ffi_go_closure_linux64
|
560
561
|
# endif
|
561
562
|
# endif
|
563
|
+
|
564
|
+
#ifdef FFI_EXEC_STATIC_TRAMP
|
565
|
+
.text
|
566
|
+
.align PPC_TRAMP_MAP_SHIFT
|
567
|
+
FFI_HIDDEN (trampoline_code_table)
|
568
|
+
.globl trampoline_code_table
|
569
|
+
# if _CALL_ELF == 2
|
570
|
+
.type trampoline_code_table,@function
|
571
|
+
trampoline_code_table:
|
572
|
+
.localentry trampoline_code_table,.-trampoline_code_table
|
573
|
+
# else
|
574
|
+
.section ".opd","aw"
|
575
|
+
.align 3
|
576
|
+
trampoline_code_table:
|
577
|
+
.quad .L.trampoline_code_table,.TOC.@tocbase,0
|
578
|
+
.type trampoline_code_table,@function
|
579
|
+
.text
|
580
|
+
.L.trampoline_code_table:
|
581
|
+
# endif
|
582
|
+
.rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE
|
583
|
+
#ifdef __PCREL__
|
584
|
+
pla %r2,PPC_TRAMP_MAP_SIZE
|
585
|
+
ld %r11,0(%r2)
|
586
|
+
ld %r12,8(%r2)
|
587
|
+
mtctr %r12
|
588
|
+
bctr
|
589
|
+
#else
|
590
|
+
mflr %r0
|
591
|
+
bcl 20,31,$+4
|
592
|
+
mflr %r11
|
593
|
+
addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha
|
594
|
+
mtlr %r0
|
595
|
+
ld %r12,(PPC_TRAMP_MAP_SIZE+0)@l(%r11)
|
596
|
+
mtctr %r12
|
597
|
+
ld %r11,(PPC_TRAMP_MAP_SIZE-8)@l(%r11)
|
598
|
+
bctr
|
599
|
+
nop
|
600
|
+
#endif
|
601
|
+
.endr
|
602
|
+
.align PPC_TRAMP_MAP_SHIFT
|
603
|
+
#if _CALL_ELF == 2
|
604
|
+
.size trampoline_code_table,.-trampoline_code_table
|
605
|
+
#else
|
606
|
+
.size trampoline_code_table,.-.L.trampoline_code_table
|
562
607
|
#endif
|
608
|
+
#endif /* FFI_EXEC_STATIC_TRAMP */
|
609
|
+
#endif /* POWERPC64 */
|
563
610
|
|
564
611
|
#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2
|
565
612
|
.section .note.GNU-stack,"",@progbits
|
@@ -27,6 +27,7 @@
|
|
27
27
|
#define LIBFFI_ASM
|
28
28
|
#include <fficonfig.h>
|
29
29
|
#include <ffi.h>
|
30
|
+
#include "internal.h"
|
30
31
|
#include <powerpc/asm.h>
|
31
32
|
|
32
33
|
.file "ppc_closure.S"
|
@@ -391,6 +392,29 @@ ENTRY(ffi_go_closure_sysv)
|
|
391
392
|
.cfi_endproc
|
392
393
|
END(ffi_go_closure_sysv)
|
393
394
|
|
395
|
+
#ifdef FFI_EXEC_STATIC_TRAMP
|
396
|
+
.text
|
397
|
+
.align PPC_TRAMP_MAP_SHIFT
|
398
|
+
FFI_HIDDEN (trampoline_code_table)
|
399
|
+
.globl trampoline_code_table
|
400
|
+
.type trampoline_code_table,@function
|
401
|
+
trampoline_code_table:
|
402
|
+
.rept PPC_TRAMP_MAP_SIZE / PPC_TRAMP_SIZE
|
403
|
+
mflr %r0
|
404
|
+
bcl 20,31,$+4
|
405
|
+
mflr %r11
|
406
|
+
addis %r11,%r11,PPC_TRAMP_MAP_SIZE@ha
|
407
|
+
mtlr %r0
|
408
|
+
lwz %r0,(PPC_TRAMP_MAP_SIZE-4)@l(%r11)
|
409
|
+
mtctr %r0
|
410
|
+
lwz %r11,(PPC_TRAMP_MAP_SIZE-8)@l(%r11)
|
411
|
+
bctr
|
412
|
+
nop
|
413
|
+
.endr
|
414
|
+
.size trampoline_code_table,.-trampoline_code_table
|
415
|
+
.align PPC_TRAMP_MAP_SHIFT
|
416
|
+
#endif /* FFI_EXEC_STATIC_TRAMP */
|
417
|
+
|
394
418
|
#if defined __ELF__ && defined __linux__
|
395
419
|
.section .note.GNU-stack,"",@progbits
|
396
420
|
#endif
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* -----------------------------------------------------------------------
|
2
|
-
prep_cif.c - Copyright (c) 2011, 2012, 2021 Anthony Green
|
2
|
+
prep_cif.c - Copyright (c) 2011, 2012, 2021, 2025 Anthony Green
|
3
3
|
Copyright (c) 1996, 1998, 2007 Red Hat, Inc.
|
4
4
|
Copyright (c) 2022 Oracle and/or its affiliates.
|
5
5
|
|
@@ -158,9 +158,6 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
|
|
158
158
|
#endif
|
159
159
|
#ifdef XTENSA
|
160
160
|
&& (cif->rtype->size > 16)
|
161
|
-
#endif
|
162
|
-
#ifdef NIOS2
|
163
|
-
&& (cif->rtype->size > 8)
|
164
161
|
#endif
|
165
162
|
)
|
166
163
|
bytes = STACK_ARG_SIZE(sizeof(void*));
|
@@ -32,6 +32,7 @@
|
|
32
32
|
#include <ffi_common.h>
|
33
33
|
#include <stdint.h>
|
34
34
|
#include "internal.h"
|
35
|
+
#include <tramp.h>
|
35
36
|
|
36
37
|
/*====================== End of Includes =============================*/
|
37
38
|
|
@@ -720,16 +721,30 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
|
720
721
|
#endif
|
721
722
|
0x07f1 /* br %r1 */
|
722
723
|
};
|
723
|
-
|
724
|
+
void (*dest)(void);
|
724
725
|
unsigned long *tramp = (unsigned long *)&closure->tramp;
|
725
726
|
|
726
727
|
if (cif->abi != FFI_SYSV)
|
727
728
|
return FFI_BAD_ABI;
|
728
729
|
|
730
|
+
|
731
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
732
|
+
if (ffi_tramp_is_present(closure))
|
733
|
+
{
|
734
|
+
/* Initialize the static trampoline's parameters. */
|
735
|
+
dest = ffi_closure_SYSV;
|
736
|
+
ffi_tramp_set_parms (closure->ftramp, dest, closure);
|
737
|
+
goto out;
|
738
|
+
}
|
739
|
+
#endif
|
740
|
+
|
729
741
|
memcpy (tramp, template, sizeof(template));
|
730
742
|
tramp[2] = (unsigned long)codeloc;
|
731
743
|
tramp[3] = (unsigned long)&ffi_closure_SYSV;
|
732
744
|
|
745
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
746
|
+
out:
|
747
|
+
#endif
|
733
748
|
closure->cif = cif;
|
734
749
|
closure->fun = fun;
|
735
750
|
closure->user_data = user_data;
|
@@ -754,3 +769,15 @@ ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif,
|
|
754
769
|
|
755
770
|
return FFI_OK;
|
756
771
|
}
|
772
|
+
|
773
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
774
|
+
void *
|
775
|
+
ffi_tramp_arch (size_t *tramp_size, size_t *map_size)
|
776
|
+
{
|
777
|
+
extern void *trampoline_code_table;
|
778
|
+
|
779
|
+
*tramp_size = FFI390_TRAMP_SIZE;
|
780
|
+
*map_size = FFI390_TRAMP_MAP_SIZE;
|
781
|
+
return &trampoline_code_table;
|
782
|
+
}
|
783
|
+
#endif
|
@@ -9,3 +9,14 @@
|
|
9
9
|
#define FFI390_RET_IN_MEM 8
|
10
10
|
|
11
11
|
#define FFI390_RET_STRUCT (FFI390_RET_VOID | FFI390_RET_IN_MEM)
|
12
|
+
|
13
|
+
|
14
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
15
|
+
/*
|
16
|
+
* For the trampoline code table mapping, a mapping size of 4K is chosen.
|
17
|
+
*/
|
18
|
+
#define FFI390_TRAMP_MAP_SHIFT 12
|
19
|
+
#define FFI390_TRAMP_MAP_SIZE (1 << FFI390_TRAMP_MAP_SHIFT)
|
20
|
+
#define FFI390_TRAMP_SIZE 16
|
21
|
+
|
22
|
+
#endif
|
@@ -28,6 +28,7 @@
|
|
28
28
|
#define LIBFFI_ASM
|
29
29
|
#include <fficonfig.h>
|
30
30
|
#include <ffi.h>
|
31
|
+
#include "internal.h"
|
31
32
|
|
32
33
|
.text
|
33
34
|
|
@@ -318,6 +319,43 @@ ffi_closure_SYSV:
|
|
318
319
|
br %r14
|
319
320
|
.cfi_endproc
|
320
321
|
.size ffi_closure_SYSV,.-ffi_closure_SYSV
|
322
|
+
|
323
|
+
|
324
|
+
#if defined(FFI_EXEC_STATIC_TRAMP)
|
325
|
+
/*
|
326
|
+
* Below is the definition of the trampoline code table. Each element in
|
327
|
+
* the code table is a trampoline.
|
328
|
+
*/
|
329
|
+
/*
|
330
|
+
* The trampoline uses the volatile register r0 and r1. As the registers are
|
331
|
+
* marked volatile in the ABI, the original values are not saved.
|
332
|
+
*
|
333
|
+
* The trampoline has two parameters - target code to jump to and data for
|
334
|
+
* the target code. The trampoline extracts the parameters from its parameter
|
335
|
+
* block (see tramp_table_map()). The trampoline saves the data address in r0.
|
336
|
+
* Finally, it jumps to the target code.
|
337
|
+
*/
|
338
|
+
|
339
|
+
.align FFI390_TRAMP_MAP_SIZE
|
340
|
+
trampoline_code_table:
|
341
|
+
.rept FFI390_TRAMP_MAP_SIZE / FFI390_TRAMP_SIZE
|
342
|
+
basr %r1,0 # load next instruction address to r1
|
343
|
+
lmg %r0,%r1,4094(%r1) # load parameter block
|
344
|
+
# r0 -> data
|
345
|
+
# r1 -> code
|
346
|
+
br %r1 # jump to r1/code
|
347
|
+
.balign 8
|
348
|
+
.endr
|
349
|
+
|
350
|
+
.globl trampoline_code_table
|
351
|
+
FFI_HIDDEN(trampoline_code_table)
|
352
|
+
#ifdef __ELF__
|
353
|
+
.type trampoline_code_table, @function
|
354
|
+
.size trampoline_code_table,.- trampoline_code_table
|
355
|
+
#endif
|
356
|
+
.align FFI390_TRAMP_MAP_SIZE
|
357
|
+
#endif /* FFI_EXEC_STATIC_TRAMP */
|
358
|
+
|
321
359
|
#endif /* !s390x */
|
322
360
|
|
323
361
|
#if defined __ELF__ && defined __linux__
|
@@ -286,6 +286,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
|
|
286
286
|
void **avalue, void *closure)
|
287
287
|
{
|
288
288
|
size_t bytes = cif->bytes;
|
289
|
+
size_t i, nargs = cif->nargs;
|
290
|
+
ffi_type **arg_types = cif->arg_types;
|
289
291
|
|
290
292
|
FFI_ASSERT (cif->abi == FFI_V8);
|
291
293
|
|
@@ -295,6 +297,20 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
|
|
295
297
|
&& (cif->flags & SPARC_FLAG_RET_MASK) == SPARC_RET_STRUCT)
|
296
298
|
bytes += FFI_ALIGN (cif->rtype->size, 8);
|
297
299
|
|
300
|
+
/* If we have any structure arguments, make a copy so we are passing
|
301
|
+
by value. */
|
302
|
+
for (i = 0; i < nargs; i++)
|
303
|
+
{
|
304
|
+
ffi_type *at = arg_types[i];
|
305
|
+
int size = at->size;
|
306
|
+
if (at->type == FFI_TYPE_STRUCT)
|
307
|
+
{
|
308
|
+
char *argcopy = alloca (size);
|
309
|
+
memcpy (argcopy, avalue[i], size);
|
310
|
+
avalue[i] = argcopy;
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
298
314
|
ffi_call_v8(cif, fn, rvalue, avalue, -bytes, closure);
|
299
315
|
}
|
300
316
|
|