forked from pool/libffi
Accepting request 578419 from home:Andreas_Schwab:Factory
- Remove aarch64-struct-by-value.patch, needs to be fixed in python. OBS-URL: https://build.opensuse.org/request/show/578419 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libffi?expand=0&rev=9
This commit is contained in:
parent
4eea312941
commit
c8bd4caf53
@ -1,111 +0,0 @@
|
|||||||
Subject: [PATCH] Fix passing struct by value on aarch64
|
|
||||||
|
|
||||||
Index: libffi-3.2.1.git259/src/aarch64/ffi.c
|
|
||||||
===================================================================
|
|
||||||
--- libffi-3.2.1.git259.orig/src/aarch64/ffi.c
|
|
||||||
+++ libffi-3.2.1.git259/src/aarch64/ffi.c
|
|
||||||
@@ -238,13 +238,18 @@ is_vfp_type (const ffi_type *ty)
|
|
||||||
state.
|
|
||||||
|
|
||||||
The terse state variable names match the names used in the AARCH64
|
|
||||||
- PCS. */
|
|
||||||
+ PCS.
|
|
||||||
+
|
|
||||||
+ The struct area is allocated downwards from the top of the argument
|
|
||||||
+ area. It is used to hold copies of structures passed by value that are
|
|
||||||
+ bigger than 16 bytes. */
|
|
||||||
|
|
||||||
struct arg_state
|
|
||||||
{
|
|
||||||
unsigned ngrn; /* Next general-purpose register number. */
|
|
||||||
unsigned nsrn; /* Next vector register number. */
|
|
||||||
size_t nsaa; /* Next stack offset. */
|
|
||||||
+ size_t next_struct_area; /* Place to allocate big structs. */
|
|
||||||
|
|
||||||
#if defined (__APPLE__)
|
|
||||||
unsigned allocating_variadic;
|
|
||||||
@@ -253,11 +258,12 @@ struct arg_state
|
|
||||||
|
|
||||||
/* Initialize a procedure call argument marshalling state. */
|
|
||||||
static void
|
|
||||||
-arg_init (struct arg_state *state)
|
|
||||||
+arg_init (struct arg_state *state, size_t size)
|
|
||||||
{
|
|
||||||
state->ngrn = 0;
|
|
||||||
state->nsrn = 0;
|
|
||||||
state->nsaa = 0;
|
|
||||||
+ state->next_struct_area = size;
|
|
||||||
#if defined (__APPLE__)
|
|
||||||
state->allocating_variadic = 0;
|
|
||||||
#endif
|
|
||||||
@@ -286,6 +292,21 @@ allocate_to_stack (struct arg_state *sta
|
|
||||||
return (char *)stack + nsaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* Allocate and copy a structure that is passed by value on the stack and
|
|
||||||
+ return a pointer to it. */
|
|
||||||
+static void *
|
|
||||||
+allocate_and_copy_struct_to_stack (struct arg_state *state, void *stack,
|
|
||||||
+ size_t alignment, size_t size, void *value)
|
|
||||||
+{
|
|
||||||
+ size_t dest = state->next_struct_area - size;
|
|
||||||
+
|
|
||||||
+ /* Round down to the natural alignment of the value. */
|
|
||||||
+ dest = ALIGN_DOWN (dest, alignment);
|
|
||||||
+ state->next_struct_area = dest;
|
|
||||||
+
|
|
||||||
+ return memcpy ((char *) stack + dest, value, size);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static ffi_arg
|
|
||||||
extend_integer_type (void *source, int type)
|
|
||||||
{
|
|
||||||
@@ -591,13 +612,14 @@ ffi_call_int (ffi_cif *cif, void (*fn)(v
|
|
||||||
frame = stack + stack_bytes;
|
|
||||||
rvalue = (rsize ? frame + 32 : orig_rvalue);
|
|
||||||
|
|
||||||
- arg_init (&state);
|
|
||||||
+ arg_init (&state, stack_bytes);
|
|
||||||
for (i = 0, nargs = cif->nargs; i < nargs; i++)
|
|
||||||
{
|
|
||||||
ffi_type *ty = cif->arg_types[i];
|
|
||||||
size_t s = ty->size;
|
|
||||||
void *a = avalue[i];
|
|
||||||
int h, t;
|
|
||||||
+ void *dest;
|
|
||||||
|
|
||||||
t = ty->type;
|
|
||||||
switch (t)
|
|
||||||
@@ -645,8 +667,6 @@ ffi_call_int (ffi_cif *cif, void (*fn)(v
|
|
||||||
case FFI_TYPE_STRUCT:
|
|
||||||
case FFI_TYPE_COMPLEX:
|
|
||||||
{
|
|
||||||
- void *dest;
|
|
||||||
-
|
|
||||||
h = is_vfp_type (ty);
|
|
||||||
if (h)
|
|
||||||
{
|
|
||||||
@@ -664,9 +684,12 @@ ffi_call_int (ffi_cif *cif, void (*fn)(v
|
|
||||||
else if (s > 16)
|
|
||||||
{
|
|
||||||
/* If the argument is a composite type that is larger than 16
|
|
||||||
- bytes, then the argument has been copied to memory, and
|
|
||||||
+ bytes, then the argument is copied to memory, and
|
|
||||||
the argument is replaced by a pointer to the copy. */
|
|
||||||
- a = &avalue[i];
|
|
||||||
+ dest = allocate_and_copy_struct_to_stack (&state, stack,
|
|
||||||
+ ty->alignment, s,
|
|
||||||
+ avalue[i]);
|
|
||||||
+ a = &dest;
|
|
||||||
t = FFI_TYPE_POINTER;
|
|
||||||
s = sizeof (void *);
|
|
||||||
goto do_pointer;
|
|
||||||
@@ -835,7 +858,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
|
|
||||||
int i, h, nargs, flags;
|
|
||||||
struct arg_state state;
|
|
||||||
|
|
||||||
- arg_init (&state);
|
|
||||||
+ arg_init (&state, cif->bytes);
|
|
||||||
|
|
||||||
for (i = 0, nargs = cif->nargs; i < nargs; i++)
|
|
||||||
{
|
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Feb 20 09:55:15 UTC 2018 - schwab@suse.de
|
||||||
|
|
||||||
|
- Remove aarch64-struct-by-value.patch, needs to be fixed in python.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Sep 18 10:46:22 UTC 2017 - schwab@suse.de
|
Mon Sep 18 10:46:22 UTC 2017 - schwab@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package libffi
|
# spec file for package libffi
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -28,7 +28,6 @@ Url: https://github.com/libffi/
|
|||||||
Source: %name-%version.tar.xz
|
Source: %name-%version.tar.xz
|
||||||
Source99: baselibs.conf
|
Source99: baselibs.conf
|
||||||
Patch: libffi-include-location.patch
|
Patch: libffi-include-location.patch
|
||||||
Patch1: aarch64-struct-by-value.patch
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
@ -81,7 +80,6 @@ time.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch -p1
|
%patch -p1
|
||||||
%patch1 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user