Skip to content

Commit 722c5d5

Browse files
authored
Merge pull request oracle#8 from zakkak/2024-08-20-backport-libffi-update
Backport: [GR-55064] Update LIBFFI to 3.4.6
2 parents 47161c4 + 2d5a579 commit 722c5d5

File tree

7 files changed

+38
-107
lines changed

7 files changed

+38
-107
lines changed

truffle/mx.truffle/mx_truffle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,10 +1036,10 @@ def __init__(self, suite, name, deps, workingSets, **kwargs):
10361036
self.out_dir = self.get_output_root()
10371037
if mx.get_os() == 'windows':
10381038
self.delegate = mx_native.DefaultNativeProject(suite, name, subDir, [], [], None,
1039-
mx.join(self.out_dir, 'libffi-3.4.4'),
1039+
mx.join(self.out_dir, 'libffi-3.4.6'),
10401040
'static_lib',
10411041
deliverable='ffi',
1042-
cflags=['-MD', '-O2', '-DFFI_BUILDING_DLL'])
1042+
cflags=['-MD', '-O2', '-DFFI_STATIC_BUILD'])
10431043
self.delegate._source = dict(tree=['include',
10441044
'src',
10451045
mx.join('src', 'x86')],
@@ -1073,7 +1073,7 @@ def getArchivableResults(self, use_relpath=True, single=False):
10731073
'include/ffi.h',
10741074
'include/ffitarget.h'],
10751075
mx.join(self.out_dir, 'libffi-build'),
1076-
mx.join(self.out_dir, 'libffi-3.4.4'))
1076+
mx.join(self.out_dir, 'libffi-3.4.6'))
10771077
configure_args = ['--disable-dependency-tracking',
10781078
'--disable-shared',
10791079
'--with-pic',

truffle/mx.truffle/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@
7272

7373
"LIBFFI_SOURCES" : {
7474
"resource" : True,
75-
"version" : "3.4.4",
75+
"version" : "3.4.6",
7676
"urls" : [
7777
"https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/libffi-{version}.tar.gz",
7878
"https://github.com/libffi/libffi/releases/download/v{version}/libffi-{version}.tar.gz",
7979
],
80-
"digest" : "sha512:88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889",
80+
"digest" : "sha512:033d2600e879b83c6bce0eb80f69c5f32aa775bf2e962c9d39fbd21226fa19d1e79173d8eaa0d0157014d54509ea73315ad86842356fc3a303c0831c94c6ab39",
8181
},
8282

8383
"ANTLR4": {

truffle/src/com.oracle.truffle.nfi.native/src/closure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
#if defined(_WIN32)
4242
// Workaround for static linking. See comment in ffi.h, line 115.
43-
#define FFI_BUILDING
43+
#define FFI_STATIC_BUILD
4444
#endif
4545

4646
#include "trufflenfi.h"

truffle/src/com.oracle.truffle.nfi.native/src/jni.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
#if defined(_WIN32)
4242
// Workaround for static linking. See comment in ffi.h, line 115.
43-
#define FFI_BUILDING
43+
#define FFI_STATIC_BUILD
4444
#endif
4545

4646
#include "native.h"

truffle/src/com.oracle.truffle.nfi.native/src/signature.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
*/
4141
#if defined(_WIN32)
4242
// Workaround for static linking. See comment in ffi.h, line 115.
43-
#define FFI_BUILDING
43+
#define FFI_STATIC_BUILD
4444
#endif
4545

4646
#include "native.h"

truffle/src/libffi/patches/windows-amd64/0001-Preconfigure-sources-for-x64-Windows-build.patch

Lines changed: 24 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
From dcbda6eaf27ea03dd09b0d7edf67351c07209f2f Mon Sep 17 00:00:00 2001
1+
From fd913e2cce4901c12be4b6e0d88a1a719cc3a8fb Mon Sep 17 00:00:00 2001
22
From: Roland Schatz <roland.schatz@oracle.com>
3-
Date: Thu, 7 Apr 2022 18:09:05 +0200
3+
Date: Mon, 8 Jul 2024 14:18:28 +0200
44
Subject: [PATCH 1/2] Preconfigure sources for x64 Windows build
55

6-
The configuration was done using Git for Windows to run
7-
`configure` from Developer Command Prompt:
6+
The configuration was done using the x64 Native Tools Command Prompt for
7+
VS 2022, with Git for Windows on the PATH. To reproduce run this
8+
command:
89

910
> sh configure --disable-builddir ^
1011
--disable-dependency-tracking ^
@@ -16,33 +17,29 @@ The configuration was done using Git for Windows to run
1617
CXXCPP="cl -nologo -EP" ^
1718
--build=amd64-mingw64
1819
---
19-
fficonfig.h.in => fficonfig.h | 125 ++++++++++++++++---------------
20-
include/{ffi.h.in => ffi.h} | 18 ++---
20+
fficonfig.h.in => fficonfig.h | 103 ++++++++++++++++---------------
21+
include/{ffi.h.in => ffi.h} | 14 ++---
2122
{src/x86 => include}/ffitarget.h | 0
22-
3 files changed, 72 insertions(+), 71 deletions(-)
23-
rename fficonfig.h.in => fficonfig.h (71%)
23+
3 files changed, 59 insertions(+), 58 deletions(-)
24+
rename fficonfig.h.in => fficonfig.h (70%)
2425
rename include/{ffi.h.in => ffi.h} (98%)
2526
rename {src/x86 => include}/ffitarget.h (100%)
2627

2728
diff --git a/fficonfig.h.in b/fficonfig.h
28-
similarity index 71%
29+
similarity index 70%
2930
rename from fficonfig.h.in
3031
rename to fficonfig.h
31-
index d38b781..6284190 100644
32+
index 2e4aac6..59723f3 100644
3233
--- a/fficonfig.h.in
3334
+++ b/fficonfig.h
34-
@@ -1,171 +1,172 @@
35+
@@ -1,159 +1,160 @@
3536
+/* fficonfig.h. Generated from fficonfig.h.in by configure. */
3637
/* fficonfig.h.in. Generated from configure.ac by autoheader. */
3738

3839
/* Define if building universal (internal helper macro) */
3940
-#undef AC_APPLE_UNIVERSAL_BUILD
4041
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
4142

42-
/* Define to 1 if using 'alloca.c'. */
43-
-#undef C_ALLOCA
44-
+/* #undef C_ALLOCA */
45-
4643
/* Define to the flags needed for the .section .eh_frame directive. */
4744
-#undef EH_FRAME_FLAGS
4845
+/* #undef EH_FRAME_FLAGS */
@@ -76,11 +73,7 @@ index d38b781..6284190 100644
7673
-#undef FFI_NO_STRUCTS
7774
+/* #undef FFI_NO_STRUCTS */
7875

79-
/* Define to 1 if you have 'alloca', as a function or macro. */
80-
-#undef HAVE_ALLOCA
81-
+#define HAVE_ALLOCA 1
82-
83-
/* Define to 1 if <alloca.h> works. */
76+
/* Define to 1 if you have the <alloca.h> header file. */
8477
-#undef HAVE_ALLOCA_H
8578
+/* #undef HAVE_ALLOCA_H */
8679

@@ -137,30 +130,6 @@ index d38b781..6284190 100644
137130
-#undef HAVE_MEMFD_CREATE
138131
+/* #undef HAVE_MEMFD_CREATE */
139132

140-
/* Define to 1 if you have the `mkostemp' function. */
141-
-#undef HAVE_MKOSTEMP
142-
+/* #undef HAVE_MKOSTEMP */
143-
144-
/* Define to 1 if you have the `mkstemp' function. */
145-
-#undef HAVE_MKSTEMP
146-
+/* #undef HAVE_MKSTEMP */
147-
148-
/* Define to 1 if you have the `mmap' function. */
149-
-#undef HAVE_MMAP
150-
+/* #undef HAVE_MMAP */
151-
152-
/* Define if mmap with MAP_ANON(YMOUS) works. */
153-
-#undef HAVE_MMAP_ANON
154-
+/* #undef HAVE_MMAP_ANON */
155-
156-
/* Define if mmap of /dev/zero works. */
157-
-#undef HAVE_MMAP_DEV_ZERO
158-
+/* #undef HAVE_MMAP_DEV_ZERO */
159-
160-
/* Define if read-only mmap of a plain file works. */
161-
-#undef HAVE_MMAP_FILE
162-
+/* #undef HAVE_MMAP_FILE */
163-
164133
/* Define if your compiler supports pointer authentication. */
165134
-#undef HAVE_PTRAUTH
166135
+/* #undef HAVE_PTRAUTH */
@@ -193,10 +162,6 @@ index d38b781..6284190 100644
193162
-#undef HAVE_SYS_MEMFD_H
194163
+/* #undef HAVE_SYS_MEMFD_H */
195164

196-
/* Define to 1 if you have the <sys/mman.h> header file. */
197-
-#undef HAVE_SYS_MMAN_H
198-
+/* #undef HAVE_SYS_MMAN_H */
199-
200165
/* Define to 1 if you have the <sys/stat.h> header file. */
201166
-#undef HAVE_SYS_STAT_H
202167
+#define HAVE_SYS_STAT_H 1
@@ -231,7 +196,7 @@ index d38b781..6284190 100644
231196

232197
/* Define to the full name and version of this package. */
233198
-#undef PACKAGE_STRING
234-
+#define PACKAGE_STRING "libffi 3.4.4"
199+
+#define PACKAGE_STRING "libffi 3.4.6"
235200

236201
/* Define to the one symbol short name of this package. */
237202
-#undef PACKAGE_TARNAME
@@ -243,7 +208,7 @@ index d38b781..6284190 100644
243208

244209
/* Define to the version of this package. */
245210
-#undef PACKAGE_VERSION
246-
+#define PACKAGE_VERSION "3.4.4"
211+
+#define PACKAGE_VERSION "3.4.6"
247212

248213
/* The size of `double', as computed by sizeof. */
249214
-#undef SIZEOF_DOUBLE
@@ -257,15 +222,6 @@ index d38b781..6284190 100644
257222
-#undef SIZEOF_SIZE_T
258223
+#define SIZEOF_SIZE_T 8
259224

260-
/* If using the C implementation of alloca, define if you know the
261-
direction of stack growth for your system; otherwise it will be
262-
@@ -173,22 +174,22 @@
263-
STACK_DIRECTION > 0 => grows toward higher addresses
264-
STACK_DIRECTION < 0 => grows toward lower addresses
265-
STACK_DIRECTION = 0 => direction of growth unknown */
266-
-#undef STACK_DIRECTION
267-
+/* #undef STACK_DIRECTION */
268-
269225
/* Define to 1 if all of the C90 standard headers exist (not just the ones
270226
required in a freestanding environment). This macro is provided for
271227
backward compatibility; new code need not use it. */
@@ -283,11 +239,11 @@ index d38b781..6284190 100644
283239

284240
/* Version number of package */
285241
-#undef VERSION
286-
+#define VERSION "3.4.4"
242+
+#define VERSION "3.4.6"
287243

288244
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
289245
significant byte first (like Motorola and SPARC, unlike Intel). */
290-
@@ -198,12 +199,12 @@
246+
@@ -163,7 +164,7 @@
291247
# endif
292248
#else
293249
# ifndef WORDS_BIGENDIAN
@@ -296,24 +252,18 @@ index d38b781..6284190 100644
296252
# endif
297253
#endif
298254

299-
/* Define to `unsigned int' if <sys/types.h> does not define. */
300-
-#undef size_t
301-
+/* #undef size_t */
302-
303-
304-
#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE
305255
diff --git a/include/ffi.h.in b/include/ffi.h
306256
similarity index 98%
307257
rename from include/ffi.h.in
308258
rename to include/ffi.h
309-
index 227ac79..6318a33 100644
259+
index e5c1dae..ef012e2 100644
310260
--- a/include/ffi.h.in
311261
+++ b/include/ffi.h
312262
@@ -1,5 +1,5 @@
313263
/* -----------------------------------------------------------------*-C-*-
314264
- libffi @VERSION@
315-
+ libffi 3.4.4
316-
- Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green
265+
+ libffi 3.4.6
266+
- Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green
317267
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
318268

319269
@@ -50,8 +50,8 @@ extern "C" {
@@ -336,25 +286,7 @@ index 227ac79..6318a33 100644
336286
#define FFI_TYPE_LONGDOUBLE 4
337287
#else
338288
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
339-
@@ -223,7 +223,7 @@ FFI_EXTERN ffi_type ffi_type_float;
340-
FFI_EXTERN ffi_type ffi_type_double;
341-
FFI_EXTERN ffi_type ffi_type_pointer;
342-
343-
-#if @HAVE_LONG_DOUBLE@
344-
+#if 0
345-
FFI_EXTERN ffi_type ffi_type_longdouble;
346-
#else
347-
#define ffi_type_longdouble ffi_type_double
348-
@@ -232,7 +232,7 @@ FFI_EXTERN ffi_type ffi_type_longdouble;
349-
#ifdef FFI_TARGET_HAS_COMPLEX_TYPE
350-
FFI_EXTERN ffi_type ffi_type_complex_float;
351-
FFI_EXTERN ffi_type ffi_type_complex_double;
352-
-#if @HAVE_LONG_DOUBLE@
353-
+#if 0
354-
FFI_EXTERN ffi_type ffi_type_complex_longdouble;
355-
#else
356-
#define ffi_type_complex_longdouble ffi_type_complex_double
357-
@@ -333,7 +333,7 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
289+
@@ -322,7 +322,7 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
358290
__declspec(align(8))
359291
#endif
360292
typedef struct {
@@ -363,7 +295,7 @@ index 227ac79..6318a33 100644
363295
void *trampoline_table;
364296
void *trampoline_table_entry;
365297
#else
366-
@@ -394,7 +394,7 @@ ffi_prep_closure_loc (ffi_closure*,
298+
@@ -375,7 +375,7 @@ ffi_prep_closure_loc (ffi_closure*,
367299
# pragma pack 8
368300
#endif
369301
typedef struct {
@@ -372,7 +304,7 @@ index 227ac79..6318a33 100644
372304
void *trampoline_table;
373305
void *trampoline_table_entry;
374306
#else
375-
@@ -419,7 +419,7 @@ typedef struct {
307+
@@ -400,7 +400,7 @@ typedef struct {
376308
} ffi_raw_closure;
377309

378310
typedef struct {
@@ -386,5 +318,5 @@ similarity index 100%
386318
rename from src/x86/ffitarget.h
387319
rename to include/ffitarget.h
388320
--
389-
2.38.4
321+
2.44.1
390322

truffle/src/libffi/patches/windows-amd64/0002-Adjust-sources-for-building-with-mx.patch

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
From e5a5380862ea8e92c3e0c1634c5f305c8648425b Mon Sep 17 00:00:00 2001
1+
From 9601e9219678f2a1ad628ae78e4d8c11c27217a9 Mon Sep 17 00:00:00 2001
22
From: Roland Schatz <roland.schatz@oracle.com>
33
Date: Wed, 17 May 2023 16:10:46 +0200
44
Subject: [PATCH 2/2] Adjust sources for building with mx
55

66
---
77
include/Makefile.am | 9 -
8-
include/Makefile.in | 610 ---------------------------------
8+
include/Makefile.in | 609 ---------------------------------
99
{include => src}/ffi_common.h | 0
1010
fficonfig.h => src/fficonfig.h | 0
11-
4 files changed, 619 deletions(-)
11+
4 files changed, 618 deletions(-)
1212
delete mode 100644 include/Makefile.am
1313
delete mode 100644 include/Makefile.in
1414
rename {include => src}/ffi_common.h (100%)
@@ -31,10 +31,10 @@ index 5f0d406..0000000
3131
-nodist_include_HEADERS = ffi.h ffitarget.h
3232
diff --git a/include/Makefile.in b/include/Makefile.in
3333
deleted file mode 100644
34-
index 7e3bbf0..0000000
34+
index ae3ad01..0000000
3535
--- a/include/Makefile.in
3636
+++ /dev/null
37-
@@ -1,610 +0,0 @@
37+
@@ -1,609 +0,0 @@
3838
-# Makefile.in generated by automake 1.16.5 from Makefile.am.
3939
-# @configure_input@
4040
-
@@ -219,7 +219,6 @@ index 7e3bbf0..0000000
219219
-am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ffi.h.in
220220
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
221221
-ACLOCAL = @ACLOCAL@
222-
-ALLOCA = @ALLOCA@
223222
-AMTAR = @AMTAR@
224223
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
225224
-AM_LTLDFLAGS = @AM_LTLDFLAGS@
@@ -654,5 +653,5 @@ similarity index 100%
654653
rename from fficonfig.h
655654
rename to src/fficonfig.h
656655
--
657-
2.38.4
656+
2.44.1
658657

0 commit comments

Comments
 (0)